jupyterhub/containers/hub/create-hub-student.sh

27 lines
667 B
Bash
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
set -e
USERNAME=$1
source /srv/jupyterhub/tutor.conf
if [ -z "$USERNAME" ]; then
echo "You must provide a valid username as first argument !" 1>&2
exit 1
fi
echo -e "$USERNAME\n$USERNAME\n" | adduser -q --gecos "" $USERNAME
# Expose student work to tutor
mkdir -p /home/$TUTOR_USERNAME/students
ln -s /home/$USERNAME /home/$TUTOR_USERNAME/students/$USERNAME
chown $TUTOR_USERNAME: /home/$TUTOR_USERNAME/students/$USERNAME
#Expose tutor's lessons to student
mkdir -p /home/$TUTOR_USERNAME/lessons
chown $TUTOR_USERNAME: /home/$TUTOR_USERNAME/lessons
ln -s /home/$TUTOR_USERNAME/lessons /home/$USERNAME/lessons
chown $USERNAME: /home/$USERNAME