#!/bin/sh ################################################### # A dubious script which commits generated website # contents to xml-site/targets/$MODULE ################################################### MODULE=${1:-xml-forrest} case $MODULE in xml-forrest) TARGET="forrest" ;; esac [ -z "$TARGET" ] && echo "Unknown module: $MODULE" && exit; . `dirname $0`/local-vars if [ -z "$XML_SITE" ]; then echo "Please set the XML_SITE var in local-vars-`uname -n`" exit fi SRC_DIR=$WEBAPP/sites/$MODULE if [ ! -d "$SRC_DIR" ]; then echo "Expected website contents in $SRC_DIR" exit fi LIVECVS=$XML_SITE/targets/$TARGET echo "Updating $LIVECVS from $SRC_DIR" pushd . cd $LIVECVS cvsco cvs up -dP echo "Now copying $SRC_DIR/*" cp -r -p $SRC_DIR/* . echo "done" NEW_FILES=`cvs up | grep '^\?' | cut -d\ -f 2` for i in $NEW_FILES; do MIME=`file -bi $i` echo "New file $i has MIME type $MIME" if [ `echo "$MIME" | grep -q 'text'` ]; then echo "Adding $i as text" cvsdo add $i else echo "Adding $i as binary" cvs add -kb $i fi done cvs up > /tmp/cvslist 2>&1 cvs ci -m "Automatic publish at `date` by forrestrunner." #cvs ci popd