summaryrefslogtreecommitdiff
path: root/functions/defaults.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel@debian.org>2012-12-19 09:49:06 +0100
committerDaniel Baumann <mail@daniel-baumann.ch>2013-05-06 14:50:03 +0200
commitc73a5a0ee0b7e372ef33b6f0ab817d86a1a8093e (patch)
tree7b0a5f2208056d319688540b0e1eaf346f85f0cd /functions/defaults.sh
parenta595e9c1bc870897c98ed95a7659db3c87966eea (diff)
downloadvyos-live-build-c73a5a0ee0b7e372ef33b6f0ab817d86a1a8093e.tar.gz
vyos-live-build-c73a5a0ee0b7e372ef33b6f0ab817d86a1a8093e.zip
Moving configuration version off as the first option into new config tree format.
Diffstat (limited to 'functions/defaults.sh')
-rwxr-xr-xfunctions/defaults.sh41
1 files changed, 25 insertions, 16 deletions
diff --git a/functions/defaults.sh b/functions/defaults.sh
index d49534c09..2500ddd59 100755
--- a/functions/defaults.sh
+++ b/functions/defaults.sh
@@ -1140,32 +1140,41 @@ Set_defaults ()
Check_defaults ()
{
- if [ "${LB_CONFIG_VERSION}" ]
+ if [ -n "${LIVE_CONFIGURATION_VERSION}" ]
then
# We're only checking when we're actually running the checks
# that's why the check for emptyness of the version;
- # however, as live-build always declares LB_CONFIG_VERSION
+ # however, as live-build always declares LIVE_CONFIGURATION_VERSION
# internally, this is safe assumption (no cases where it's unset,
# except when bootstrapping the functions/defaults etc.).
- CURRENT_CONFIG_VERSION="$(echo ${LB_CONFIG_VERSION} | awk -F. '{ print $1 }')"
- if [ ${CURRENT_CONFIG_VERSION} -ne 4 ]
+ CURRENT_CONFIGURATION_VERSION="$(Get_configuration config/control Configuration-Version)"
+ CURRENT_CONFIGURATION_VERSION="$(echo ${CURRENT_CONFIGURATION_VERSION} | awk -F. ' { print $1 }')"
+
+ if [ -n "${CURRENT_CONFIGURATION_VERSION}" ]
then
- if [ ${CURRENT_CONFIG_VERSION} -ge 5 ]
- then
- Echo_error "This config tree is too new for this version of live-build (${VERSION})."
- Echo_error "Aborting build, please get a new version of live-build."
+ CORRECT_VERSION="$(echo ${LIVE_CONFIGURATION_VERSION} | awk -F. '{ print $1 }')"
+ TOO_NEW_VERSION="$((${CORRECT_VERSION} + 1))"
+ TOO_OLD_VERSION="$((${CORRECT_VERSION} - 1))"
- exit 1
- elif [ ${CURRENT_CONFIG_VERSION} -le 3 ]
+ if [ ${CURRENT_CONFIGURATION_VERSION} -ne ${CORRECT_VERSION} ]
then
- Echo_error "This config tree is too old for this version of live-build (${VERSION})."
- Echo_error "Aborting build, please regenerate the config tree."
+ if [ ${CURRENT_CONFIGURATION_VERSION} -ge ${TOO_NEW_VERSION} ]
+ then
+ Echo_error "This config tree is too new for live-build (${VERSION})."
+ Echo_error "Aborting build, please update live-build."
- exit 1
- else
- Echo_warning "This config tree does not specify a format version or has an unknown version number."
- Echo_warning "Continuing build, but it could lead to errors or different results. Please regenerate the config tree."
+ exit 1
+ elif [ ${CURRENT_CONFIGURATION_VERSION} -le ${TOO_OLD_VERSION} ]
+ then
+ Echo_error "This config tree is too old for live-build (${VERSION})."
+ Echo_error "Aborting build, please update the configuration."
+
+ exit 1
+ else
+ Echo_warning "This configuration does not specify a version or has a unknown version."
+ Echo_warning "Continuing build, please correct the configuration."
+ fi
fi
fi
fi