summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xmodules.d/conf-tgz/hooks/unpack-config-tgz.sh28
1 files changed, 15 insertions, 13 deletions
diff --git a/modules.d/conf-tgz/hooks/unpack-config-tgz.sh b/modules.d/conf-tgz/hooks/unpack-config-tgz.sh
index 2132423c..99ace4b4 100755
--- a/modules.d/conf-tgz/hooks/unpack-config-tgz.sh
+++ b/modules.d/conf-tgz/hooks/unpack-config-tgz.sh
@@ -4,15 +4,14 @@
type emergency_shell >/dev/null 2>&1 || source /lib/dracut-lib.sh
# tarcopy <source_dir> <target_dir>
-tarcopy() {
+tarcopy() (
[ -d "$1" -a -d "$2" ] || return 1
- cd "$1"
+ cd "$1" || return 1
local filelist="$(mktemp)"
find . \! -type d > "$filelist"
tar -c -p -T "$filelist" | tar -xp -C "$2"
rm -f -- "$filelist"
- cd - &>/dev/null
-}
+)
unpack_config_tgz() {
local config_tgz="/etc/config.tgz"
@@ -34,16 +33,19 @@ unpack_config_tgz() {
warn "Failed to extract '$config_tgz' to '$extract_dir'."
return 1
fi
- # check SLX_LOCAL_CONFIGURATION
+ # check SLX_LOCAL_CONFIG
source "/etc/openslx"
- if [ -n "$SLX_LOCAL_CONFIGURATION" ]; then
- if [ ! -d "${extract_dir}/openslx-configs/${SLX_LOCAL_CONFIGURATION}" ]; then
- warn "Ignoring missing SLX_LOCAL_CONFIGURATION in '$config_tgz'."
- else
- tarcopy \
- "${extract_dir}/openslx-configs/${SLX_LOCAL_CONFIGURATION}" \
- "${extract_dir}"
- fi
+ if [ -n "$SLX_LOCAL_CONFIG" ]; then
+ local mod
+ for mod in $SLX_LOCAL_CONFIG; do
+ if [ ! -d "${extract_dir}/openslx-configs/${mod}" ]; then
+ warn "Ignoring missing mod '$mod' in config.tgz"
+ else
+ tarcopy \
+ "${extract_dir}/openslx-configs/${mod}" \
+ "${extract_dir}"
+ fi
+ done
fi
# always purge openslx-configs/
rm -rf "${extract_dir}/openslx-configs"