chiark / gitweb /
deblist-action: New script to subscribe to or unsubscribe from Debian
authorColin Watson <cjwatson@chiark.greenend.org.uk>
Fri, 25 Oct 2002 12:33:11 +0000 (12:33 +0000)
committerColin Watson <cjwatson@chiark.greenend.org.uk>
Fri, 25 Oct 2002 12:33:11 +0000 (12:33 +0000)
mailing lists.

deblist-action [new file with mode: 0755]

diff --git a/deblist-action b/deblist-action
new file mode 100755 (executable)
index 0000000..a07ca36
--- /dev/null
@@ -0,0 +1,28 @@
+#! /bin/sh
+set -e
+
+if ([ "$1" != subscribe ] && [ "$1" != unsubscribe ]) || \
+       [ -z "$2" ] || [ -z "$3" ]; then
+    echo "Usage: $0 subscribe|unsubscribe list address" 2>&1
+    exit 1
+fi
+
+ACTION="$1"
+LIST="${2%%@*}"
+ADDRESS="$3"
+
+DRAFT=`tempfile`
+trap 'rm -f "$DRAFT"' EXIT ERR HUP INT QUIT TERM
+
+cat >"$DRAFT" <<EOF
+From: Colin Watson <$ADDRESS>
+To: $LIST-request@lists.debian.org
+Subject: $ACTION $ADDRESS
+Fcc: =debian/lists
+
+$ACTION $ADDRESS
+EOF
+
+mutt -H "$DRAFT"
+
+exit 0