#!/bin/bash -e
#
-# Make a new mailing list. Run as root on deleuze.
+# Make a new mailing list. Run as user in sudoers on mccarthy.
#
# Usage: listnew LISTNAME LISTDOMAIN LISTURL USER INITIAL_PASSWORD
echo "Not enough arguments"
usage
exit 1
+elif test "$UID" != "0"; then
+ echo "This program must be run as root"
+ usage
+ exit 1
else
LIST_NAME=$1
LIST_DOMAIN=$2
LIST_PASS=$5
fi
-sudo -u list $BIN/newlist $LIST_NAME@$LIST_DOMAIN $LIST_USER@hcoop.net \
- $LIST_PASS </dev/null
+# If DOMAIN is hcoop.net, force it to be lists.hcoop.net.
+if test "$LIST_DOMAIN" = "hcoop.net"; then
+ LIST_DOMAIN=lists.hcoop.net
+fi
+
+sudo -u list $BIN/newlist \
+ $LIST_NAME@$LIST_DOMAIN $LIST_USER@hcoop.net $LIST_PASS </dev/null
# By default, use our list admin website for the public interface.
# This can be changed after the user has set up their mailMan