Chris@1598: #!/bin/bash Chris@1598: Chris@1598: set -e Chris@1598: Chris@1598: # Initialise directories used as targets for cron activity (if they Chris@1598: # don't already exist) Chris@1598: Chris@1598: # Reminder: the webapp directory is owned and run by the code user, in Chris@1598: # group www-data. The repos and other things served directly are Chris@1598: # usually the other way around -- owned by the www-data user, in group Chris@1598: # code. I don't recall whether there is a good reason for this. Chris@1598: Chris@1598: for dir in \ Chris@1598: /var/files/backups \ Chris@1598: /var/doc \ Chris@1613: /var/files/code \ Chris@1598: /var/files/git-mirror ; do Chris@1598: if [ ! -d "$dir" ]; then Chris@1598: mkdir -p "$dir" Chris@1598: chown -R code.www-data "$dir" Chris@1598: chmod g+s "$dir" Chris@1598: fi Chris@1598: done Chris@1598: Chris@1598: for dir in \ Chris@1598: /var/mirror ; do Chris@1598: if [ ! -d "$dir" ]; then Chris@1598: mkdir -p "$dir" Chris@1598: chown -R www-data.code "$dir" Chris@1598: chmod g+s "$dir" Chris@1598: fi Chris@1598: done Chris@1613: Chris@1613: if [ ! -e /var/www/code/files ]; then Chris@1613: ln -s /var/files/code /var/www/code/files Chris@1613: fi