summaryrefslogtreecommitdiffstats
path: root/remote/rootfs/rootfs-stage31
diff options
context:
space:
mode:
authorJonathan Bauer2015-11-03 17:07:13 +0100
committerJonathan Bauer2015-11-03 17:07:13 +0100
commit9b171e070ddacc07d9ef3596038f55ddbb56f053 (patch)
treea0ecb03d9f19fc22c0abb5a6b2af8e4ea03f7af1 /remote/rootfs/rootfs-stage31
parentMerge branch 'master' of git.openslx.org:openslx-ng/tm-scripts (diff)
downloadtm-scripts-9b171e070ddacc07d9ef3596038f55ddbb56f053.tar.gz
tm-scripts-9b171e070ddacc07d9ef3596038f55ddbb56f053.tar.xz
tm-scripts-9b171e070ddacc07d9ef3596038f55ddbb56f053.zip
[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?
Diffstat (limited to 'remote/rootfs/rootfs-stage31')
-rw-r--r--remote/rootfs/rootfs-stage31/data/inc/activate_sysconfig16
-rw-r--r--remote/rootfs/rootfs-stage31/data/inc/functions8
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 <source_dir> <target_dir>
+tarcopy() {
+ [ -d "$1" -a -d "$2" ] || return 1
+ cd "$1"
+ tar -cp * | tar -xp -C "$2"
+ cd - &>/dev/null
+}