From 45622a514ae66c6815dcc79b08428d9e82299909 Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Sun, 25 May 2008 23:19:04 +0200 Subject: [PATCH] Cleaned up mop/admin/. The script still need some updates and thorough testing. --- mop/admin/mo-create-contestants.sh | 5 +++-- mop/admin/mo-create-eval.sh | 5 +++-- mop/admin/mo-create-logins.sh | 8 +++++--- mop/admin/mo-create-public.sh | 25 ++++++++++++++----------- mop/admin/mo-create-submit.sh | 5 +++-- mop/admin/mo-create-testusers.sh | 5 +++-- mop/admin/mo-grab-remote.sh | 4 ++-- mop/admin/mo-grab.sh | 4 ++-- mop/admin/mo-install.sh | 4 ++-- 9 files changed, 37 insertions(+), 28 deletions(-) diff --git a/mop/admin/mo-create-contestants.sh b/mop/admin/mo-create-contestants.sh index 3cc4445..1de4b05 100755 --- a/mop/admin/mo-create-contestants.sh +++ b/mop/admin/mo-create-contestants.sh @@ -1,8 +1,9 @@ #!/bin/bash +# Create home directories of all contestants. -[ -f config ] || { echo "Missing config file, check cwd." ; exit 1 ; } +[ -f cf/mop ] || { echo "Missing config file, check cwd." ; exit 1 ; } set -e -. config +. cf/mop H=`pwd` cd $MO_ROOT diff --git a/mop/admin/mo-create-eval.sh b/mop/admin/mo-create-eval.sh index 707053c..0e236f0 100755 --- a/mop/admin/mo-create-eval.sh +++ b/mop/admin/mo-create-eval.sh @@ -1,8 +1,9 @@ #!/bin/bash +# Create home directory of the user who runs the evaluator. -[ -f config ] || { echo "Missing config file, check cwd." ; exit 1 ; } +[ -f cf/mop ] || { echo "Missing config file, check cwd." ; exit 1 ; } set -e -. config +. cf/mop H=`pwd` cd $MO_ROOT/eval diff --git a/mop/admin/mo-create-logins.sh b/mop/admin/mo-create-logins.sh index f6fc868..f2b4190 100755 --- a/mop/admin/mo-create-logins.sh +++ b/mop/admin/mo-create-logins.sh @@ -1,8 +1,10 @@ #!/bin/bash +# Create /etc/shadow, /etc/passwd and /etc/group records for accounts +# used by the evaluator and the contestants. -[ -f config ] || { echo "Missing config file, check cwd." ; exit 1 ; } +[ -f cf/mop ] || { echo "Missing config file, check cwd." ; exit 1 ; } set -e -. config +. cf/mop mode=$1 @@ -56,7 +58,7 @@ case $mode in \\def\\user#1#2#3{\\vbox to 4.5cm{\\hsize=6cm\\vss\\vss{\\fit Practice Session}\\vss\\vss{\\frm #3}\\vss\\vss#1\\vss#2\\vss\\vss}} \\leavevmode EOF - + bin/mo-get-users --full | while read user name; do passwd=`apg -n1 -m6 -Mncl | cut -d" " -f1 | tr l1O0 '@*?-' ` passwd_md5=`echo $passwd | bin/md5crypt` diff --git a/mop/admin/mo-create-public.sh b/mop/admin/mo-create-public.sh index 91c9c8e..3e26af7 100755 --- a/mop/admin/mo-create-public.sh +++ b/mop/admin/mo-create-public.sh @@ -1,26 +1,29 @@ #!/bin/bash +# Create a directory with the public scripts from mop/public/. -[ -f config ] || { echo "Missing config file, check cwd." ; exit 1 ; } +[ -f cf/mop ] || { echo "Missing config file, check cwd." ; exit 1 ; } set -e -. config +. cf/mop echo "Populating $MO_ROOT/public" H=`pwd` cd $MO_ROOT/public -rm -rf bin lib +rm -rf bin lib cf -sed '/^\(TEST_USER\|MO_ROOT\)=/s/^/#/' <$H/config >config +mkdir cf +for a in eval mop ; do + sed '/^\(TEST_USER\|MO_ROOT\)=/s/^/#/' <$H/cf/$a >cf/$a +done mkdir bin -cp -a $H/public/[a-z]* bin/ -for a in `cat $H/public/COPY` ; do - cp -a $H/$a bin/ -done +cp -a $H/bin/{check,submit,compile,status,box,iwrapper} bin/ + +mkdir lib +cp -a $H/lib/libeval.sh lib/ if [ -n "$REMOTE_SUBMIT" ] ; then - cp $H/submit/{contest,remote-submit,remote-status} bin/ - mkdir lib - cp -a $H/submit/lib . + cp -a $H/bin/{contest,remote-submit,remote-status} bin/ + cp -a $H/lib/perl5 lib/ fi mkdir -p problems diff --git a/mop/admin/mo-create-submit.sh b/mop/admin/mo-create-submit.sh index 2d34543..30056f0 100755 --- a/mop/admin/mo-create-submit.sh +++ b/mop/admin/mo-create-submit.sh @@ -1,8 +1,9 @@ #!/bin/bash +# Create home directory of the submit server. -[ -f config ] || { echo "Missing config file, check cwd." ; exit 1 ; } +[ -f cf/mop ] || { echo "Missing config file, check cwd." ; exit 1 ; } set -e -. config +. cf/mop [ -n "$REMOTE_SUBMIT" ] || { echo "Remote submit not enabled." ; exit 1 ; } echo "Creating submit directory" diff --git a/mop/admin/mo-create-testusers.sh b/mop/admin/mo-create-testusers.sh index aec3535..42e7bfa 100755 --- a/mop/admin/mo-create-testusers.sh +++ b/mop/admin/mo-create-testusers.sh @@ -1,8 +1,9 @@ #!/bin/bash +# Create accounts used by the sandbox. -[ -f config ] || { echo "Missing config file, check cwd." ; exit 1 ; } +[ -f cf/mop ] || { echo "Missing config file, check cwd." ; exit 1 ; } set -e -. config +. cf/mop H=`pwd` cd $MO_ROOT/eval diff --git a/mop/admin/mo-grab-remote.sh b/mop/admin/mo-grab-remote.sh index eff0ec0..3f1eb7e 100755 --- a/mop/admin/mo-grab-remote.sh +++ b/mop/admin/mo-grab-remote.sh @@ -2,9 +2,9 @@ # Grab all submits from the submit server and copy them to solutions/. [ -n "$1" ] || { echo "Usage: mo-grab-remote " ; exit 1 ; } -[ -f config ] || { echo "Missing config file, check cwd." ; exit 1 ; } +[ -f cf/mop ] || { echo "Missing config file, check cwd." ; exit 1 ; } set -e -. config +. cf/mop for user in `bin/mo-get-users` ; do echo -n "$user:" diff --git a/mop/admin/mo-grab.sh b/mop/admin/mo-grab.sh index ad57520..8bbc8fb 100755 --- a/mop/admin/mo-grab.sh +++ b/mop/admin/mo-grab.sh @@ -3,9 +3,9 @@ # local machine and copy them to solutions/. [ -n "$1" ] || { echo "Usage: mo-grab " ; exit 1 ; } -[ -f config ] || { echo "Missing config file, check cwd." ; exit 1 ; } +[ -f cf/mop ] || { echo "Missing config file, check cwd." ; exit 1 ; } set -e -. config +. cf/mop for user in `bin/mo-get-users` ; do echo -n "$user:" diff --git a/mop/admin/mo-install.sh b/mop/admin/mo-install.sh index f4456a9..e458160 100755 --- a/mop/admin/mo-install.sh +++ b/mop/admin/mo-install.sh @@ -1,8 +1,8 @@ #!/bin/bash -[ -f config ] || { echo "Missing config file, check cwd." ; exit 1 ; } +[ -f cf/mop ] || { echo "Missing config file, check cwd." ; exit 1 ; } set -e -. config +. cf/mop H=`pwd` -- 2.39.2