-
Notifications
You must be signed in to change notification settings - Fork 45
/
Copy pathsetup-imgcomp-root
executable file
·37 lines (29 loc) · 1.03 KB
/
setup-imgcomp-root
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
#! /bin/bash
# Parts of setup that must be run as root.
if [ "$EUID" -ne 0 ]
then echo "Please run this script as root"
exit
fi
# setup ramdisk (this is where we aquire images into before analyzing them, to avoid flash wear)
if [ -d /ramdisk ]; then
echo " ramdisk mount point already exists"
else
echo "making /ramdisk mount point"
sudo mkdir /ramdisk
fi
if grep -q "/ramdisk" /etc/fstab; then
echo " fstab already contains entry for ramdisk"
else
echo "Adding ramdisk entry to fstab"
echo "tmpfs /ramdisk tmpfs nodev,nosuid,size=20M 0 0" >> /etc/fstab
mount /ramdisk
fi
# configure apache2
web_root=$(dirname "$(dirname "$(pwd)")")/www
echo "copying modified apache2 configuration file, using '$web_root' as web root"
sed "s|/home/pi/www|$web_root|g" "000-default.conf" > /etc/apache2/sites-available/000-default.conf
echo "enabling CGI"
ln -s -f ../mods-available/cgi.load /etc/apache2/mods-enabled/cgi.load
# Restart apache2 to take new configuration
echo "Restarting apache2"
service apache2 restart