From d2877410fdc9d3a9ff4d83c0066722292696bc6a Mon Sep 17 00:00:00 2001 From: Malfurious Date: Sat, 13 Jul 2024 14:47:47 -0400 Subject: Add mailing list generation script Create a user mailing list under userconfig with a sane set of initial configuration variables. Available configuration can be found at https://mlmmj.org/TUNABLES.html Signed-off-by: Malfurious --- makelist.sh | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100755 makelist.sh diff --git a/makelist.sh b/makelist.sh new file mode 100755 index 0000000..a1f1566 --- /dev/null +++ b/makelist.sh @@ -0,0 +1,40 @@ +#!/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" -- cgit v1.2.3