From 57e5be632d4e40314cd8d1a67973ee1e58d3dfb8 Mon Sep 17 00:00:00 2001 From: Alexey Neyman Date: Sun, 20 Jan 2019 16:42:12 -0800 Subject: Basic framework for checking config file version Signed-off-by: Alexey Neyman --- scripts/version-check.sh | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 scripts/version-check.sh (limited to 'scripts') diff --git a/scripts/version-check.sh b/scripts/version-check.sh new file mode 100644 index 00000000..c4a2bd07 --- /dev/null +++ b/scripts/version-check.sh @@ -0,0 +1,38 @@ +# This script checks the version of the configuration file and either +# alerts the user about the need to run the upgrade, or attempts to +# perform such an upgrade. + +CFGFILE="${1}" + +. "${CT_LIB_DIR}/scripts/functions" +. "${CFGFILE}" +if [ "${CT_CONFIG_VERSION_CURRENT}" == "${CT_CONFIG_VERSION}" ]; then + # Nothing to do + exit 0 +fi + +if [ -z "${CT_UPGRADECONFIG}" ]; then + if [ "${CT_CONFIG_VERSION}" != "0" ]; then + oldversion="is version ${CT_CONFIG_VERSION}" + else + oldversion="has no version" + fi + cat 2>&1 <&2 +exit 1 -- cgit v1.2.3