welcome message
[public/pyceo-broken.git] / etc / spam / new-member
index a6851b3..f937fcf 100755 (executable)
@@ -6,66 +6,8 @@ PATH=/usr/bin:/bin
 unset ENV BASH_ENV CDPATH
 umask 077
 
-prog=$1
-auth=$2
-shift 2
+cd `dirname $0`
 
-tmp="$(tempfile)"
-trap "rm $tmp" 0
-exec >"$tmp"
-
-authrn="$(getent passwd "$auth" | awk -F: '{ print $5 }' | sed -e 's/,.*//')"
-
-h_from="$prog <ceo+$prog@csclub.uwaterloo.ca>"
-h_to="Membership and Accounts <ceo@csclub.uwaterloo.ca>"
-h_cc="$authrn <$auth@csclub.uwaterloo.ca>"
-
-if test "$prog" = addmember; then
-    user=$1 name=$2 dept=$3 status=$4; shift 4
-    subj="New Member: $user"
-    test -z "$dept" && dept="things unknown"
-    body="Name: $name
-Account: $user
-Program: $dept
-Added by: $auth"
-
-elif test "$prog" = addclub; then
-    user=$1 name=$2 status=$4; shift 4
-    subj="New Club Account: $user"
-    body="Club: $name
-Account: $user
-Added by: $auth"
-
-else
-    exit 1
-fi
-
-output=$(cat)
-
-if test "$status" = "failure"; then
-  subj="$subj (FAILURES)"
-fi
-
-echo "From: $h_from"
-echo "To: $h_to"
-echo "Cc: $h_cc"
-echo "X-Auth-User: $auth"
-echo "X-New-User: $user"
-echo "X-New-Name: $name"
-echo "Subject: $subj"
-echo
-echo "$body" | fmt -s
-echo
-
-if test "$status" = "success"; then
-    echo all failures went undetected
-elif test -n "$output"; then
-    echo "$output"
-fi
-
-echo
-echo Your Friend,
-echo "$prog"
-
-exec >&2
-env - /usr/sbin/sendmail -t -f "ceo@csclub.uwaterloo.ca" < "$tmp"
+export CEO_PROG="$1" CEO_AUTH="$2" CEO_USER="$3" CEO_NAME="$4" CEO_DEPT="$5" CEO_STATUS="$6"
+export CEO_OUTPUT="$(cat)"
+run-parts --umask=077 new-member.d