aboutsummaryrefslogtreecommitdiff
path: root/tools/boca-submit-run-root
diff options
context:
space:
mode:
authorcassio <cassiopc@gmail.com>2015-08-28 11:54:31 +0000
committercassio <cassiopc@gmail.com>2015-08-28 11:54:31 +0000
commitbe2798607fd15e8b116993a8d33d75b0a6ad0f50 (patch)
tree141fbb157ca2af73818e5cf5585e5a5a68c3deb6 /tools/boca-submit-run-root
parent56b10a617339563cda2c761e77b3acb96a1b084c (diff)
downloadboca-be2798607fd15e8b116993a8d33d75b0a6ad0f50.tar.gz
boca-be2798607fd15e8b116993a8d33d75b0a6ad0f50.zip
scripts for multiple submissions
Diffstat (limited to 'tools/boca-submit-run-root')
-rwxr-xr-xtools/boca-submit-run-root19
1 files changed, 16 insertions, 3 deletions
diff --git a/tools/boca-submit-run-root b/tools/boca-submit-run-root
index 21ecbc6..60365cf 100755
--- a/tools/boca-submit-run-root
+++ b/tools/boca-submit-run-root
@@ -1,11 +1,23 @@
#!/bin/bash
-if [ "$1" != "" ]; then
+if [ "`id -u`" != "0" ]; then
+ echo "Must be run as root"
+ exit 1
+fi
+
+if [ "$5" != "" ]; then
mkdir -p /root/submissions
chown root /root/submissions
chmod 700 /root/submissions
- nom=/root/submissions/`date +%s%N`.bocarun
- cp "$1" "$nom"
+ nom=/root/submissions/`date +%s%N`.bocarun.tmp
+
+ echo "BOCASERVER=`echo "$1" | tr -cd '[[:alnum:]]._-'`" > "$nom"
+ echo "user=`echo "$2" | tr -cd '[[:alnum:]]._-'`" >> "$nom"
+ echo "pass=`echo "$3" | tr -cd '[[:alnum:]]._-'`" >> "$nom"
+ echo "name=`echo "$4" | tr -cd '[[:alnum:]]._-'`" >> "$nom"
+ echo -n "data=" >> "$nom"
+ uuencode -m zzzzzzzzzz < `echo "$5" | tr -cd '[[:alnum:]]._-'` | grep -v "begin-base64.*zzzzzzzzzz" | perl -MURI::Escape -lne 'print uri_escape($_)' >> "$nom"
+ echo "" >> "$nom"
echo "dateerr=`date +%s`" >> "$nom"
uniq=`date +%sN`-`sha256sum "$1"`
uniq=`echo $uniq | sha256sum - | cut -f1 -d' '`
@@ -13,4 +25,5 @@ if [ "$1" != "" ]; then
res=`echo -n "${code}${uniq}${dateerr}" | sha256sum - | cut -f1 -d' '`
echo "uniq=$uniq" >> "$nom"
echo "code=$res" >> "$nom"
+ mv "$nom" "/root/submissions/`basename $nom .tmp`"
fi