Mercurial > hg > mlmmj
comparison src/mlmmj-make-ml.in @ 749:fdc57c9e5f56
Remove .sh from mlmmj-make-ml.sh; symlink original name
author | Ben Schmidt |
---|---|
date | Sun, 03 Oct 2010 22:12:33 +1100 |
parents | src/mlmmj-make-ml.sh.in@dfc9ab125fd4 |
children | 3c4d1e8bc452 |
comparison
equal
deleted
inserted
replaced
748:dfc9ab125fd4 | 749:fdc57c9e5f56 |
---|---|
1 #!/bin/sh | |
2 # | |
3 # mlmmj-make-ml - henne@hennevogel.de | |
4 # | |
5 | |
6 VERSION="0.1" | |
7 DEFAULTDIR="/var/spool/mlmmj" | |
8 ALIASFILE=/etc/aliases | |
9 | |
10 USAGE="mlmmj-make-ml "$VERSION" | |
11 "$0" [OPTIONS] | |
12 | |
13 -h display this help text | |
14 -L the name of the mailinglist | |
15 -s your spool directory if not "$DEFAULTDIR" | |
16 -a create the needed entrys in your $ALIASFILE file | |
17 -z nuffn for now | |
18 -c chown the spool dir" | |
19 | |
20 while getopts ":hL:s:azc:" Option | |
21 do | |
22 case "$Option" in | |
23 h ) | |
24 echo -e "$USAGE" | |
25 exit 0 | |
26 ;; | |
27 z ) | |
28 echo -n "nothing" | |
29 exit 0 | |
30 ;; | |
31 L ) | |
32 LISTNAME="$OPTARG" | |
33 ;; | |
34 s ) | |
35 SPOOLDIR="$OPTARG" | |
36 ;; | |
37 a ) | |
38 A_CREATE="YES" | |
39 ;; | |
40 c ) | |
41 DO_CHOWN=1 | |
42 CHOWN="$OPTARG" | |
43 ;; | |
44 * ) | |
45 echo -e "$0: invalid option\nTry $0 -h for more information." | |
46 exit 1 | |
47 esac | |
48 done | |
49 SHIFTVAL=$((OPTIND-1)) | |
50 shift $SHIFTVAL | |
51 | |
52 if [ -z "$SPOOLDIR" ]; then | |
53 SPOOLDIR="$DEFAULTDIR" | |
54 fi | |
55 | |
56 echo "Creating Directorys below $SPOOLDIR. Use '-s spooldir' to change" | |
57 | |
58 if [ -z "$LISTNAME" ]; then | |
59 echo -n "What should the name of the Mailinglist be? [mlmmj-test] : " | |
60 read LISTNAME | |
61 if [ -z "$LISTNAME" ]; then | |
62 LISTNAME="mlmmj-test" | |
63 fi | |
64 fi | |
65 | |
66 LISTDIR="$SPOOLDIR/$LISTNAME" | |
67 | |
68 mkdir -p $LISTDIR | |
69 | |
70 for DIR in incoming queue queue/discarded archive text subconf unsubconf \ | |
71 bounce control moderation subscribers.d digesters.d requeue \ | |
72 nomailsubs.d | |
73 do | |
74 mkdir "$LISTDIR"/"$DIR" | |
75 done | |
76 | |
77 test -f "$LISTDIR"/index || touch "$LISTDIR"/index | |
78 | |
79 echo -n "The Domain for the List? [] : " | |
80 read FQDN | |
81 if [ -z "$FQDN" ]; then | |
82 FQDN=`domainname -f` | |
83 fi | |
84 | |
85 echo -n "The emailaddress of the list owner? [postmaster] : " | |
86 read OWNER | |
87 if [ -z "$OWNER" ]; then | |
88 OWNER="postmaster" | |
89 fi | |
90 echo "$OWNER" > "$LISTDIR"/"control/owner" | |
91 | |
92 ( | |
93 cd "@textlibdir@" | |
94 echo | |
95 echo "For the list texts you can choose between the following languages or" | |
96 echo "give a absolute path to a directory containing the texts." | |
97 echo | |
98 echo "Available languages:" | |
99 ls | |
100 | |
101 TEXTPATHDEF=en | |
102 echo -n "The path to texts for the list? [$TEXTPATHDEF] : " | |
103 read TEXTPATHIN | |
104 if [ -z "$TEXTPATHIN" ] ; then | |
105 TEXTPATH="$TEXTPATHDEF" | |
106 else | |
107 TEXTPATH="$TEXTPATHIN" | |
108 fi | |
109 if [ ! -d "$TEXTPATH" ]; then | |
110 echo | |
111 echo "**NOTE** Could not copy the texts for the list" | |
112 echo "Please manually copy the files from the listtexts/ directory" | |
113 echo "in the source distribution of mlmmj." | |
114 sleep 2 | |
115 else | |
116 cp "$TEXTPATH"/* "$LISTDIR"/"text" | |
117 fi | |
118 ) | |
119 | |
120 LISTADDRESS="$LISTNAME@$FQDN" | |
121 echo "$LISTADDRESS" > "$LISTDIR"/control/"listaddress" | |
122 | |
123 MLMMJRECEIVE=`which mlmmj-receive 2>/dev/null` | |
124 if [ -z "$MLMMJRECEIVE" ]; then | |
125 MLMMJRECEIVE="/path/to/mlmmj-receive" | |
126 fi | |
127 | |
128 MLMMJMAINTD=`which mlmmj-maintd 2>/dev/null` | |
129 if [ -z "$MLMMJMAINTD" ]; then | |
130 MLMMJMAINTD="/path/to/mlmmj-maintd" | |
131 fi | |
132 | |
133 ALIAS="$LISTNAME: \"|$MLMMJRECEIVE -L $SPOOLDIR/$LISTNAME/\"" | |
134 CRONENTRY="0 */2 * * * \"$MLMMJMAINTD -F -L $SPOOLDIR/$LISTNAME/\"" | |
135 | |
136 if [ -n "$A_CREATE" ]; then | |
137 echo "I want to add the following to your $ALIASFILE file:" | |
138 echo "$ALIAS" | |
139 | |
140 echo -n "is this ok? [y/N] : " | |
141 read OKIDOKI | |
142 case $OKIDOKI in | |
143 y|Y) | |
144 echo "$ALIAS" >> $ALIASFILE | |
145 ;; | |
146 n|N) | |
147 exit 0 | |
148 ;; | |
149 *) | |
150 echo "Options was: y, Y, n or N" | |
151 esac | |
152 else | |
153 echo | |
154 echo "Don't forget to add this to $ALIASFILE:" | |
155 echo "$ALIAS" | |
156 fi | |
157 | |
158 if [ "$DO_CHOWN" ] ; then | |
159 echo | |
160 echo -n "chown -R $CHOWN $SPOOLDIR/$LISTNAME? [y/n]: " | |
161 read OKIDOKI | |
162 case $OKIDOKI in | |
163 y|Y) | |
164 chown -R $CHOWN $SPOOLDIR/$LISTNAME | |
165 ;; | |
166 n|N) | |
167 exit 0 | |
168 ;; | |
169 *) | |
170 echo "option is: y, Y, n, N" | |
171 ;; | |
172 esac | |
173 fi | |
174 | |
175 echo | |
176 echo "If you're not starting mlmmj-maintd in daemon mode," | |
177 echo "don't forget to add this to your crontab:" | |
178 echo "$CRONENTRY" | |
179 | |
180 echo | |
181 echo " ** FINAL NOTES ** | |
182 1) The mailinglist directory have to be owned by the user running the | |
183 mailserver (i.e. starting the binaries to work the list) | |
184 2) Run newaliases" |