only use basename of dir to tar

Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
Nico Schottelius 2010-08-19 21:05:26 +02:00
parent 0ce00d76fb
commit dda7e1b3bc
1 changed files with 22 additions and 3 deletions

View File

@ -20,6 +20,15 @@
# Submit solution according to http://edu.panter.ch/FormelleBedingungenUebungenBetriebssysteme
#
################################################################################
# cconf standard vars
__pwd="$(pwd -P)"
__mydir="${0%/*}"; __abs_mydir="$(cd "$__mydir" && pwd -P)"
__myname=${0##*/}; __abs_myname="$__abs_mydir/$__myname"
set -x
if [ $# -ne 2 ]; then
cat << eof
$0: <subject> <srcdir>
@ -31,6 +40,7 @@ fi
subject_suff="$1"; shift
input="$1"; shift
input_base="${input##*/}"
self="nschotte"
to="bseelige"
@ -42,8 +52,16 @@ subject_pref="[Betriebssysteme]"
sendmail="/usr/sbin/sendmail"
to_all="${to_q} ${self_q}"
to_all="${to_q}"
to_all="${self_q}"
# check stuff before sending out
( cd "${input}" && make test && make clean ); ret=$?
if [ "${ret}" -ne 0 ]; then
echo "Task not solved"
exit 1
fi
(
(
@ -52,8 +70,9 @@ To: $to_all
Subject: $subject_pref $subject_suff
From: $self_q
eof
Gesendet mit ${__myname}.
eof
)
tar c "${input}" | gzip -9 | uuencode "${subject_suff}.tar.gz"
cd "${input}/.." && tar c "${input_base}" | gzip -9 | uuencode "${subject_suff}.tar.gz"
) | $sendmail -f "$self_q" $to_all