From 2d11063eebb47d994cd44e08e2a42bf3199f95b8 Mon Sep 17 00:00:00 2001 From: "Martin A. Brown" Date: Fri, 25 Mar 2016 16:27:52 -0700 Subject: [PATCH] utility wrapper scripts for migration time --- LDP/migration-2016/golive.sh | 52 +++++++++++++++++++++++++++ LDP/migration-2016/run-whole-thing.sh | 21 +++++++++++ 2 files changed, 73 insertions(+) create mode 100644 LDP/migration-2016/golive.sh create mode 100644 LDP/migration-2016/run-whole-thing.sh diff --git a/LDP/migration-2016/golive.sh b/LDP/migration-2016/golive.sh new file mode 100644 index 00000000..87702c4a --- /dev/null +++ b/LDP/migration-2016/golive.sh @@ -0,0 +1,52 @@ +#! /bin/bash + +set -e +set -x + +squawk () { printf >&2 "%s\n" "$@"; } +abort () { squawk "$@" ; exit 1; } + +SELFNAME="$( readlink --canonicalize ${0})" +ME="${SELFNAME##*/}" # -- basename +HERE="${SELFNAME%/*}" # -- dirname + +# -- SET THIS VARIABLE to the full path of the LDP content +# +CONTENTROOT=/home/mabrown/wip/tldp/website/html + +# -- trailing slash, atypically included on PUBDIR, here +PUBDIR="${CONTENTROOT}/en/" + +cd "$CONTENTROOT" + +READY=yes +for D in REF FAQ LDP HOWTO; do + if ! test -d "${D}"; then + squawk "Could not find directory ${D}." + READY=no + fi + if ! test -d "${D}.compat"; then + squawk "Could not find directory ${D}.compat." + READY=no + fi +done + +if test "$READY" != "yes"; then + abort "Cowardly, refusing to throw the switch." +fi + +for D in REF FAQ LDP HOWTO; do + + squawk "Activating new ${D}." + + mv -v "${D}" "old.${D}" && mv -v "${D}.compat" "${D}" + + squawk "Activated new ${D}." + +done + +squawk "Done. Success." + +exit 0 + +# -- end of file diff --git a/LDP/migration-2016/run-whole-thing.sh b/LDP/migration-2016/run-whole-thing.sh new file mode 100644 index 00000000..f85bba8d --- /dev/null +++ b/LDP/migration-2016/run-whole-thing.sh @@ -0,0 +1,21 @@ +#! /bin/bash + +set -e +set -x + +SELFNAME="$( readlink --canonicalize ${0})" +ME="${SELFNAME##*/}" # -- basename +HERE="${SELFNAME%/*}" # -- dirname + +{ + exec 2>&1; + + bash $HERE/migration-preparation.sh; + + bash $HERE/migration-helper.sh; + + bash $HERE/golive.sh; + +} | tee logfile-$( date +%F ).log + +# -- end of file