#!/bin/sh usage() { echo "usage: ./makelist.sh
" echo "" echo " is the list name, this should be a value suitable for a" echo "directory name, however '@', '.', and ' ' characters are not allowed." echo "
is the list post address, should be a valid email address." echo " is the primary point of contact for the list, should be a" echo "valid email address." echo "" echo "This script must be run from the top-level directory and may fail" echo "otherwise. This script will also fail if the requested list name" echo "already exists." echo "" echo "On success, mailing list config files are written to:" echo "userconfig/lists/" exit 1 } echo "$1" | grep -Eq '^[^/@. ]+$' || usage echo "$2" | grep -Eq '^[^ ]+@[^ ]+$' || usage echo "$3" | grep -Eq '^[^ ]+@[^ ]+$' || usage listdir="userconfig/lists/$1" unsub=$(echo "$2" | sed 's/@/+unsubscribe@/g') [ -d userconfig/lists ] || usage [ -d "$listdir" ] && usage mkdir "$listdir" # Default mlmmj list tunables echo "$2" >"$listdir/listaddress" echo "$3" >"$listdir/owner" echo "$3" >"$listdir/moderators" echo "X-Mailing-List: $2" >>"$listdir/customheaders" echo "List-Unsubscribe: " >>"$listdir/customheaders" touch "$listdir/notifysub" touch "$listdir/noget" touch "$listdir/nonomailsub"