mirror of https://github.com/dirtbags/moth.git
State of competition can now happen in the cloud
This commit is contained in:
parent
199a9d6ac1
commit
3075e0a055
|
@ -5,6 +5,8 @@ if [ $# -ne 1 ]; then
|
||||||
exit 64
|
exit 64
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
escape () {
|
escape () {
|
||||||
sed 's/&/\&/g;s/</\</g;s/>/\>/g'
|
sed 's/&/\&/g;s/</\</g;s/>/\>/g'
|
||||||
}
|
}
|
||||||
|
@ -15,6 +17,13 @@ set -C
|
||||||
base=${CTF_BASE:-/var/lib/ctf}
|
base=${CTF_BASE:-/var/lib/ctf}
|
||||||
www=${CTF_BASE:-/var/www}
|
www=${CTF_BASE:-/var/www}
|
||||||
|
|
||||||
|
if which backup-team >/dev/null 2>&1 ; then
|
||||||
|
if [ ! -e $base/pass ]; then
|
||||||
|
echo "\nYou should consider running backup-pass or new-contest."
|
||||||
|
echo "DBTL Altocumulus™ backup system will not work without it.\n"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
mkdir -p $base/teams/names
|
mkdir -p $base/teams/names
|
||||||
mkdir -p $base/teams/colors
|
mkdir -p $base/teams/colors
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
#! /bin/sh -e
|
||||||
|
|
||||||
|
base=${CTF_BASE:-/var/lib/ctf}
|
||||||
|
www=${CTF_BASE:-/var/www}
|
||||||
|
pass=$base/pass
|
||||||
|
img=$www/bkup.png
|
||||||
|
time=$(date +%s)
|
||||||
|
output=bkup-${time}.png
|
||||||
|
|
||||||
|
if [ ! -e $img -o ! -e $pass ]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# clean up all other backup images
|
||||||
|
if ls $www/bkup-*.png >/dev/null 2>&1 ; then
|
||||||
|
rm $www/bkup-*.png
|
||||||
|
fi
|
||||||
|
|
||||||
|
# This is a tested method.
|
||||||
|
#(cat $img; tar -cf - $base 2>/dev/null | gzip -c ) > $www/$output
|
||||||
|
|
||||||
|
# This is not a tested method.
|
||||||
|
(cat $img; tar -cvf - $base 2>/dev/null | gzip -c | rc4 3< $pass) > $www/$output
|
||||||
|
|
||||||
|
echo $output
|
|
@ -0,0 +1,38 @@
|
||||||
|
#! /bin/sh -e
|
||||||
|
|
||||||
|
trap "stty echo; echo ''; echo 'Passfile not written'; exit 42" 1 2 3 15
|
||||||
|
|
||||||
|
askpass () {
|
||||||
|
echo "Password: "
|
||||||
|
stty -echo
|
||||||
|
read pass1
|
||||||
|
echo "Retype password: "
|
||||||
|
read pass2
|
||||||
|
stty echo
|
||||||
|
if [ "${pass1}" = "${pass2}" ]; then
|
||||||
|
echo "Got it.\n"
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
echo "Authentication token manipulation error.\n"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
base=${CTF_BASE:-/var/lib/ctf}
|
||||||
|
passfile=$base/pass
|
||||||
|
|
||||||
|
if [ -e $passfile ]; then
|
||||||
|
echo "\nDanger! Danger!\n"
|
||||||
|
echo "Wipes out current passfile. It's ok as long as note the current"
|
||||||
|
echo "timestamp ($(date +%s)) and the new pass will be applied on the"
|
||||||
|
echo "next scoreboard update.\n"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Enter passphrase for backups"
|
||||||
|
echo "To exit, press ctrl+c"
|
||||||
|
until askpass; do true; done
|
||||||
|
|
||||||
|
echo -e "${pass1}" > $passfile
|
||||||
|
echo "Passfile written"
|
||||||
|
stty echo
|
||||||
|
|
|
@ -23,6 +23,8 @@ rm -rf /var/lib/ctf/points.tmp
|
||||||
rm -rf /var/lib/ctf/tanks
|
rm -rf /var/lib/ctf/tanks
|
||||||
rm -rf /var/lib/ctf/teams
|
rm -rf /var/lib/ctf/teams
|
||||||
|
|
||||||
|
backup-pass
|
||||||
|
|
||||||
sv u tokend
|
sv u tokend
|
||||||
sv u pointsd
|
sv u pointsd
|
||||||
sv u puzzled
|
sv u puzzled
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 215 B |
Loading…
Reference in New Issue