chiark / gitweb /
superseded by moreutils
[bin.git] / deblist-action
1 #! /bin/sh
2 set -e
3
4 if ([ "$1" != subscribe ] && [ "$1" != unsubscribe ]) || \
5         [ -z "$2" ] || [ -z "$3" ]; then
6     echo "Usage: $0 subscribe|unsubscribe list address" 2>&1
7     exit 1
8 fi
9
10 ACTION="$1"
11 LIST="${2%%@*}"
12 ADDRESS="$3"
13
14 DRAFT=`tempfile`
15 trap 'rm -f "$DRAFT"' EXIT ERR HUP INT QUIT TERM
16
17 cat >"$DRAFT" <<EOF
18 From: Colin Watson <$ADDRESS>
19 To: $LIST-request@lists.debian.org
20 Subject: $ACTION $ADDRESS
21 Fcc: =debian/lists
22
23 $ACTION $ADDRESS
24 EOF
25
26 mutt -H "$DRAFT"
27
28 exit 0