2 # Create /etc/shadow, /etc/passwd and /etc/group records for accounts
3 # used by the evaluator and the contestants.
5 [ -f cf/mop ] || { echo "Missing config file, check cwd." ; exit 1 ; }
12 eval) uid=$EVAL_UID_MIN;;
13 users) uid=$CT_UID_MIN;;
14 *) echo "Usage: $0 [eval|users]!"; exit 1;;
17 >>etcshadow >>etcpasswd >>etcgroup
18 expire=$((`date +%s` / 86400 - 1))
22 echo -n Enter password for evaluation users:
24 passwd=`echo $passwd | bin/md5crypt`
28 echo $EVAL_USER:x:$uid:$gid:MO Evaluator:$MO_ROOT/eval/eval:/bin/bash >> etcpasswd
29 echo $EVAL_USER:$passwd:$expire:0:99999:7::: >> etcshadow
30 echo $EVAL_GROUP:x:$gid: >> etcgroup
31 echo $TEST_GROUP:x:$tgid:$EVAL_USER >> etcgroup
33 if [ -n "$REMOTE_SUBMIT" ] ; then
35 echo $REMOTE_SUBMIT_USER:x:$uid:$rgid:MO Submitter:$MO_ROOT/eval/submit:/bin/bash >> etcpasswd
36 echo $REMOTE_SUBMIT_USER:$passwd:$expire:0:99999:7::: >> etcshadow
37 echo $REMOTE_SUBMIT_GROUP:x:$rgid: >> etcgroup
41 for tester in $TEST_USERS; do
42 echo $tester:x:$tuid:$tgid:MO Tester `expr $tuid - $uid`:$MO_ROOT/eval/$tester:/bin/bash >> etcpasswd
43 echo $tester:$passwd:$expire:0:99999:7::: >> etcshadow
49 # if [ -f logins.tex ]; then echo "File logins.tex exists! Bailing out!"; exit 1; fi
50 cat > logins.tex <<- EOF
52 \\voffset=-1.5cm\\vsize=280mm\\hoffset=-0.75cm\\advance\\hsize by 3cm
53 \\rightskip=0pt plus 3in\\parindent=0pt
58 \\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}}
62 bin/mo-get-users --full | while read user name; do
63 passwd=`apg -n1 -m6 -Mncl | cut -d" " -f1 | tr l1O0 '@*?-' `
64 passwd_md5=`echo $passwd | bin/md5crypt`
65 echo $user:x:$uid:$uid:$name:$MO_ROOT/users/$user/$user:/bin/bash >> etcpasswd
66 echo $user:x:$uid: >> etcgroup
67 echo $user:$passwd_md5:`expr \`date +%s\` / 86400 - 1`:0:99999:7::: >> etcshadow
68 echo "\\user{$user}{$passwd}{$name}" >> logins.tex
72 cat >> logins.tex <<- EOF