f71cf95614a7c4b73778c9cfc2ade40d73cb19c9
[mmondor.git] / mmsoftware / install.sh
1 #!/bin/sh
2 # $Id: install.sh,v 1.8 2003/07/02 17:20:52 mmondor Exp $
3
4 if [ "$1" = "help" ]; then
5 echo
6 echo 'You can optionally set the following environment variables'
7 echo 'to customize the installation process. For each is shown an'
8 echo 'example using the default value followed by a breif description.'
9 echo
10 echo 'export MMLAUNCH="TRUE"'
11 echo ' Tells the install process to immediately launch the daemon(s)'
12 echo ' They are automatically killed before the binaries are copied'
13 echo ' over the old ones as is necessary with some systems. The'
14 echo ' default is to not start them back automatically.'
15 echo
16 echo 'export MMPREFIX="/usr/local"'
17 echo ' Allows to set the installation base directory. All files but'
18 echo ' configuration ones will be installed in directories relative'
19 echo ' to this one.'
20 echo
21 echo 'export MMCONFDIR="/etc"'
22 echo ' Directory in which configuration files should be stored.'
23 echo
24 echo 'export MMDEFAULTUSER="0"'
25 echo ' User new files and directories should be owned by, using'
26 echo ' user id or name.'
27 echo
28 echo 'export MMDEFAULTGROUP="0"'
29 echo ' Group new files and directories should be under, using id'
30 echo ' or name.'
31 echo
32 echo 'export MMADMINGROUP="staff"'
33 echo ' The administrators group, these can for instance view and the'
34 echo ' rotate mmstat statistics and execute mmpasswd. Will be'
35 echo ' created automatically if necessary.'
36 echo
37 echo 'export MMSTATDIR="/var/mmstatd"'
38 echo ' The directory in which mmstatd will store the stats database'
39 echo ' and log files.'
40 echo
41 echo 'export MMSTATDUSER="mmstatd"'
42 echo ' The user mmstatd will run under, to be automatically created.'
43 echo
44 echo 'export MMSTATDGROUP="mmstat"'
45 echo ' Group the mmstatd user should be part of, automatically'
46 echo ' created.'
47 echo
48 echo 'export MMFTPDUSER="mmftpd"'
49 echo ' The user mmftpd will run under, to be automatically created.'
50 echo
51 echo 'export MMFTPDGROUP="mmftpd"'
52 echo ' Group the mmftpd user should be part of, automatically'
53 echo ' created. The mmftpdpasswd configuration file will be readable'
54 echo ' by this group.'
55 echo
56 echo 'export MMMAILUSER="mmmail"'
57 echo ' The user mmmail daemons should run under, will be created'
58 echo ' automatically if nonexisting.'
59 echo
60 echo 'export MMMAILGROUP="mmmail"'
61 echo ' Group the mmmail user should be part of. Created if needed.'
62 echo
63 exit
64 fi
65
66 # Set defaults if not set
67 if [ -z "$MMLAUNCH" ]; then
68 export MMLAUNCH='FALSE'
69 fi
70 if [ -z "$MMPREFIX" ]; then
71 export MMPREFIX='/usr/local'
72 fi
73 if [ -z "$MMCONFDIR" ]; then
74 export MMCONFDIR='/etc'
75 fi
76 if [ -z "$MMDEFAULTUSER" ]; then
77 export MMDEFAULTUSER='0'
78 fi
79 if [ -z "$MMDEFAULTGROUP" ]; then
80 export MMDEFAULTGROUP='0'
81 fi
82 if [ -z "$MMADMINGROUP" ]; then
83 export MMADMINGROUP='staff'
84 fi
85 if [ -z "$MMSTATDIR" ]; then
86 export MMSTATDIR='/var/mmstatd'
87 fi
88 if [ -z "$MMSTATDUSER" ]; then
89 export MMSTATDUSER='mmstatd'
90 fi
91 if [ -z "$MMSTATDGROUP" ]; then
92 export MMSTATDGROUP='mmstat'
93 fi
94 if [ -z "$MMFTPDUSER" ]; then
95 export MMFTPDUSER='mmftpd'
96 fi
97 if [ -z "$MMFTPDGROUP" ]; then
98 export MMFTPDGROUP='mmftpd'
99 fi
100 if [ -z "$MMMAILUSER" ]; then
101 export MMMAILUSER='mmmail'
102 fi
103 if [ -z "$MMMAILGROUP" ]; then
104 export MMMAILGROUP='mmmail'
105 fi
106
107 . mmlib/makefuncs.sh
108
109 instgroup $MMADMINGROUP
110
111 cd mmlib/
112 instman mmfd.3 3
113 instman mmfifo.3 3
114 instman mmlifo.3 3
115 instman mmlist.3 3
116 instman mmpool.3 3
117 instman mmpath.3 3
118 instman mmstat.3 3
119 instman mmhash.3 3
120 cd ../
121 cd apache-mmstat/
122 instman apache-mmstat.8 8
123 cd ../
124
125 cd mmpasswd/
126 instbin mmpasswd 750 $MMADMINGROUP
127 instman mmpasswd.8 8
128 cd ../
129
130 cd mmstatd/src/
131 instuser $MMSTATDUSER $MMSTATDGROUP
132 killbin mmstatd
133 instbin mmstatd 700
134 instbin mmstat 750 $MMADMINGROUP
135 instman mmstat.8 8
136 instman mmstatd.8 8
137 instman mmstatd.conf.5 5
138 cd ../etc/
139 instconf mmstatd.conf 640 $MMSTATDGROUP
140 instdir $MMSTATDIR 750 $MMSTATDUSER $MMSTATDGROUP
141 if [ "$MMLAUNCH" = "TRUE" ]; then
142 startbin mmstatd $MMCONFDIR/mmstatd.conf
143 fi
144 cd ../../
145 cd apache-mmstat/
146 instbin apache-mmstat 700
147 cd ../
148
149 cd mmftpd/src/
150 instuser $MMFTPDUSER $MMFTPDGROUP
151 killbin mmftpd
152 instbin mmftpd 700
153 instman mmftpd.8 8
154 instman mmftpd.conf.5 5
155 instman mmftpdpasswd.5 5
156 cd ../etc/
157 instconf mmftpd.conf 600
158 instconf mmftpdpasswd 640 $MMFTPDGROUP
159 if [ "$MMLAUNCH" = "TRUE" ]; then
160 startbin mmftpd $MMCONFDIR/mmftpd.conf
161 fi
162 cd ../../
163
164 cd mmmail/src/mmsmtpd/
165 instuser $MMMAILUSER $MMMAILGROUP
166 killbin mmsmtpd
167 instbin mmsmtpd 700
168 instman mmsmtpd.8 8
169 instman mmsmtpd.conf.5 5
170 cd ../mmpop3d
171 killbin mmpop3d
172 instbin mmpop3d 700
173 instman mmpop3d.8 8
174 instman mmpop3d.conf.5 5
175 cd ../../etc
176 instconf mmsmtpd.conf 600
177 instconf mmpop3d.conf 600
178 if [ "$MMLAUNCH" = "TRUE" ]; then
179 startbin mmsmtpd $MMCONFDIR/mmsmtpd.conf
180 startbin mmpop3d $MMCONFDIR/mmpop3d.conf
181 fi
182 cd ../src
183 instman mmmail.8 8
184 cd ../../
185
186 echo
187 echo "*** Please read the following man pages ***"
188 echo
189 echo "all users: mmstat(8), mmstatd(8), mmstatd.conf(5), mmpasswd(8),"
190 echo " apache-mmstat(8)"
191 echo "mmftpd users: mmftpd(8), mmftpd.conf(5), mmftpdpasswd(5)"
192 echo "mmmail users: mmmail(8), mmsmtpd(8), mmsmtpd.conf(5), mmpop3d(8),"
193 echo " mmpop3d.conf(5)"
194 echo "source auditors: mmstat(3), mmfd(3), mmlist(3), mmpool(3), mmfifo(3),"
195 echo " mmlifo(3), mmpath(3), mmhash(3)"
196 echo
197 echo "Thank you for using mmsoftware."
198 echo