1 # arg 1: the new package version
4 # Check users fnord/fnordlog exists
6 getent group fnord > /dev/null || groupadd fnord
7 getent passwd fnord > /dev/null || useradd -c "Fnord web server" -g fnord -s /bin/false -d /home/fnord fnord
8 getent passwd fnordlog > /dev/null || useradd -c "Fnord web server logs" -g fnord -s /bin/false -d /var/log/fnord fnordlog
10 mkdir /home/fnord >/dev/null 2>&1
11 mkdir /home/fnord/default >/dev/null 2>&1
12 mkdir /home/fnord/rules >/dev/null 2>&1
13 mkdir /home/fnord/config >/dev/null 2>&1
15 touch /home/fnord/rules/0
16 chmod 400 /home/fnord/rules/0
18 [ -f /home/fnord/default/index.html ] || echo "<H1>Your Fnord Works</H1>" > \
19 /home/fnord/default/index.html
20 chmod 644 /home/fnord/default/index.html
22 echo "0.0.0.0" > /home/fnord/config/bind
23 echo "fnord-idx" > /home/fnord/config/program
24 echo "8000" > /home/fnord/config/port
25 echo "3000000" > /home/fnord/config/memory
26 echo "30" > /home/fnord/config/concurrency
28 chown root:fnord /home/fnord /home/fnord/{default,rules,config}
29 chmod 750 /home/fnord /home/fnord/{default,rules}
33 echo "==> To use fnord, link /etc/sv/fnord to /var/service"
34 echo "==> Then control it using runit's tools"
35 echo "==> To configure it, check /home/fnord/config/{bind,program,port,"
36 echo "==> memory,concurrency} (one file per option)"
38 If you can't get logs when you run it via runit, check that /var/log has o+x permission."
39 echo "==> By default it will start a trivial site in port 8000"
43 echo "==> Stopping fnord"
45 echo "==> Removing fnord from /var/service"
46 rm /var/service/fnord &>/dev/null
47 echo "==> Removing fnord user account"
48 usr/sbin/userdel fnord &>/dev/null
49 usr/sbin/groupdel fnordlog &>/dev/null