blob: cbe399dcdc54363beb77d04d26f72fe77d369e90 (
plain)
- #!/bin/sh
- set -e
- cfgdir="/etc/local-ORG/mailman"
- sharedir="/etc/local-COMMON/mailman"
- skeldir="$sharedir/skel"
- MAILDOMAIN="${maildomain:-`head -n 1 /etc/mailname`}"
- LISTDOMAIN="$listdomain"
- LISTWEBDOMAIN="$listwebdomain"
- OWNER="${owner:-listmaster@$MAILDOMAIN}"
- LISTLANG="${lang:-en}"
- mkpw() {
- xkcdpass --numwords 4 --delimiter - || gpw | head -n 1
- }
- refreshlists() {
- existinglists="`/usr/sbin/list_lists -b`"
- }
- mklist() {
- list_anycase="$1"; shift
- type="$1"; shift
- desc="$1"; shift
- senders="$1"; shift
- list=$(printf %s "$list_anycase" | tr '[:upper:]' '[:lower:]')
- lang="${1:-$LISTLANG}"
- owner="${2:-$OWNER}"
- emailhost="${3:-$LISTDOMAIN}"
- urlhost="${4:-${LISTWEBDOMAIN:-$emailhost}}"
- moderator="${5:-${MODERATOR}}"
- if ! echo "$existinglists" | grep -q "^$list\$"; then
- newlist -l "$lang"${urlhost:+ -u "$urlhost"}${emailhost:+ -e "$emailhost"} -q "$list" "$owner" "$(mkpw)"
- fi
- LISTNAME="$list_anycase" LISTDESC="$desc" SENDERS="$senders" LISTOWNER="$owner" LISTHOST="$emailhost" MODERATOR="$moderator" "$sharedir/mklist.pl" "$skeldir/$type.$lang.py" > "$list.py"
- config_list -i "$cfgdir/$list.py" "$list"
- config_list -o "$cfgdir/$list.py" "$list"
- }
- populatelist() {
- list=$(printf %s "$1" | tr '[:upper:]' '[:lower:]'); shift
- [ ! -s "$cfgdir/$list.members" ] || add_members -r "$cfgdir/$list.members" -w n -a n "$list"
- [ ! -s "$cfgdir/$list.members-digest" ] || add_members -d "$cfgdir/$list.members-digest" -w n -a n "$list"
- [ -z "$*" ] || localuserinfo --custom='%fullname% <%mailaddress%>' "$@" | add_members -r - -w n -a n "$list"
- list_members --fullnames --preserve --regular -o "$cfgdir/$list.members" "$list"
- list_members --fullnames --preserve --digest -o "$cfgdir/$list.members-digest" "$list"
- }
|