#!/bin/sh

attach -q scripts
. /mit/scripts/bin$scriptsdev/signup-minimal

if [ ! -d "/mit/$lname/mail_scripts/" ]; then
  mkdir -p /mit/$lname/mail_scripts
  fs sa /mit/$lname/mail_scripts system:anyuser l
  fs sa /mit/$lname/mail_scripts system:authuser none
  fs sa /mit/$lname/mail_scripts daemon.scripts read
  signupuser=`echo "$principal" | sed 's/@.*$//'`
  sed /SCRIPTS_USER/s//$signupuser/ /mit/scripts/bin/procmailrc > /mit/$lname/mail_scripts/procmailrc
  echo "By default, mail sent to $lname@scripts.mit.edu will be forwarded to"
  echo "$signupuser@mit.edu.  You should edit /mit/$lname/mail_scripts/procmailrc"
  echo "to change this and customize your procmail configuration."
  success "the mail script service" "The directory /mit/$lname/mail_scripts has been created."
else
  success "the mail script service" "The directory /mit/$lname/mail_scripts already exists."
fi
