Modifications to use the new mmlimitrate(3) API
[mmondor.git] / mmsoftware / install.sh
1 #!/bin/sh
2 # $Id: install.sh,v 1.9 2003/10/23 01:01:15 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 instman mmlimitrate.3 3
121 cd ../
122 cd apache-mmstat/
123 instman apache-mmstat.8 8
124 cd ../
125
126 cd mmpasswd/
127 instbin mmpasswd 750 $MMADMINGROUP
128 instman mmpasswd.8 8
129 cd ../
130
131 cd mmstatd/src/
132 instuser $MMSTATDUSER $MMSTATDGROUP
133 killbin mmstatd
134 instbin mmstatd 700
135 instbin mmstat 750 $MMADMINGROUP
136 instman mmstat.8 8
137 instman mmstatd.8 8
138 instman mmstatd.conf.5 5
139 cd ../etc/
140 instconf mmstatd.conf 640 $MMSTATDGROUP
141 instdir $MMSTATDIR 750 $MMSTATDUSER $MMSTATDGROUP
142 if [ "$MMLAUNCH" = "TRUE" ]; then
143 startbin mmstatd $MMCONFDIR/mmstatd.conf
144 fi
145 cd ../../
146 cd apache-mmstat/
147 instbin apache-mmstat 700
148 cd ../
149
150 cd mmftpd/src/
151 instuser $MMFTPDUSER $MMFTPDGROUP
152 killbin mmftpd
153 instbin mmftpd 700
154 instman mmftpd.8 8
155 instman mmftpd.conf.5 5
156 instman mmftpdpasswd.5 5
157 cd ../etc/
158 instconf mmftpd.conf 600
159 instconf mmftpdpasswd 640 $MMFTPDGROUP
160 if [ "$MMLAUNCH" = "TRUE" ]; then
161 startbin mmftpd $MMCONFDIR/mmftpd.conf
162 fi
163 cd ../../
164
165 cd mmmail/src/mmsmtpd/
166 instuser $MMMAILUSER $MMMAILGROUP
167 killbin mmsmtpd
168 instbin mmsmtpd 700
169 instman mmsmtpd.8 8
170 instman mmsmtpd.conf.5 5
171 cd ../mmpop3d
172 killbin mmpop3d
173 instbin mmpop3d 700
174 instman mmpop3d.8 8
175 instman mmpop3d.conf.5 5
176 cd ../../etc
177 instconf mmsmtpd.conf 600
178 instconf mmpop3d.conf 600
179 if [ "$MMLAUNCH" = "TRUE" ]; then
180 startbin mmsmtpd $MMCONFDIR/mmsmtpd.conf
181 startbin mmpop3d $MMCONFDIR/mmpop3d.conf
182 fi
183 cd ../src
184 instman mmmail.8 8
185 cd ../../
186
187 echo
188 echo "*** Please read the following man pages ***"
189 echo
190 echo "all users: mmstat(8), mmstatd(8), mmstatd.conf(5), mmpasswd(8),"
191 echo " apache-mmstat(8)"
192 echo "mmftpd users: mmftpd(8), mmftpd.conf(5), mmftpdpasswd(5)"
193 echo "mmmail users: mmmail(8), mmsmtpd(8), mmsmtpd.conf(5), mmpop3d(8),"
194 echo " mmpop3d.conf(5)"
195 echo "source auditors: mmstat(3), mmfd(3), mmlist(3), mmpool(3), mmfifo(3),"
196 echo " mmlifo(3), mmpath(3), mmhash(3), mmlimitrate(3)"
197 echo
198 echo "Thank you for using mmsoftware."
199 echo