diff options
author | Daniel Baumann <daniel@debian.org> | 2012-12-19 11:21:28 +0100 |
---|---|---|
committer | Daniel Baumann <mail@daniel-baumann.ch> | 2013-05-06 14:50:03 +0200 |
commit | 904824308aa5e8964b741b54e240f5d3b3467101 (patch) | |
tree | 9d2e7c758b7ad6f9fd82dd1d64385072d12643c3 /functions/defaults.sh | |
parent | 64994422120e4378ab4c67950297eedd0460ebcd (diff) | |
download | vyos-live-build-904824308aa5e8964b741b54e240f5d3b3467101.tar.gz vyos-live-build-904824308aa5e8964b741b54e240f5d3b3467101.zip |
Also reading in existing values from new config tree format.
Diffstat (limited to 'functions/defaults.sh')
-rwxr-xr-x | functions/defaults.sh | 89 |
1 files changed, 56 insertions, 33 deletions
diff --git a/functions/defaults.sh b/functions/defaults.sh index 34b5979f8..59836c282 100755 --- a/functions/defaults.sh +++ b/functions/defaults.sh @@ -8,8 +8,60 @@ ## under certain conditions; see COPYING for details. +New_configuration () +{ + # Configuration-Version + LIVE_CONFIGURATION_VERSION="$(Get_configuration config/control Configuration-Version)" + LIVE_CONFIGURATION_VERSION="${LIVE_CONFIGURATION_VERSION:-${LIVE_BUILD_VERSION}}" + export LIVE_CONFIGURATION_VERSION + + # Image + #LIVE_IMAGE="$(Get_configuration config/control Image)" + #LIVE_IMAGE="${LIVE_IMAGE:-binary}" + + # Image Type + LIVE_IMAGE_TYPE="$(Get_configuration config/control Type)" + LIVE_IMAGE_TYPE="${LIVE_IMAGE_TYPE:-iso-hybrid}" + export LIVE_IMAGE_TYPE + + # Image Architecture + LIVE_IMAGE_ARCHITECTURE="$(Get_configuration config/control Architecture)" + + if [ -z "${LIVE_IMAGE_ARCHITECTURE}" ] + then + if [ -x "/usr/bin/dpkg" ] + then + LIVE_IMAGE_ARCHITECTURE="$(dpkg --print-architecture)" + else + case "$(uname -m)" in + sparc|powerpc) + LIVE_IMAGE_ARCHITECTURE="$(uname -m)" + ;; + x86_64) + LIVE_IMAGE_ARCHITECTURE="amd64" + ;; + *) + if [ -e /lib64 ] + then + LIVE_IMAGE_ARCHITECTURE="amd64" + else + LIVE_IMAGE_ARCHITECTURE="i386" + fi + + Echo_warning "Can't determine architecture, assuming ${LIVE_IMAGE_ARCHITECTURE}" + ;; + esac + fi + fi + + export LIVE_IMAGE_ARCHITECTURE +} + Set_defaults () { + # FIXME + New_configuration + ## config/common if [ -e local/live-build ] @@ -299,34 +351,6 @@ Set_defaults () ## config/bootstrap - # Setting architecture value - if [ -z "${LIVE_IMAGE_ARCHITECTURE}" ] - then - if [ -x "/usr/bin/dpkg" ] - then - LIVE_IMAGE_ARCHITECTURE="$(dpkg --print-architecture)" - else - case "$(uname -m)" in - sparc|powerpc) - LIVE_IMAGE_ARCHITECTURE="$(uname -m)" - ;; - x86_64) - LIVE_IMAGE_ARCHITECTURE="amd64" - ;; - *) - if [ -e /lib64 ] - then - LIVE_IMAGE_ARCHITECTURE="amd64" - else - LIVE_IMAGE_ARCHITECTURE="i386" - fi - - Echo_warning "Can't determine architecture, assuming ${LIVE_IMAGE_ARCHITECTURE}" - ;; - esac - fi - fi - # Setting mirror to fetch packages from case "${LB_MODE}" in debian) @@ -1140,20 +1164,19 @@ Set_defaults () Check_defaults () { - if [ -n "${LIVE_CONFIGURATION_VERSION}" ] + if [ -n "${LIVE_BUILD_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 LIVE_CONFIGURATION_VERSION + # however, as live-build always declares LIVE_BUILD_VERSION # internally, this is safe assumption (no cases where it's unset, # except when bootstrapping the functions/defaults etc.). - CURRENT_CONFIGURATION_VERSION="$(Get_configuration config/control Configuration-Version)" - CURRENT_CONFIGURATION_VERSION="$(echo ${CURRENT_CONFIGURATION_VERSION} | awk -F. ' { print $1 }')" + CURRENT_CONFIGURATION_VERSION="$(echo ${LIVE_CONFIGURATION_VERSION} | awk -F. ' { print $1 }')" if [ -n "${CURRENT_CONFIGURATION_VERSION}" ] then - CORRECT_VERSION="$(echo ${LIVE_CONFIGURATION_VERSION} | awk -F. '{ print $1 }')" + CORRECT_VERSION="$(echo ${LIVE_BUILD_VERSION} | awk -F. '{ print $1 }')" TOO_NEW_VERSION="$((${CORRECT_VERSION} + 1))" TOO_OLD_VERSION="$((${CORRECT_VERSION} - 1))" |