mirror of https://github.com/dirtbags/moth.git
QUOTES!!!!
This commit is contained in:
parent
84cf0d7b56
commit
d97bb76eab
55
install.sh
55
install.sh
|
@ -1,6 +1,6 @@
|
|||
#! /bin/sh -e
|
||||
|
||||
DESTDIR=$1
|
||||
DESTDIR="$1"
|
||||
|
||||
if [ -z "$DESTDIR" ]; then
|
||||
echo "Usage: $0 DESTDIR"
|
||||
|
@ -11,42 +11,43 @@ cd $(dirname $0)
|
|||
|
||||
older () {
|
||||
[ -z "$1" ] && return 1
|
||||
target=$1; shift
|
||||
[ -f $target ] || return 0
|
||||
target="$1"; shift
|
||||
[ -f "$target" ] || return 0
|
||||
for i in "$@"; do
|
||||
[ $i -nt $target ] && return 0
|
||||
[ "$i" -nt "$target" ] && return 0
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
copy () {
|
||||
src=$1
|
||||
target=$2/$src
|
||||
targetdir=$(dirname $target)
|
||||
if older $target $src; then
|
||||
src="$1"
|
||||
target="$2/$src"
|
||||
targetdir=$(dirname "$target")
|
||||
if older "$target" "$src"; then
|
||||
echo "COPY $src"
|
||||
mkdir -p $targetdir
|
||||
cp $src $target
|
||||
mkdir -p "$targetdir"
|
||||
cp "$src" "$target"
|
||||
fi
|
||||
}
|
||||
|
||||
setup() {
|
||||
[ -d $DESTDIR/state ] && return
|
||||
www="$1"
|
||||
[ -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
|
||||
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 </dev/urandom | awk '{print $3 $4 $5 $6;}' | head -n 100 > $DESTDIR/assigned.txt
|
||||
mkdir -p "$DESTDIR/packages"
|
||||
>> "$DESTDIR/state/points.log"
|
||||
if ! [ -f "$DESTDIR/assigned.txt" ]; then
|
||||
hd </dev/urandom | awk '{print $3 $4 $5 $6;}' | head -n 100 > "$DESTDIR/assigned.txt"
|
||||
fi
|
||||
|
||||
mkdir -p $DESTDIR/www
|
||||
ln -sf ../state/points.json $DESTDIR/www
|
||||
ln -sf ../state/puzzles.json $DESTDIR/www
|
||||
mkdir -p "$DESTDIR/www"
|
||||
ln -sf ../state/points.json "$DESTDIR/www"
|
||||
ln -sf ../state/puzzles.json "$DESTDIR/www"
|
||||
}
|
||||
|
||||
|
||||
|
@ -59,24 +60,24 @@ if [ $www = _ ]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
mkdir -p $DESTDIR || exit 1
|
||||
mkdir -p "$DESTDIR" || exit 1
|
||||
|
||||
setup
|
||||
setup $www
|
||||
git $SRCDIR ls-files | while read fn; do
|
||||
case "$fn" in
|
||||
case "$fn" in
|
||||
example-puzzles/*|tools/*|docs/*|install.sh|setup.cfg|README.md|.gitignore|src/mothd)
|
||||
true # skip
|
||||
;;
|
||||
www/*)
|
||||
copy $fn $DESTDIR/
|
||||
copy "$fn" "$DESTDIR/"
|
||||
;;
|
||||
bin/*)
|
||||
copy $fn $DESTDIR/
|
||||
copy "$fn" "$DESTDIR/"
|
||||
;;
|
||||
*)
|
||||
echo "??? $fn"
|
||||
;;
|
||||
esac
|
||||
esac
|
||||
done
|
||||
|
||||
echo "All done installing."
|
||||
|
|
Loading…
Reference in New Issue