From cd9455f578ad53ca623069ead0ae793591c1082a Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Fri, 11 Apr 2003 09:52:42 +0000 Subject: [PATCH] Some more MO scripts from MO52. --- bin/mo-create-floppy | 20 ++++++++++++++++++++ bin/mo-create-packages | 24 ++++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100755 bin/mo-create-floppy create mode 100755 bin/mo-create-packages diff --git a/bin/mo-create-floppy b/bin/mo-create-floppy new file mode 100755 index 0000000..f51377f --- /dev/null +++ b/bin/mo-create-floppy @@ -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 " ; 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 index 0000000..4a163c1 --- /dev/null +++ b/bin/mo-create-packages @@ -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 = '$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 -- 2.39.2