X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=apache2-vhost-update;h=cf5b1dbcb0992995b1817d24a94cb0786fce23e0;hb=8638348a3e4797018c6ac97afdd001765f10e496;hp=5bddf71c3b196e6c19e8d8441bb02af91698d18d;hpb=f55cc31f294df5766f3c973704653a93820e2e9d;p=dsa-metapackages.git diff --git a/apache2-vhost-update b/apache2-vhost-update index 5bddf71..cf5b1db 100755 --- a/apache2-vhost-update +++ b/apache2-vhost-update @@ -42,7 +42,7 @@ -STATINGDIR="/etc/apache2/sites-staging" +STAGINGDIR="/etc/apache2/sites-staging" DESTINATION="/etc/apache2/sites-available" usage() { @@ -91,8 +91,12 @@ if echo "$site" | grep /; then exit 1 fi -if ! [ -f "$STATINGDIR/$site" ]; then - echo "$STATINGDIR/$site does not exist or is not a file" >&2 +if [ -f "$STAGINGDIR/$site.conf" ] ; then + site="$site.conf" +fi + +if ! [ -f "$STAGINGDIR/$site" ]; then + echo "$STAGINGDIR/$site does not exist or is not a file" >&2 exit 1 fi @@ -102,7 +106,7 @@ if [ "$?" != "0" ]; then exit 1 fi -if diff "$STATINGDIR/$site" "$DESTINATION/$site" > /dev/null; then +if diff "$STAGINGDIR/$site" "$DESTINATION/$site" > /dev/null; then echo "No differences, not doing anything." >&2 exit 1 fi @@ -113,7 +117,7 @@ if [ "$?" != "0" ]; then exit 1 fi -cp -f "$STATINGDIR/$site" "$DESTINATION/$site" +cp -f "$STAGINGDIR/$site" "$DESTINATION/$site" if grep -i include "$DESTINATION/$site" > /dev/null; then echo "New site may have include statements - rejecting." >&2 @@ -122,6 +126,20 @@ if grep -i include "$DESTINATION/$site" > /dev/null; then exit 1 fi +if grep -i LoadModule "$DESTINATION/$site" > /dev/null; then + echo "New site may have LoadModule statements - rejecting." >&2 + rm -f "$DESTINATION/$site" + co "$DESTINATION/$site" + exit 1 +fi + +if grep -i LoadFile "$DESTINATION/$site" > /dev/null; then + echo "New site may have LoadFile 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