Command line script to manage the cpi lab journal users.
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.

29 lines
707 B

#!/bin/bash
# This script will add a new user directory to the svn repository
# it will only checkout the top level directory and should therefore
# be faster then the original script
# HF
set -e
set -u
username=$1
year=`date +"%Y"`
# checkout only the top level directory into a new folder
cd /var/www
svn checkout file:///var/www/svn/cpi svn-dirs-empty --depth immediates
# create the user folder and commit it
cd /var/www/svn-dirs-empty
mkdir -p $username
mkdir -p $username/$year/$year-{01,02,03,04,05,06,07,08,09,10,11,12}
for i in $username/$year/*; do touch $i/.empty; done
svn add $username
svn commit -m"New user: $username"
# remove the temporary directory
cd /var/www
rm -r svn-dirs-empty/