mirror of https://github.com/dirtbags/moth.git
38 lines
640 B
Bash
Executable File
38 lines
640 B
Bash
Executable File
#! /bin/sh
|
|
|
|
newdir=$1
|
|
if [ -z "$newdir" ]; then
|
|
echo "Usage: $0 NEWDIR"
|
|
exit 1
|
|
fi
|
|
|
|
MOTH_BASE=$(cd $(dirname $0)/.. && pwd)
|
|
|
|
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
|
|
cp -r $MOTH_BASE/html/* www/
|
|
cp $MOTH_BASE/bin/*.cgi www/
|