-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall.sh
More file actions
72 lines (61 loc) · 1.85 KB
/
install.sh
File metadata and controls
72 lines (61 loc) · 1.85 KB
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
#!/bin/sh
# careful, not really tested
# ... needs more testing
# Configuration
basedir=/var/www
target=usr/local/wicap-php
dest=${basedir}/${target}
rrdtool=/usr/local/bin/rrdtool
uid=$(/usr/bin/id -ur)
if [ ${uid} != 0 ]; then
echo "-> Error, you do not have root permissions"
exit 1
fi
echo "-> Compiling 'allow' daemon..."
( cd source
make clean all
) || exit 1
echo "-> Creating '$dest' structure"
mkdir -p ${dest}/{var,bin,htdocs} || exit 1
echo "-> Copying files to '$dest'"
cp source/allow ${dest}/bin
cp source/allow.rc ${dest}/bin
cp source/rotate_something.sh ${dest}/bin
cp source/rotate.cron ${dest}/bin
cp source/htdocs/*.php ${dest}/htdocs
cp source/htdocs/*.jpg ${dest}/htdocs
echo "-> Setting permissions to '$dest'"
chown -R www ${dest}/var
chmod 700 ${dest}/bin/*
#echo "-> Do you want me to create a Round-Robin-Database (RRD)"
#echo -n "-> for stats? (rrdtool must be installed) (y or n)? "
#read yn
#if [ $yn != "y" ];then
# echo "Okay, I didn't do it"
#else
# echo "Making RRD..."
# ./mkrrd.sh $rrdtool $dest/var/stats.rrd
#fi
( cd $dest/htdocs
echo "-> Linking..."
echo " $dest/htdocs/wicap.php -> $dest/htdocs/index.php"
ln -sf wicap.php index.php
echo "-> Linking..."
echo " $dest -> /$target"
ln -sf $dest /$target
) || exit 1
echo "-> Installing..."
echo " source/conf/httpd-minimal.conf as ${basedir}/conf/httpd.conf"
if [ -f ${basedir}/conf/httpd.conf ]; then
osha256=$(/bin/sha256 -q ${basedir}/conf/httpd.conf)
nsha256=$(/bin/sha256 -q source/conf/httpd-minimal.conf)
if [ "${osha256}" != "${nsha256}" ]; then
echo "-> Error, ${basedir}/conf/httpd.conf differs from"
echo " source/conf/httpd-minimal.conf"
echo " Make a backup of ${basedir}/conf/httpd.conf, delete it"
echo " and execute once again this shell script"
exit 1
fi
fi
cat source/conf/httpd-minimal.conf > ${basedir}/conf/httpd.conf
echo "-> Done"