#! /bin/sh DESTDIR=$1 if [ -z "$DESTDIR" ]; then echo "Usage: $0 DESTDIR" exit fi 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 } setup() { [ -d $DESTDIR/state ] && return echo "SETUP" for i in points.new points.tmp teams; do dir=$DESTDIR/state/$i mkdir -p $dir setfacl -m ${www}:rwx $dir done mkdir -p $DESTDIR/packages >> $DESTDIR/state/points.log if ! [ -f $DESTDIR/assigned.txt ]; then hd $DESTDIR/assigned.txt fi } echo "Figuring out web user..." for www in www-data http tc _ _www; do 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 setup git ls-files | while read fn; do case "$fn" in install|.*) ;; doc/*) ;; www/*) copy $fn ;; bin/*) copy $fn ;; *) echo "??? $fn" ;; esac done ln -s $DESTDIR/www/images $DESTDIR/www/cgi-bin/ ln -s $DESTDIR/www/style.css $DESTDIR/www/cgi-bin/