2015-04-09 17:40:03 -06:00
|
|
|
#! /bin/sh
|
|
|
|
|
2015-04-10 16:37:21 -06:00
|
|
|
DESTDIR=$1
|
|
|
|
|
|
|
|
if [ -z "$DESTDIR" ]; then
|
|
|
|
echo "Usage: $0 DESTDIR"
|
|
|
|
exit
|
|
|
|
fi
|
2015-04-09 17:40:03 -06:00
|
|
|
|
|
|
|
cd $(dirname $0)
|
|
|
|
|
|
|
|
older () {
|
|
|
|
[ -z "$1" ] && return 1
|
|
|
|
target=$1; shift
|
|
|
|
[ -f $target ] || return 0
|
|
|
|
for i in "$@"; do
|
|
|
|
[ $i -nt $target ] && return 0
|
|
|
|
done
|
|
|
|
return 1
|
|
|
|
}
|
|
|
|
|
|
|
|
copy () {
|
|
|
|
target=$DESTDIR/$1
|
|
|
|
if older $target $1; then
|
|
|
|
echo "COPY $1"
|
|
|
|
mkdir -p $(dirname $target)
|
|
|
|
cp $1 $target
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2015-04-10 16:37:21 -06:00
|
|
|
setup() {
|
2015-04-12 09:16:48 -06:00
|
|
|
[ -d $DESTDIR/state ] && return
|
2015-04-10 16:37:21 -06:00
|
|
|
echo "SETUP"
|
|
|
|
for i in points.new points.tmp teams; do
|
|
|
|
dir=$DESTDIR/state/$i
|
|
|
|
mkdir -p $dir
|
|
|
|
setfacl -m ${www}:rwx $dir
|
|
|
|
done
|
2015-04-12 11:11:15 -06:00
|
|
|
mkdir -p $DESTDIR/packages
|
2015-04-10 16:37:21 -06:00
|
|
|
>> $DESTDIR/state/points.log
|
|
|
|
if ! [ -f $DESTDIR/assigned.txt ]; then
|
2015-04-12 09:16:48 -06:00
|
|
|
hd </dev/urandom | awk '{print $3 $4 $5 $6;}' | head -n 100 > $DESTDIR/assigned.txt
|
2015-04-10 16:37:21 -06:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
echo "Figuring out web user..."
|
2015-05-28 14:15:05 -06:00
|
|
|
for www in www-data http tc _ _www; do
|
2015-04-10 16:37:21 -06:00
|
|
|
id $www && break
|
|
|
|
done
|
|
|
|
if [ $www = _ ]; then
|
|
|
|
echo "Unable to determine httpd user on this system. Dying."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
mkdir -p $DESTDIR || exit 1
|
|
|
|
|
2015-04-12 09:16:48 -06:00
|
|
|
setup
|
2015-04-09 17:40:03 -06:00
|
|
|
git ls-files | while read fn; do
|
|
|
|
case "$fn" in
|
|
|
|
install|.*)
|
|
|
|
;;
|
|
|
|
doc/*)
|
|
|
|
;;
|
2015-04-20 10:11:38 -06:00
|
|
|
www/*)
|
|
|
|
copy $fn
|
2015-04-09 17:40:03 -06:00
|
|
|
;;
|
|
|
|
bin/*)
|
|
|
|
copy $fn
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "??? $fn"
|
|
|
|
;;
|
|
|
|
esac
|
2015-05-26 10:14:30 -06:00
|
|
|
done
|