moth/packages/mcp/service/pointsd/run

45 lines
927 B
Plaintext
Raw Normal View History

#! /bin/sh -e
exec 2>&1
install -d /var/lib/ctf
2011-10-13 22:12:53 -06:00
# Create CTF and nobody users
touch /etc/group /etc/passwd
2011-10-13 22:12:53 -06:00
addgroup -g 65534 nogroup || true
adduser -D -S -h /var/lib/ctf -H ctf || true
2011-10-13 22:12:53 -06:00
adduser -D -g nogroup -u 65534 -h /tmp -H nobody || true
2011-10-13 21:15:11 -06:00
# Set up base directories
NEWDIR=/var/lib/ctf/points.new
install -d /var/www
2011-10-13 21:15:11 -06:00
install -d /var/lib/ctf
install -o ctf -m 0755 -d $NEWDIR
install -o ctf -m 0755 -d /var/lib/ctf/points.tmp
2011-10-13 21:15:11 -06:00
# Create some files
CLAIM=/var/lib/ctf/claim.db
touch $CLAIM
chown ctf $CLAIM
2010-10-22 09:36:28 -06:00
touch /var/lib/ctf/points.log
# Generate preliminary scoreboard
if ! [ -f /var/www/scoreboard.html ]; then
/opt/mcp/bin/scoreboard < /dev/null > /var/www/scoreboard.html
fi
if [ -x /sbin/inotifyd ]; then
exec /sbin/inotifyd ./pointsd $NEWDIR:y
fi
2010-10-29 00:07:03 -06:00
# Simulate inotifyd
cd $NEWDIR
while true; do
for fn in *; do
[ -f "$fn" ] || continue
./pointsd m $NEWDIR $fn
done
sleep 7
done