From 9b171e070ddacc07d9ef3596038f55ddbb56f053 Mon Sep 17 00:00:00 2001 From: Jonathan Bauer Date: Tue, 3 Nov 2015 17:07:13 +0100 Subject: [rfs-s31] support for SLX_LOCAL_CONFIG config.tgz should now a 'common' folder with the files needed by ALL clients. Further, it can contain subfolders with localized files. On bootup, the client will unpack the subfolder as given by SLX_LOCAL_CONFIG. EXAMPLE: config.tgz contains 'common' and 'rz'. SLX_LOCAL_CONFIG='rz' both common/ and rz/ will be extracted to FUTURE_ROOT TODO: support legacy style config.tgz ? support multiple subfolders to be installed? --- remote/rootfs/rootfs-stage31/data/inc/activate_sysconfig | 16 ++++++++++++++-- remote/rootfs/rootfs-stage31/data/inc/functions | 8 ++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/remote/rootfs/rootfs-stage31/data/inc/activate_sysconfig b/remote/rootfs/rootfs-stage31/data/inc/activate_sysconfig index 858102d2..3295a92d 100644 --- a/remote/rootfs/rootfs-stage31/data/inc/activate_sysconfig +++ b/remote/rootfs/rootfs-stage31/data/inc/activate_sysconfig @@ -63,7 +63,19 @@ HEREEND tar xf "${CONFIG}.tgz" -C "${TEMP_EXTRACT_DIR}" || { echo "Could not untar ${CONFIG}.tgz to ${TEMP_EXTRACT_DIR}"; return 1; } chown -R 0:0 "${TEMP_EXTRACT_DIR}" 2>/dev/null cd "${TEMP_EXTRACT_DIR}" - tar -cp * | tar -xp -C "${FUTURE_ROOT}" + # first extract the common config files found in config.tgz:common/ + if [ -d "common" ]; then + tarcopy "common" "${FUTURE_ROOT}" + echo "Extracted common configuration files." + fi + # now extract the localized part of the config + # this should be under config.tgz:$SLX_LOCAL_CONFIG + # e.g. config.tgz:rzpool + if [ -d "${SLX_LOCAL_CONFIG}" ]; then + tarcopy "${SLX_LOCAL_CONFIG}" "${FUTURE_ROOT}" + echo "Extracted local configuration files for: $SLX_LOCAL_CONFIG" + fi + # cleanup the downloaded stuff cd / rm -rf -- "${TEMP_EXTRACT_DIR}" [ $DEBUG -eq 0 ] && rm -f -- "${CONFIG}.tgz" @@ -74,7 +86,7 @@ HEREEND ######################################################################### # -# MAIN PART +# MAIN PART # fetch_sysconfig diff --git a/remote/rootfs/rootfs-stage31/data/inc/functions b/remote/rootfs/rootfs-stage31/data/inc/functions index 5cc56dd7..ee2f0c25 100644 --- a/remote/rootfs/rootfs-stage31/data/inc/functions +++ b/remote/rootfs/rootfs-stage31/data/inc/functions @@ -73,3 +73,11 @@ bench_event() { " } +# mini tarcopy <3 +# tarcopy +tarcopy() { + [ -d "$1" -a -d "$2" ] || return 1 + cd "$1" + tar -cp * | tar -xp -C "$2" + cd - &>/dev/null +} -- cgit v1.2.3-55-g7522