]> mj.ucw.cz Git - moe.git/blob - bin/mo-create-packages
Added.
[moe.git] / bin / mo-create-packages
1 #!/bin/bash
2 # Create contestant directories with their solutions and test logs
3
4 [ -f config ] || { echo "Missing config file, check cwd." ; exit 1 ; }
5 set -e
6 . config
7
8 H=`pwd`
9 cd $MO_ROOT
10 rm -rf users2
11 mkdir users2
12 cd users2
13
14 for a in `awk </etc/passwd -F: '{ if ($3 >= '$CT_UID_MIN' && $3 <= '$CT_UID_MAX') print $1; }'` ; do
15         echo "Creating $a"
16         mkdir $a $a/$a
17         chown root.$a $a
18         chmod 750 $a
19         cp -a `find $H/template -type f -name ".*"` $a/$a/
20         if [ -d $H/solutions/$a ] ; then cp -a $H/solutions/$a $a/$a/solutions ; fi
21         if [ -d $H/testing/$a ] ; then cp -a $H/testing/$a $a/$a/testing ; fi
22         chown $a.$a $a/$a -R
23         chmod 700 $a/$a
24 done