Start MZS uplift
authorTony Finch <dot@dotat.at>
Fri, 15 Jul 2016 16:28:35 +0000 (17:28 +0100)
committerTony Finch <dot@dotat.at>
Fri, 15 Jul 2016 16:28:35 +0000 (17:28 +0100)
.gitignore
Makefile
mzs-pre-uplift [new file with mode: 0755]

index 38161cc..f214e5f 100644 (file)
@@ -18,3 +18,6 @@ ipreg-cvs
 ipreg-mail
 ipreg-secrets
 ipreg-tarballs
+mzs.tar.gz
+mzs
+site
index 016b560..b1aad1f 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -111,3 +111,28 @@ ipreg-clean:
        rm -rf ipreg-secrets
        rm -rf ipreg-tarballs
        @echo CLEAN DONE $$(date +%Y-%m-%d.%H:%M:%S)
+
+# and now for the managed zone service ...
+
+mzs.tar.gz:
+       @echo FETCH START $$(date +%Y-%m-%d.%H:%M:%S)
+       -ssh mzs.csx.cam.ac.uk \
+       tar cf - /site | gzip -c >mzs.tar.gz
+       @echo FETCH DONE $$(date +%Y-%m-%d.%H:%M:%S)
+
+mzs: mzs.tar.gz
+       @echo UNPACK START $$(date +%Y-%m-%d.%H:%M:%S)
+       tar xf mzs.tar.gz
+       mv site mzs
+       touch mzs
+       @echo UNPACK DONE $$(date +%Y-%m-%d.%H:%M:%S)
+
+mzs-tidy: mzs
+       mzs-pre-uplift
+
+mzs-clean:
+       @echo CLEAN START $$(date +%Y-%m-%d.%H:%M:%S)
+       touch site mzs
+       chmod -R u+w site mzs
+       rm -rf site mzs
+       @echo CLEAN DONE $$(date +%Y-%m-%d.%H:%M:%S)
diff --git a/mzs-pre-uplift b/mzs-pre-uplift
new file mode 100755 (executable)
index 0000000..11b225a
--- /dev/null
@@ -0,0 +1,64 @@
+#!/bin/sh
+
+rmdir_f() {
+       mkdir -p "$@"
+       rmdir -p "$@"
+}
+
+inode() {
+       stat -c '%i' "$@"
+}
+
+B="\e[32m"
+D="\e[0m"
+
+set -e -x
+
+: $B PRE-UPLIFT START $(date +%Y-%m-%d.%H:%M:%S) $D
+
+: $B correct permissions $D
+chmod -R u+w mzs
+cd mzs
+
+: $B remove directories owned by MWS $D
+rm -rf apache
+rm -rf etc
+
+: $B remove empty directories $D
+rmdir_f cgi-bin
+rmdir_f vhosts
+rmdir_f mysql/backup/default
+
+: $B remove installed software $D
+rm -rf admindir/BIND/bin
+rm -rf admindir/BIND/data
+rm -rf admindir/BIND/etc/bind.keys
+rm -rf admindir/BIND/include
+rm -rf admindir/BIND/lib
+rm -rf admindir/BIND/sbin
+rm -rf admindir/BIND/share
+rm -rf admindir/BIND/var
+rm -rf admindir/software
+
+: $B undo hardlinks $D
+for d in admindir/PHPlib htdocs
+do
+       cd $d/test
+       mv SCCS ..
+       for f in *
+       do
+               if [ ! -f ../$f ]
+               then
+                       mv $f ../$f
+               elif [ $(inode $f) = $(inode ../$f) ]
+               then
+                       rm $f
+               else
+                       echo inode mismatch $f
+                       false
+               fi
+       done
+       cd -
+done
+
+: $B PRE-UPLIFT DONE $(date +%Y-%m-%d.%H:%M:%S) $D