X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=dsa-metapackages.git;a=blobdiff_plain;f=apache2-vhost-update;h=5bddf71c3b196e6c19e8d8441bb02af91698d18d;hp=61c5bf369567ec375acd91039e470a6aafaca1b3;hb=021fb6caca85da5cb71cbc5f9dcd8d3121c6d904;hpb=09efc8cd9d37f03c72dae07112972b145fee82b8 diff --git a/apache2-vhost-update b/apache2-vhost-update index 61c5bf3..5bddf71 100755 --- a/apache2-vhost-update +++ b/apache2-vhost-update @@ -16,10 +16,10 @@ # All config changes are tracked in RCS. # # needs something like this in sudoers: -# %apachectrl ALL=(root) /usr/sbin/restart-apache +# %apachectrl ALL=(root) /usr/sbin/apache2-vhost-update -# Copyright (c) 2009 Peter Palfrader +# Copyright (c) 2009,2010 Peter Palfrader # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the @@ -112,8 +112,16 @@ if [ "$?" != "0" ]; then echo "Could not get a lock/checkout $DESTINATION/$site." >&2 exit 1 fi + cp -f "$STATINGDIR/$site" "$DESTINATION/$site" +if grep -i include "$DESTINATION/$site" > /dev/null; then + echo "New site may have include statements - rejecting." >&2 + rm -f "$DESTINATION/$site" + co "$DESTINATION/$site" + exit 1 +fi + /usr/sbin/apache2ctl configtest if [ "$?" != "0" ]; then echo "configtest returned errors; reverting." >&2 @@ -122,6 +130,9 @@ if [ "$?" != "0" ]; then exit 1 fi +echo "Differences:" +rcsdiff -u "$DESTINATION/$site" + echo "update run by $USER($SUDO_USER) at `date -R -u` on `hostname -f`" | \ ci -u "$DESTINATION/$site" if [ "$?" != "0" ]; then