2015-04-10 16:37:21 -06:00
|
|
|
#! /bin/sh
|
|
|
|
|
|
|
|
newdir=$1
|
|
|
|
if [ -z "$newdir" ]; then
|
|
|
|
echo "Usage: $0 NEWDIR"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2016-02-16 09:25:45 -07:00
|
|
|
MOTH_BASE=$(cd $(dirname $0)/.. && pwd)
|
2015-04-10 16:37:21 -06:00
|
|
|
|
|
|
|
echo "Figuring out web user..."
|
|
|
|
for www in www-data http _; do
|
|
|
|
id $www && break
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ $www = _ ]; then
|
|
|
|
echo "Unable to determine httpd user on this system. Dying."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
mkdir -p $newdir
|
|
|
|
cd $newdir
|
|
|
|
|
|
|
|
for i in points.new points.tmp teams; do
|
|
|
|
mkdir -p state/$i
|
|
|
|
setfacl -m ${www}:rwx state/$i
|
|
|
|
done
|
|
|
|
|
|
|
|
>> state/points.log
|
|
|
|
|
|
|
|
if ! [ -f assigned.txt ]; then
|
|
|
|
hd < /dev/urandom | awk '{print $3 $4 $5 $6;}' | head -n 100 > assigned.txt
|
|
|
|
fi
|
|
|
|
|
|
|
|
mkdir -p www
|
2016-02-16 09:25:45 -07:00
|
|
|
cp -r $MOTH_BASE/html/* www/
|
|
|
|
cp $MOTH_BASE/bin/*.cgi www/
|