summarylogtreecommitdiffstats
path: root/mlmmj-1.3.0-bash.diff
blob: 5276ce4374f7932f218e675c79d640bfa27a3727 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
diff --git a/src/mlmmj-make-ml.in b/src/mlmmj-make-ml.in
index a6e10a3..e4ee4c6 100755
--- a/src/mlmmj-make-ml.in
+++ b/src/mlmmj-make-ml.in
@@ -1,9 +1,9 @@
-#!/bin/sh
+#!/usr/bin/bash
 #
 # mlmmj-make-ml - henne@hennevogel.de
 #
 
-VERSION="0.1"
+VERSION="0.1-bash"
 DEFAULTDIR="/var/spool/mlmmj"
 ALIASFILE=/etc/aliases
 
@@ -20,7 +20,7 @@ $0
 
 while getopts ":hL:s:azc:" Option
 do
-case "$Option" in 
+case "$Option" in
 	h )
 	echo "$USAGE"
 	exit 0
@@ -59,7 +59,7 @@ echo "Creating Directorys below $SPOOLDIR. Use '-s spooldir' to change"
 
 if [ -z "$LISTNAME" ]; then
 	echo -n "What should the name of the Mailinglist be? [mlmmj-test] : "
-	read LISTNAME
+	read -r LISTNAME
 	if [ -z "$LISTNAME" ]; then
 	LISTNAME="mlmmj-test"
 	fi
@@ -67,32 +67,32 @@ fi
 
 LISTDIR="$SPOOLDIR/$LISTNAME"
 
-mkdir -p $LISTDIR
+mkdir -p "$LISTDIR"
 
 for DIR in incoming queue queue/discarded archive text subconf unsubconf \
 	   bounce control moderation subscribers.d digesters.d requeue \
 	   nomailsubs.d
 do
-	mkdir "$LISTDIR"/"$DIR"
+	mkdir "$LISTDIR/$DIR"
 done
 
 test -f "$LISTDIR"/index || touch "$LISTDIR"/index
 
 echo -n "The Domain for the List? [] : "
-read FQDN
+read -r FQDN
 if [ -z "$FQDN" ]; then
-	FQDN=`domainname -f`
+	FQDN=$(domainname -f)
 fi
 
 echo -n "The emailaddress of the list owner? [postmaster] : "
-read OWNER
+read -r OWNER
 if [ -z "$OWNER" ]; then
 	OWNER="postmaster"
 fi
-echo "$OWNER" > "$LISTDIR"/"control/owner"
+echo "$OWNER" > "$LISTDIR/control/owner"
 
 (
-	cd "@textlibdir@"
+	cd "@textlibdir@" || exit 1
 	echo
 	echo "For the list texts you can choose between the following languages or"
 	echo "give a absolute path to a directory containing the texts."
@@ -102,7 +102,7 @@ echo "$OWNER" > "$LISTDIR"/"control/owner"
 
 	TEXTPATHDEF=en
 	echo -n "The path to texts for the list? [$TEXTPATHDEF] : "
-	read TEXTPATHIN
+	read -r TEXTPATHIN
 	if [ -z "$TEXTPATHIN" ] ; then
 		TEXTPATH="$TEXTPATHDEF"
 	else
@@ -115,35 +115,35 @@ echo "$OWNER" > "$LISTDIR"/"control/owner"
 		echo "in the source distribution of mlmmj."
 		sleep 2
 	else
-		cp "$TEXTPATH"/* "$LISTDIR"/"text"
+		cp "$TEXTPATH"/* "$LISTDIR/text"
 	fi
 )
 
 LISTADDRESS="$LISTNAME@$FQDN"
-echo "$LISTADDRESS" > "$LISTDIR"/control/"listaddress"
+echo "$LISTADDRESS" > "$LISTDIR/control/listaddress"
 
-MLMMJRECEIVE=`which mlmmj-receive 2>/dev/null`
+MLMMJRECEIVE=$(which mlmmj-receive 2>/dev/null)
 if [ -z "$MLMMJRECEIVE" ]; then
 	MLMMJRECEIVE="/path/to/mlmmj-receive"
 fi
 
-MLMMJMAINTD=`which mlmmj-maintd 2>/dev/null`
+MLMMJMAINTD=$(which mlmmj-maintd 2>/dev/null)
 if [ -z "$MLMMJMAINTD" ]; then
 	MLMMJMAINTD="/path/to/mlmmj-maintd"
 fi
 
 ALIAS="$LISTNAME:  \"|$MLMMJRECEIVE -L $SPOOLDIR/$LISTNAME/\""
-CRONENTRY="0 */2 * * * \"$MLMMJMAINTD -F -L $SPOOLDIR/$LISTNAME/\""
+CRONENTRY="0 */2 * * * $MLMMJMAINTD -F -L $SPOOLDIR/$LISTNAME/"
 
 if [ -n "$A_CREATE" ]; then
 	echo "I want to add the following to your $ALIASFILE file:"
 	echo "$ALIAS"
 
 	echo -n "is this ok? [y/N] : "
-	read OKIDOKI
-	case $OKIDOKI in
+	read -r OKIDOKI
+	case "$OKIDOKI" in
 		y|Y)
-		echo "$ALIAS" >> $ALIASFILE
+		echo "$ALIAS" >> "$ALIASFILE"
 		;;
 		n|N)
 		exit 0
@@ -160,10 +160,10 @@ fi
 if [ "$DO_CHOWN" ] ; then
 	echo
 	echo -n "chown -R $CHOWN $SPOOLDIR/$LISTNAME? [y/n]: "
-	read OKIDOKI
-	case $OKIDOKI in
+	read -r OKIDOKI
+	case "$OKIDOKI" in
 		y|Y)
-			chown -R $CHOWN $SPOOLDIR/$LISTNAME
+			chown -R "$CHOWN" "$SPOOLDIR/$LISTNAME"
 		;;
 		n|N)
 			exit 0
@@ -181,6 +181,6 @@ echo "$CRONENTRY"
 
 echo
 echo " ** FINAL NOTES **
-1) The mailinglist directory have to be owned by the user running the 
+1) The mailinglist directory have to be owned by the user running the
 mailserver (i.e. starting the binaries to work the list)
 2) Run newaliases"