2012-06-09 16:11:23 -06:00
|
|
|
#! /bin/sh -e
|
|
|
|
|
|
|
|
exec 2>&1
|
|
|
|
|
2012-06-12 18:25:32 -06:00
|
|
|
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.
|