summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormailman1998-02-22 17:12:01 +0000
committermailman1998-02-22 17:12:01 +0000
commita02c98d541851a5a63ca079970590b253e61d9ae (patch)
tree48cc80b9266300792ea2352a0e9885b3bc135588
parent1b931f9d88930031ee7de285f5d58f6ea339fab0 (diff)
downloadmailman-a02c98d541851a5a63ca079970590b253e61d9ae.tar.gz
mailman-a02c98d541851a5a63ca079970590b253e61d9ae.tar.zst
mailman-a02c98d541851a5a63ca079970590b253e61d9ae.zip
Do not blithely delete the categorical directories if the users fails
to give a list argument!!! Complain and bailout if no listname is found. (Otherwise, when invoked without arguments, the script was deleting the lists, templates, and archives directories *completely*.) Additionally, do not delete the archives for a list unless the '-a' option is passed. I figure its more often worth keeping the archives around, even if the list is retired. Additionally, indicate whether or not the subject directory is actually there before deleting - some feedback, so users see whether what they expect is happening...
-rwxr-xr-xbin/rmlist37
1 files changed, 29 insertions, 8 deletions
diff --git a/bin/rmlist b/bin/rmlist
index 59f0bb140..a965b5153 100755
--- a/bin/rmlist
+++ b/bin/rmlist
@@ -7,12 +7,33 @@
MAILMAN_DIR='/home/mailman/mailman'
HTML_DIR='/home/mailman/public_html'
-echo "Removing list info."
-rm -rf ${MAILMAN_DIR}/lists/$1
-echo "Removing web pages."
-rm -rf ${MAILMAN_DIR}/templates/$1
-echo "Removing archives."
-rm -rf ${HTML_DIR}/archives/$1
-echo "Removing lock file."
-rm -rf ${MAILMAN_DIR}/locks/$1.lock
+removeArchives=""
+if [ "$1" = "-a" ]; then
+ shift
+ removeArchives=1
+fi
+if [ -z "$1" ]; then
+ echo "Usage: $0 [ -a ] list-name"
+ exit 1
+else
+ listname="$1"
+fi
+
+rmit () {
+ if [ -d "$2" ]; then
+ echo Removing "$1"
+ rm -rf "$2"
+ else
+ echo "$listname $1 not found"
+ fi
+}
+
+rmit "list info" "${MAILMAN_DIR}/lists/$listname"
+rmit "web pages" "${MAILMAN_DIR}/templates/$listname"
+if [ -n "$removeArchives" ]; then
+ rmit "archives" "${HTML_DIR}/archives/$listname"
+else
+ echo "Not removing archives - reinvoke with '-a' option to remove them."
+fi
+rmit "lock file" "${MAILMAN_DIR}/locks/$listname.lock"