#!/bin/sh
-# export_htdocs - export HTML documents
+# export_htdocs - Export OpenAFS web site from Git repository
+#
+# Based on export_htdocs by Jeffrey Hutzelman <jhutz@cs.cmu.edu>
-if [ "x$CVSROOT" = "x" ] ; then
- CVSROOT=/cvs
- export CVSROOT
-fi
-
-if [ "x$1" = "x-d" ] ; then
- CVSROOT="$2"
- shift; shift;
- export CVSROOT
-fi
-
-basedir=/data/htdocs
+basedir=/srv/www
+gitrepo=/srv/git/openafs-web.git
umask 002
set -e
exit 1
fi
-tree=$1
+tree="$1"
stamp=`date +%s`
-tag=htdocs_${tree}_${stamp}
-newtree=${tree}_${stamp}
+newtree="${tree}_${stamp}"
cd $basedir
trap 'rm -rf $newtree' 0 1 2 15
# Generate the new tree
-cvs export -kv -d $newtree -r HEAD htdocs-$tree
-
-# Update any automatically-generated files
-if [ -f /usr/local/libexec/export-htdocs/$tree ] ; then
- /usr/local/libexec/export-htdocs/$tree -x $newtree
-fi
+git archive --remote="$gitrepo" --prefix="$newtree"/ master | tar xf -
# Generate frameless versions of pages
-/usr/local/sbin/frameless -v $newtree
+/usr/local/sbin/frameless -v "$newtree"
# Move it into place
rm -f $tree.new
trap 0 1 2 15
-perl -e 'exit !rename($ARGV[0], $ARGV[1])' $tree.new $tree
+perl -e 'exit !rename($ARGV[0], $ARGV[1])' "$tree.new" "$tree"
# Cleanup
-for i in ${tree}_* ; do
- if [ $i != $newtree ]; then
- rm -rf $i
- fi
+for i in "${tree}"_* ; do
+ if [ $i != "$newtree" ]; then
+ rm -rf "$i"
+ fi
done
exit 0