diff options
author | Simon Rettberg | 2024-06-03 09:44:48 +0200 |
---|---|---|
committer | Simon Rettberg | 2024-06-03 09:44:48 +0200 |
commit | e84d58ef9fc476e1282fc38fa594eff58feb1256 (patch) | |
tree | 9aeeb6496cc9370950252ec44cd6ca2be66d9fdb | |
parent | [dnbd3-rootfs] Try optimized ext4 mount options if none are given (diff) | |
download | systemd-init-downloader-cmake-refactor.tar.gz systemd-init-downloader-cmake-refactor.tar.xz systemd-init-downloader-cmake-refactor.zip |
[config-tgz] support multiple local configsdownloader-cmake-refactor
Just like MiniLinux stage31 did.
-rwxr-xr-x | modules.d/conf-tgz/hooks/unpack-config-tgz.sh | 28 |
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" |