]> mj.ucw.cz Git - eval.git/commitdiff
Some more MO scripts from MO52.
authorMartin Mares <mj@ucw.cz>
Fri, 11 Apr 2003 09:52:42 +0000 (09:52 +0000)
committerMartin Mares <mj@ucw.cz>
Fri, 11 Apr 2003 09:52:42 +0000 (09:52 +0000)
bin/mo-create-floppy [new file with mode: 0755]
bin/mo-create-packages [new file with mode: 0755]

diff --git a/bin/mo-create-floppy b/bin/mo-create-floppy
new file mode 100755 (executable)
index 0000000..f51377f
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/bash
+# Create a floppy with solutions, testing logs and example solution
+# expects that mo-create-packages has been run before
+# and adds stuff in $MO_ROOT/floppy
+
+[ -n "$1" ] || { echo "Usage: mo-create-floppy <user>" ; exit 1 ; }
+USER=$1
+[ -f config ] || { echo "Missing config file, check cwd." ; exit 1 ; }
+set -e
+. config
+
+mkdosfs /dev/fd0
+mount -tvfat /dev/fd0 /mnt
+D=/mnt
+U=$MO_ROOT/users/$USER/$USER
+if [ -d $U/testing ] ; then ( cd $U ; zip -r $D/testing.zip testing ) fi
+if [ -d $U/solutions ] ; then cp -dR $U/solutions/* $D/ ; fi
+cp -dR $MO_ROOT/floppy/* $D/
+umount /mnt
+echo "Done."
diff --git a/bin/mo-create-packages b/bin/mo-create-packages
new file mode 100755 (executable)
index 0000000..4a163c1
--- /dev/null
@@ -0,0 +1,24 @@
+#!/bin/bash
+# Create contestant directories with their solutions and test logs
+
+[ -f config ] || { echo "Missing config file, check cwd." ; exit 1 ; }
+set -e
+. config
+
+H=`pwd`
+cd $MO_ROOT
+rm -rf users2
+mkdir users2
+cd users2
+
+for a in `awk </etc/passwd -F: '{ if ($3 >= '$CT_UID_MIN' && $3 <= '$CT_UID_MAX') print $1; }'` ; do
+       echo "Creating $a"
+       mkdir $a $a/$a
+       chown root.$a $a
+       chmod 750 $a
+       cp -a `find $H/template -type f -name ".*"` $a/$a/
+       if [ -d $H/solutions/$a ] ; then cp -a $H/solutions/$a $a/$a/solutions ; fi
+       if [ -d $H/testing/$a ] ; then cp -a $H/testing/$a $a/$a/testing ; fi
+       chown $a.$a $a/$a -R
+       chmod 700 $a/$a
+done