]> mj.ucw.cz Git - moe.git/blob - bin/mo-create-contestants
Oops, there was some crap in the patch.
[moe.git] / bin / mo-create-contestants
1 #!/bin/bash
2
3 [ -f config ] || { echo "Missing config file, check cwd." ; exit 1 ; }
4 set -e
5 . config
6
7 H=`pwd`
8 cd $MO_ROOT
9 rm -rf users
10 mkdir users
11 cd users
12
13 for a in `cd $H && bin/mo-get-users` ; do
14         echo "Creating $a"
15         mkdir $a $a/$a
16         chown root.$a $a
17         chmod 750 $a
18         cp -a `find $H/template -mindepth 1 -maxdepth 1` $a/$a/
19
20         if [ -n "$REMOTE_SUBMIT" ] ; then
21                 M=$a/$a/.mo
22                 mkdir $M
23                 cp $H/certs/$a-cert.pem $M/cert.pem
24                 cp $H/certs/$a-key.pem $M/key.pem
25                 chmod 600 $M/key.pem
26                 cp $H/certs/ca-cert.pem $M/
27         fi
28
29         chown $a.$a $a/$a -R
30         chmod 700 $a/$a
31 done