Course Management Scripts
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
780 B

#!/bin/bash
[ -z "$COURSE" ] && echo "Needs a COURSE set" && exit 1
[ -z "$1" ] && echo "Needs an assignment name" && exit 1
while read USER; do
echo -n "$USER: "
if [ -L /course/$COURSE/assn/$USER ]; then
echo -e "\x1b[1;31mSkipped $USER: assn dir is a link\x1b[0m"
continue
fi
for assn in $*; do
if [ -e /course/$COURSE/assn/$USER/$assn ]; then
echo -e "\x1b[1;31mPath /course/$COURSE/assn/$USER/$assn already exists, aborting...\x1b[0m"
continue
fi
mkdir /course/$COURSE/assn/$USER/$assn
chown root:admin /course/$COURSE/assn/$USER/$assn
setfacl -m u:$USER:rx -m d:u::rwx -m d:g::rwx -m d:g:admin:rwx -m d:o:0 /course/$COURSE/assn/$USER/$assn
chmod 770 /course/$COURSE/assn/$USER/$assn
ls --color -lad /course/$COURSE/assn/$USER/$assn
done
done