moth/packages/p2/service/httpd/run

32 lines
732 B
Plaintext
Raw Normal View History

2012-06-09 16:11:23 -06:00
#! /bin/sh -e
exec 2>&1
IP=$(dbip -p ../p2console/ip.txt)
2012-06-09 16:11:23 -06:00
2012-07-12 16:55:36 -06:00
ip route add default via 10.0.0.1
2012-07-22 17:14:06 -06:00
if [ -z "$CTF_BASE" ] && ! grep -q " /www " /proc/mounts; then
mount -t tmpfs www /www
fi
2012-06-09 16:11:23 -06:00
# Link in puzzles and web pages
2012-07-22 17:14:06 -06:00
for d in $CTF_BASE/packages/*; do
w=$CTF_BASE/www/$(basename $d)
2012-06-09 16:11:23 -06:00
if [ -d $d/puzzles ] && ! [ -d $w ]; then
ln -sf $d/puzzles $w
fi
if [ -d $d/www ]; then
2012-07-22 17:14:06 -06:00
ln -sf $d/www/* $CTF_BASE/www/
2012-06-09 16:11:23 -06:00
fi
done
2012-07-22 17:14:06 -06:00
# news.html is persistent
if ! [ -f $CTF_BASE/state/news.html ]; then
cat $CTF_BASE/packages/p2/www/news.html > $CTF_BASE/state/news.html
fi
ln -sf $CTF_BASE/state/news.html $CTF_BASE/www
cd $CTF_BASE/www
exec tcpsvd -u nobody ${IP%/*} 80 $CTF_BASE/packages/p2/bin/eris -c.