diff options
| author | torben | 2016-03-01 13:36:24 +0100 |
|---|---|---|
| committer | torben | 2016-03-01 13:36:24 +0100 |
| commit | f37fd0b219b0e2e3fe056135b987d8b7abb949b1 (patch) | |
| tree | adddf211205e3350ee1cef15014b2669d8ca4dec | |
| parent | update dnbd3 submodule (diff) | |
| download | systemd-init-f37fd0b219b0e2e3fe056135b987d8b7abb949b1.tar.gz systemd-init-f37fd0b219b0e2e3fe056135b987d8b7abb949b1.tar.xz systemd-init-f37fd0b219b0e2e3fe056135b987d8b7abb949b1.zip | |
Make slx configuration file name editable.
| -rw-r--r-- | builder/dnbd3-rootfs/hooks/copy-dracut-systemd-files-into-newroot.sh | 47 | ||||
| -rwxr-xr-x | builder/dnbd3-rootfs/hooks/fetch-config.sh | 8 |
2 files changed, 39 insertions, 16 deletions
diff --git a/builder/dnbd3-rootfs/hooks/copy-dracut-systemd-files-into-newroot.sh b/builder/dnbd3-rootfs/hooks/copy-dracut-systemd-files-into-newroot.sh index 075428ee..fbc2c1e0 100644 --- a/builder/dnbd3-rootfs/hooks/copy-dracut-systemd-files-into-newroot.sh +++ b/builder/dnbd3-rootfs/hooks/copy-dracut-systemd-files-into-newroot.sh @@ -1,10 +1,22 @@ #!/usr/bin/env bash +# region imports +type getarg >/dev/null 2>&1 || source /lib/dracut-lib.sh +source "/usr/lib/rebash/core.sh" +core.import exceptions +exceptions.activate +core.import utils +core.import logging +# endregion +( # subshell for variable scoping +logging.set_commands_level debug +logging.set_level debug + # Dracut may not be installed on the new root. Thus copy all services over. -systemdsystemunitdir="$( - dirname "$(find / -name dracut-mount.service -type f -print -quit)")" -newsystemdsystemunitdir="${NEWROOT}/lib/systemd/system" +systemd_system_unit_path="$(dirname "$(find / -name dracut-mount.service \ + -type f -print -quit)")" +new_systemd_system_unit_path="${NEWROOT}/lib/systemd/system" -mkdir --parents "$newsystemdsystemunitdir/initrd.target.wants" +mkdir --parents "$new_systemd_system_unit_path/initrd.target.wants" for file in \ dracut-cmdline.service \ dracut-initqueue.service \ @@ -12,15 +24,24 @@ for file in \ dracut-pre-mount.service \ dracut-pre-pivot.service \ dracut-pre-trigger.service \ - dracut-pre-udev.service; do - cp "${systemdsystemunitdir}/$file" \ - "${newsystemdsystemunitdir}/$file" - ln -s ../"$file" \ - "${newsystemdsystemunitdir}/initrd.target.wants/$file" + dracut-pre-udev.service +do + cp "${systemd_system_unit_path}/${file}" \ + "${new_systemd_system_unit_path}/${file}" + ln --symbolic "../${file}" \ + "${new_systemd_system_unit_path}/initrd.target.wants/${file}" done # Needed to be able to go back to dracut at system shutdown. -temp_dir="$(mktemp --directory)" -mount --bind / "$temp_dir" -cp --recursive --no-target-directory "$temp_dir" /run/initramfs -umount "$temp_dir" && rm --dir "$temp_dir" +temporary_directory_path="$(mktemp --directory)" +mount --options bind / "$temporary_directory_path" +cp --recursive --no-target-directory "$temporary_directory_path" /run/initramfs +umount "$temporary_directory_path" && rm --dir "$temporary_directory_path" +) || exit $? +exceptions.deactivate +# region vim modline + +# vim: set tabstop=4 shiftwidth=4 expandtab: +# vim: foldmethod=marker foldmarker=region,endregion: + +# endregion diff --git a/builder/dnbd3-rootfs/hooks/fetch-config.sh b/builder/dnbd3-rootfs/hooks/fetch-config.sh index f8c0257d..61174a3f 100755 --- a/builder/dnbd3-rootfs/hooks/fetch-config.sh +++ b/builder/dnbd3-rootfs/hooks/fetch-config.sh @@ -11,15 +11,17 @@ core.import logging logging.set_commands_level debug logging.set_level debug -# TODO make configurable via kernel command line -configuration_file_name='config' +configuration_file_name="$(getargs slx_configuration_filename=)" +if [ -z "$configuration_file_name" ]; then + configuration_file_name='config' +fi slx_server="$(getargs slxsrv=)" slx_server_base="$(getargs slxbase=)" logging.info 'Getting configuration file.' IFS_backup="$IFS" -IFS="," +IFS=',' for host in ${slx_server}; do logging.info "Trying host \"$host\"." if wget --timeout 5 "http://${host}/${slx_server_base}${configuration_file_name}" \ |
