blob: 9b2bdefb319157083829837ab3fffff9e4e39412 (
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
|
#!/bin/sh
#
# Copyright (C) 2001 Ken'ichi Fukamachi
# All rights reserved. This program is free software; you can
# redistribute it and/or modify it under the same terms as Perl itself.
#
# $FML: INSTALL.sh,v 1.55 2002/08/28 15:07:52 fukachan Exp $
#
# Run this from the top-level fml source directory.
PATH=/bin:/usr/bin:/usr/sbin:/usr/etc:/sbin:/etc
umask 022
get_fml_version () {
if [ -f .version ];then
fml_version=`cat .version`
else
date=`date +%C%y%m%d`
fml_version=current-${date}
fi
}
_mkdir () {
local dir=$1
echo mkdiring $dir;
test -d $dir || mkdir -p $dir
}
### MAIN ###
# configurations generated by ./configure
. ./config.sh
# cheap diag: check the existence of $owner and $group
is_owner=1
is_group=1
id $owner >/dev/null || is_owner=0
if [ -f /etc/group ];then
egrep -e "^${group}:" /etc/group >/dev/null || is_group=0
fi
if [ $is_owner = 0 ];then
echo warning: no such user $owner
exit 1
fi
if [ $is_group = 0 ];then
echo warning: no such group $group
exit 1
fi
# init
get_fml_version
default_config_dir=$config_dir/defaults/$fml_version
# check whether $ml_spool_dir exists or not.
need_fix_ml_spool_dir=0
test -d $ml_spool_dir || need_fix_ml_spool_dir=1
for dir in $config_dir \
$config_dir/defaults \
$config_dir/defaults/$fml_version \
$lib_dir \
$lib_dir/$fml_version \
$libexec_dir \
$libexec_dir/$fml_version \
$data_dir/$fml_version \
$bindir \
$ml_spool_dir
do
test -d $dir || _mkdir $dir
done
if [ ! -f $config_dir/main.cf ];then
echo creating $config_dir/main.cf
sed -e s@__fml_version__@$fml_version@ \
-e s@__config_dir__@$config_dir@ \
fml/etc/main.cf > $config_dir/main.cf
fi
if [ ! -f $config_dir/site_default_config.cf ];then
echo creating $config_dir/site_default_config.cf
cp fml/etc/site_default_config.cf $config_dir/site_default_config.cf
fi
echo updating $default_config_dir/
cp fml/etc/default_config.cf.ja $default_config_dir/default_config.cf
cp fml/etc/config.cf.ja $default_config_dir/config.cf
for file in include include-ctl include-error aliases \
postfix_virtual \
dot_htaccess \
dot-qmail dot-qmail-admin dot-qmail-ctl dot-qmail-default \
dot-qmail-request \
procmailrc
do
cp fml/etc/$file $default_config_dir/$file
chmod 644 $default_config_dir/$file
done
cp -pr fml/etc/mtree $default_config_dir/
echo updating $lib_dir/$fml_version/
cp -pr fml/lib/* $lib_dir/$fml_version/
cp -pr cpan/lib/* $lib_dir/$fml_version/
cp -pr img/lib/* $lib_dir/$fml_version/
echo updating $libexec_dir/$fml_version/
cp -pr fml/libexec/* $libexec_dir/$fml_version/
echo updating $data_dir/$fml_version/
cp -pr fml/share/* $data_dir/$fml_version/
echo updating ${bindir}/
for prog in fmlalias fmldoc fmlthread fmlconf \
makefml fmlsch fmlhtmlify fmlspool
do
echo updating ${bindir}/$prog
cp fml/bin/$prog ${bindir}/$prog.new
chmod 755 ${bindir}/$prog.new
mv ${bindir}/$prog.new ${bindir}/$prog
done
PROGRAMS="fml.pl distribute command error mead";
PROGRAMS="$PROGRAMS fmlserv fmlconf fmldoc"
PROGRAMS="$PROGRAMS fmlthread fmlthread.cgi"
PROGRAMS="$PROGRAMS makefml makefml.cgi menu.cgi"
PROGRAMS="$PROGRAMS fmlsch fmlsch.cgi"
PROGRAMS="$PROGRAMS fmlhtmlify fmlalias"
PROGRAMS="$PROGRAMS fmlspool"
#
# check loader is upgraded or not
#
loader_replace=0
if [ -f $libexec_dir/loader ];then
cmp fml/libexec/loader $libexec_dir/loader > /dev/null
if [ $? != 0 ];then
echo "warn: loader updated."
echo -n " You must upgrade loader. Replace it ? [y/n]"; read answer;
if [ "X$answer" = "Xy" ];then
loader_replace=1
fi
fi
fi
#
# new program
#
for x in $PROGRAMS
do
if [ ! -x $libexec_dir/$x ];then
loader_replace=1
fi
done
#
# install loader
#
if [ ! -f $libexec_dir/loader -o $loader_replace = 1 ];then
echo install libexec/loader
cp -p fml/libexec/loader $libexec_dir/loader.new.$$
mv $libexec_dir/loader.new.$$ $libexec_dir/loader
(
cd $libexec_dir/
i=0
echo -n " link loader to: "
for x in $PROGRAMS
do
rm -f $x
ln -s loader $x && echo -n "$x "
i=`expr $i + 1`
if [ $i -ge 6 ];then
echo ""
echo -n " "
i=0
fi
done
echo ""
)
fi
iam=`id -un`
if [ "X$iam" != Xroot ];then
echo error: run $0 as root
exit 1
fi
id -un $owner 2>/dev/null || (
echo warning: user $owner is not defined
)
grep "^${group}:" /etc/group >/dev/null || (
echo warning: group $group is not defined
)
if [ $need_fix_ml_spool_dir = 1 ]; then
if [ -d $ml_spool_dir -a -w $ml_spool_dir ]; then
echo set up the owner of $ml_spool_dir to be $owner
chown -R $owner:$group $ml_spool_dir
fi
else
echo "info: $ml_spool_dir exists. We do not touch it.";
fi
exit 0
|