#!/bin/sh # Log LOG_FILE=/home/matthieu/commitlog-testing-cvs-hooks DATE=`date "+%m/%d/%y [%H:%M:%S]"` # Kepping my website in sync rootDir=/web `cd $rootDir` # 1st argument is the directory, then list of files dir=$1 shift if [ "$1" = "- New directory" ] then # This is a new directory added to CVS, nothing to do here echo "$DATE: New directory added $dir" >> $LOG_FILE exit 0 fi echo "$DATE: Post-commit notification in $dir" >> $LOG_FILE if [ ! -d $rootDir/$dir ] then # The directory has never been checked out, create it mkdir -p $rootDir/$dir fi for file in $* do echo "$DATE: Post-commit notification for $file" >> $LOG_FILE res=`cvs co -d $rootDir/$dir $dir/$file` echo "$DATE: Result for $file : $res" >> $LOG_FILE done # Eat extra input cat > /dev/null