2010-05-02 20:24:01 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# 2010 Nico Schottelius (nico-nsbin at schottelius.org)
|
|
|
|
#
|
|
|
|
# This file is part of nsbin.
|
|
|
|
#
|
|
|
|
# nsbin is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# nsbin is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with nsbin. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
#
|
2010-08-19 16:58:36 +00:00
|
|
|
# Submit solution according to http://edu.panter.ch/FormelleBedingungenUebungenBetriebssysteme
|
2010-05-02 20:24:01 +00:00
|
|
|
#
|
|
|
|
|
2010-08-19 19:05:26 +00:00
|
|
|
|
|
|
|
################################################################################
|
|
|
|
# cconf standard vars
|
|
|
|
__pwd="$(pwd -P)"
|
|
|
|
__mydir="${0%/*}"; __abs_mydir="$(cd "$__mydir" && pwd -P)"
|
|
|
|
__myname=${0##*/}; __abs_myname="$__abs_mydir/$__myname"
|
|
|
|
|
|
|
|
set -x
|
|
|
|
|
2010-08-19 16:58:36 +00:00
|
|
|
if [ $# -ne 2 ]; then
|
|
|
|
cat << eof
|
|
|
|
$0: <subject> <srcdir>
|
2010-05-02 20:31:38 +00:00
|
|
|
|
2010-08-19 16:58:36 +00:00
|
|
|
eof
|
|
|
|
exit 1
|
|
|
|
fi
|
2010-05-02 20:24:01 +00:00
|
|
|
|
|
|
|
|
2010-08-19 16:58:36 +00:00
|
|
|
subject_suff="$1"; shift
|
|
|
|
input="$1"; shift
|
2010-08-19 19:05:26 +00:00
|
|
|
input_base="${input##*/}"
|
2010-05-02 20:24:01 +00:00
|
|
|
|
2010-08-19 16:58:36 +00:00
|
|
|
self="nschotte"
|
|
|
|
to="bseelige"
|
|
|
|
domain="@hsz-t.ch"
|
|
|
|
self_q="${self}${domain}"
|
|
|
|
to_q="${to}${domain}"
|
|
|
|
subject_pref="[Betriebssysteme]"
|
|
|
|
|
|
|
|
|
|
|
|
sendmail="/usr/sbin/sendmail"
|
|
|
|
to_all="${to_q} ${self_q}"
|
2010-08-19 19:05:26 +00:00
|
|
|
to_all="${self_q}"
|
2010-08-19 16:58:36 +00:00
|
|
|
|
2010-08-19 19:05:26 +00:00
|
|
|
# check stuff before sending out
|
|
|
|
|
|
|
|
( cd "${input}" && make test && make clean ); ret=$?
|
|
|
|
|
|
|
|
if [ "${ret}" -ne 0 ]; then
|
|
|
|
echo "Task not solved"
|
|
|
|
exit 1
|
|
|
|
fi
|
2010-08-19 16:58:36 +00:00
|
|
|
|
|
|
|
(
|
|
|
|
(
|
|
|
|
cat << eof
|
|
|
|
To: $to_all
|
|
|
|
Subject: $subject_pref $subject_suff
|
|
|
|
From: $self_q
|
|
|
|
|
|
|
|
|
2010-08-19 19:05:26 +00:00
|
|
|
Gesendet mit ${__myname}.
|
|
|
|
eof
|
2010-08-19 16:58:36 +00:00
|
|
|
)
|
2010-08-19 19:05:26 +00:00
|
|
|
cd "${input}/.." && tar c "${input_base}" | gzip -9 | uuencode "${subject_suff}.tar.gz"
|
2010-08-19 16:58:36 +00:00
|
|
|
) | $sendmail -f "$self_q" $to_all
|