diff options
author | Jonathan Bauer | 2017-03-07 11:14:32 +0100 |
---|---|---|
committer | Jonathan Bauer | 2017-03-07 11:14:32 +0100 |
commit | 9b61577c3ceb809c2473d4757590a01054466eaf (patch) | |
tree | 2bbbd2dc0a7e79f8509b53bef2f1aba939900489 /builder/modules.d/dnbd3-rootfs/hooks | |
parent | Yannick Bilger's WLAN boot prototype (diff) | |
download | systemd-init-9b61577c3ceb809c2473d4757590a01054466eaf.tar.gz systemd-init-9b61577c3ceb809c2473d4757590a01054466eaf.tar.xz systemd-init-9b61577c3ceb809c2473d4757590a01054466eaf.zip |
moved all dracut modules to modules.d/ + support
Diffstat (limited to 'builder/modules.d/dnbd3-rootfs/hooks')
11 files changed, 531 insertions, 0 deletions
diff --git a/builder/modules.d/dnbd3-rootfs/hooks/copy-dnbd3-service-into-newroot.sh b/builder/modules.d/dnbd3-rootfs/hooks/copy-dnbd3-service-into-newroot.sh new file mode 100755 index 00000000..ee308af6 --- /dev/null +++ b/builder/modules.d/dnbd3-rootfs/hooks/copy-dnbd3-service-into-newroot.sh @@ -0,0 +1,33 @@ +#!/usr/bin/env bash +# -*- coding: utf-8 -*- +# region imports +source '/usr/lib/rebash/core.sh' +core.import exceptions +core.import logging +type emergency_shell >/dev/null 2>&1 || source /lib/dracut-lib.sh +# endregion +exceptions.try +{ +logging.set_commands_level debug +logging.set_level debug +[[ "$SLX_LOG_FILE_PATH" == "" ]] && SLX_LOG_FILE_PATH=/var/log/openslx +logging.set_log_file "$SLX_LOG_FILE_PATH" + +systemd_system_unit_path="$(dirname "$(find / -name dracut-mount.service \ + -type f -print -quit)")" +new_systemd_system_unit_path="${NEWROOT}/lib/systemd/system" +cp "${systemd_system_unit_path}/dnbd3root.service" \ + "${new_systemd_system_unit_path}/dnbd3root.service" +mkdir --parents "${new_systemd_system_unit_path}/sysinit.target.wants" +! ln --symbolic '../dnbd3root.service' \ + "${new_systemd_system_unit_path}/sysinit.target.wants/dnbd3root.service" +} +exceptions.catch +{ + logging.error "$exceptions_last_traceback" + emergency_shell "error in ${BASH_SOURCE[0]}" +} +# region vim modline +# vim: set tabstop=4 shiftwidth=4 expandtab: +# vim: foldmethod=marker foldmarker=region,endregion: +# endregion diff --git a/builder/modules.d/dnbd3-rootfs/hooks/copy-dracut-systemd-files-into-newroot.sh b/builder/modules.d/dnbd3-rootfs/hooks/copy-dracut-systemd-files-into-newroot.sh new file mode 100755 index 00000000..a887d8c9 --- /dev/null +++ b/builder/modules.d/dnbd3-rootfs/hooks/copy-dracut-systemd-files-into-newroot.sh @@ -0,0 +1,66 @@ +#!/usr/bin/env bash +# -*- coding: utf-8 -*- +# region imports +source '/usr/lib/rebash/core.sh' +core.import exceptions +core.import logging +type emergency_shell >/dev/null 2>&1 || source /lib/dracut-lib.sh +# endregion +exceptions.try +{ +logging.set_commands_level debug +logging.set_level debug +[[ "$SLX_LOG_FILE_PATH" == "" ]] && SLX_LOG_FILE_PATH=/var/log/openslx +logging.set_log_file "$SLX_LOG_FILE_PATH" + +# Needed to be able to go back to dracut at system shutdown. +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" +} +exceptions.catch +{ + logging.warn "Failed to copy initramfs to /run/initramfs, shutdown hooks" \ + "will not work." +} + +exceptions.try +{ +# Dracut may not be installed on the new root. Thus copy all services over. +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 "$new_systemd_system_unit_path/initrd.target.wants" +for file in \ + dracut-cmdline.service \ + dracut-initqueue.service \ + dracut-mount.service \ + dracut-pre-mount.service \ + dracut-pre-pivot.service \ + dracut-pre-trigger.service \ + dracut-pre-udev.service +do + cp "${systemd_system_unit_path}/${file}" \ + "${new_systemd_system_unit_path}/${file}" + # "ln" returns an error if the link already exists. + source_path="../${file}" + target_path="${new_systemd_system_unit_path}/initrd.target.wants/${file}" + ln --symbolic "$source_path" "$targetPath" &>/dev/null || \ + logging.warn "Failed to link \"$source_path\" to \"$target_path\"." +done +} +exceptions.catch +{ + logging.error "$exceptions_last_traceback" + emergency_shell "error in ${BASH_SOURCE[0]}" +} + +# region vim modline + +# vim: set tabstop=4 shiftwidth=4 expandtab: +# vim: foldmethod=marker foldmarker=region,endregion: + +# endregion diff --git a/builder/modules.d/dnbd3-rootfs/hooks/copy-openslx-configuration-into-newroot.sh b/builder/modules.d/dnbd3-rootfs/hooks/copy-openslx-configuration-into-newroot.sh new file mode 100755 index 00000000..6a56f857 --- /dev/null +++ b/builder/modules.d/dnbd3-rootfs/hooks/copy-openslx-configuration-into-newroot.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash +# -*- coding: utf-8 -*- +# region imports +source '/usr/lib/rebash/core.sh' +core.import exceptions +core.import logging +type emergency_shell >/dev/null 2>&1 || source /lib/dracut-lib.sh +# endregion +exceptions.try +{ +source "/etc/openslx" +logging.set_commands_level debug +logging.set_level debug +[[ "$SLX_LOG_FILE_PATH" == "" ]] && SLX_LOG_FILE_PATH=/var/log/openslx +logging.set_log_file "$SLX_LOG_FILE_PATH" + +mkdir --parents "${NEWROOT}${SLX_CONFIGURATION_LOCATION}" +cp "/etc/openslx" "${NEWROOT}${SLX_CONFIGURATION_LOCATION}" +} +exceptions.catch +{ + logging.error "$exceptions_last_traceback" + emergency_shell "error in ${BASH_SOURCE[0]}" +} +# region vim modline +# vim: set tabstop=4 shiftwidth=4 expandtab: +# vim: foldmethod=marker foldmarker=region,endregion: +# endregion diff --git a/builder/modules.d/dnbd3-rootfs/hooks/enable-sysrq.sh b/builder/modules.d/dnbd3-rootfs/hooks/enable-sysrq.sh new file mode 100755 index 00000000..f159e3ae --- /dev/null +++ b/builder/modules.d/dnbd3-rootfs/hooks/enable-sysrq.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash +# -*- coding: utf-8 -*- + +# Enables magic sysrq kernel supported key combinations. +echo 1 > /proc/sys/kernel/sysrq + +# region vim modline +# vim: set tabstop=4 shiftwidth=4 expandtab: +# vim: foldmethod=marker foldmarker=region,endregion: +# endregion diff --git a/builder/modules.d/dnbd3-rootfs/hooks/fetch-config.sh b/builder/modules.d/dnbd3-rootfs/hooks/fetch-config.sh new file mode 100755 index 00000000..23c5f004 --- /dev/null +++ b/builder/modules.d/dnbd3-rootfs/hooks/fetch-config.sh @@ -0,0 +1,53 @@ +#!/usr/bin/env bash +# -*- coding: utf-8 -*- +# region imports +source '/usr/lib/rebash/core.sh' +core.import exceptions +core.import logging +type emergency_shell >/dev/null 2>&1 || source /lib/dracut-lib.sh +# endregion +exceptions.try +{ +logging.set_commands_level debug +logging.set_level debug +[[ "$SLX_LOG_FILE_PATH" == "" ]] && SLX_LOG_FILE_PATH=/var/log/openslx +logging.set_log_file "$SLX_LOG_FILE_PATH" + +# NOTE: "getarg" raises an exception so deactivate exceptions for now. +exceptions.deactivate +configuration_file_name="$(getarg slx_configuration_filename=)" +if [ -z "$configuration_file_name" ]; then + configuration_file_name='config' +fi +slx_server="$(getarg slxsrv=)" +slx_server_base="$(getarg slxbase=)" +exceptions.activate + +logging.info 'Getting configuration file.' +IFS_backup="$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}" \ + --output-document '/etc/openslx' + then + break + fi +done +IFS="$IFS_backup" + +if [[ ! -e "/etc/openslx" ]]; then + logging.warn "Downloading OpenSLX configuration file from any of the servers \"${slx_server}\" at location \"${slx_server_base}/${configuration_file_name}\" failed. Return code: $return_code" + exit 1 +fi +} +exceptions.catch +{ + logging.error "$exceptions_last_traceback" + emergency_shell "error in ${BASH_SOURCE[0]}" +} +# region vim modline +# vim: set tabstop=4 shiftwidth=4 expandtab: +# vim: foldmethod=marker foldmarker=region,endregion: +# endregion diff --git a/builder/modules.d/dnbd3-rootfs/hooks/load-custom-kernel-modules.sh b/builder/modules.d/dnbd3-rootfs/hooks/load-custom-kernel-modules.sh new file mode 100755 index 00000000..fe153265 --- /dev/null +++ b/builder/modules.d/dnbd3-rootfs/hooks/load-custom-kernel-modules.sh @@ -0,0 +1,32 @@ +#!/usr/bin/env bash +# -*- coding: utf-8 -*- +# region imports +source '/usr/lib/rebash/core.sh' +core.import exceptions +core.import logging +type emergency_shell >/dev/null 2>&1 || source /lib/dracut-lib.sh +# endregion +exceptions.try +{ +DNBD3_MOD_PATH="/usr/lib/modules/current/extra/dnbd3.ko" + +if [ ! -e "${DNBD3_MOD_PATH}" ]; then + logging.warn "No such file of directory: ${DNBD3_MOD_PATH}" + exit 1 +fi + +# load the kernel modules for dnbd3 and nbd +if ! insmod "${DNBD3_MOD_PATH}"; then + logging.warn "Failed to load DNBD3 kernel module..." + exit 1 +fi +} +exceptions.catch +{ + logging.error "$exceptions_last_traceback" + emergency_shell "error in ${BASH_SOURCE[0]}" +} +# region vim modline +# vim: set tabstop=4 shiftwidth=4 expandtab: +# vim: foldmethod=marker foldmarker=region,endregion: +# endregion diff --git a/builder/modules.d/dnbd3-rootfs/hooks/mount-root-device.sh b/builder/modules.d/dnbd3-rootfs/hooks/mount-root-device.sh new file mode 100755 index 00000000..35443def --- /dev/null +++ b/builder/modules.d/dnbd3-rootfs/hooks/mount-root-device.sh @@ -0,0 +1,33 @@ +#!/usr/bin/env bash +# -*- coding: utf-8 -*- +# region imports +source '/usr/lib/rebash/core.sh' +core.import exceptions +type emergency_shell >/dev/null 2>&1 || source /lib/dracut-lib.sh +# endregion +exceptions.try +{ +logging.set_commands_level debug +logging.set_level debug +[[ "$SLX_LOG_FILE_PATH" == "" ]] && SLX_LOG_FILE_PATH=/var/log/openslx +logging.set_log_file "$SLX_LOG_FILE_PATH" + +if ! getarg root=; then + source "/etc/openslx" + mount /dev/mapper/root "$NEWROOT" $SLX_MOUNT_ROOT_OPTIONS + if [ -n "$SLX_GENERATE_FSTAB_SCRIPT" ]; then + eval "$SLX_GENERATE_FSTAB_SCRIPT" + else + echo "" > "$NEWROOT/etc/fstab" + fi +fi +} +exceptions.catch +{ + logging.error "$exceptions_last_traceback" + emergency_shell "error in ${BASH_SOURCE[0]}" +} +# region vim modline +# vim: set tabstop=4 shiftwidth=4 expandtab: +# vim: foldmethod=marker foldmarker=region,endregion: +# endregion diff --git a/builder/modules.d/dnbd3-rootfs/hooks/prepare-kernel-command-line-parameter.sh b/builder/modules.d/dnbd3-rootfs/hooks/prepare-kernel-command-line-parameter.sh new file mode 100755 index 00000000..20041ecf --- /dev/null +++ b/builder/modules.d/dnbd3-rootfs/hooks/prepare-kernel-command-line-parameter.sh @@ -0,0 +1,89 @@ +#!/usr/bin/env bash +# -*- coding: utf-8 -*- +# region imports +source '/usr/lib/rebash/core.sh' +core.import exceptions +core.import logging +# endregion +( +logging.set_commands_level debug +logging.set_level debug +[[ "$SLX_LOG_FILE_PATH" == "" ]] && SLX_LOG_FILE_PATH=/var/log/openslx +logging.set_log_file "$SLX_LOG_FILE_PATH" + +SLX_INITIAL_KERNEL_COMMAND_LINE="$(cat /proc/cmdline | tr --delete '\n')" + +# This location will be used to have a writable kernel command line file +# location. +writeable_proc_cmdline_path='/writable_proc_cmdline/' +mkdir --parents "$writeable_proc_cmdline_path" +# NOTE: The fake writeable overlay have to be a temporary filesystem for the +# hack to work. +mount --types tmpfs tmpfs "$writeable_proc_cmdline_path" +echo -n "$SLX_INITIAL_KERNEL_COMMAND_LINE" > \ + "${writeable_proc_cmdline_path}/cmdline" + +logging.debug \ + '-----------------------Kernel-Command-Line:------------------------------' +logging.debug "${SLX_INITIAL_KERNEL_COMMAND_LINE}" +logging.debug \ + '-------------------------------------------------------------------------' + +for parameter in $(getargs BOOTIF=); do + logging.debug "PXE given boot interface $parameter" + dracut_interface_name="bootnet:$(echo $parameter | \ + sed --regexp-extended 's/.{2}[:\-]((.{2}[:\-]){5}.{2})/\1/' | \ + sed s/-/:/g)" + logging.debug "Dracut interface name is: $dracut_interface_name" + logging.plain -n " ifname=$dracut_interface_name" >> \ + "${writeable_proc_cmdline_path}cmdline" +done +for parameter in $(getargs ip=); do + temp="$parameter:" + set -- + while [ -n "$temp" ]; do + set -- "$@" "${temp%%:*}" + temp=${temp#*:} + done + + [ -n "$1" ] && ip=$1 + [ -n "$2" ] && server_ip=$2 + [ -n "$3" ] && gateway_ip=$3 + [ -n "$4" ] && net_mask=$4 + + logging.debug "PXE given net configuration: ip: $ip server_ip: $server_ip gateway_ip: $gateway_ip net_mask: $net_mask" + dracut_ip_configuration="$ip::$gateway_ip:$net_mask::bootnet:off" + logging.debug "Dracut ip configuration is: $dracut_ip_configuration" + sed --regexp-extended "s/ip=[^ ]*/ip=$dracut_ip_configuration/g" \ + --in-place "${writeable_proc_cmdline_path}cmdline" +done + +if [ -z "$dracut_ip_configuration" ]; then + logging.warn 'No "ip" parameter found in the kernel command line.' +fi +if [ -z "$dracut_interface_name" ]; then + logging.warn 'No "BOOTIF" parameter found in the kernel command line.' +fi +mount --options bind "${writeable_proc_cmdline_path}cmdline" /proc/cmdline + +if [ -z "$(getargs slxsrv=)" ]; then + logging.warn 'No "slxsrv" parameter found in the kernel command line.' + exit 1 +fi +if [ -z "$(getargs slxbase=)" ]; then + logging.warn 'No "slxbase" parameter found in the kernel command line.' + exit 1 +fi + +logging.debug \ + '-----------------------Dracut-Kernel-Command-Line:-----------------------' +logging.debug "$(logging.cat /proc/cmdline)" +logging.debug \ + '-------------------------------------------------------------------------' +) +# region vim modline + +# vim: set tabstop=4 shiftwidth=4 expandtab: +# vim: foldmethod=marker foldmarker=region,endregion: + +# endregion diff --git a/builder/modules.d/dnbd3-rootfs/hooks/prepare-root-partition.sh b/builder/modules.d/dnbd3-rootfs/hooks/prepare-root-partition.sh new file mode 100755 index 00000000..3e93253f --- /dev/null +++ b/builder/modules.d/dnbd3-rootfs/hooks/prepare-root-partition.sh @@ -0,0 +1,163 @@ +#!/usr/bin/env bash +# region imports +source '/usr/lib/rebash/core.sh' +core.import '/usr/lib/openslx/tools.sh' +core.import exceptions +core.import utils +core.import logging +type emergency_shell >/dev/null 2>&1 || source /lib/dracut-lib.sh +# endregion +exceptions.try +{ +source /etc/openslx +logging.set_commands_level debug +logging.set_level debug +[[ "$SLX_LOG_FILE_PATH" == "" ]] && SLX_LOG_FILE_PATH=/var/log/openslx +logging.set_log_file "$SLX_LOG_FILE_PATH" + +# region find writable partition +if [[ "$SLX_WRITABLE_DEVICE_IDENTIFIER" != '' ]] && + ! persistent_device="$( + tools.find_block_device "$SLX_WRITABLE_DEVICE_IDENTIFIER" '' \ + "$SLX_WRITABLE_DEVICE_IDENTIFIER_TIMEOUT_IN_SECONDS" + )" +then + logging.warn "Failed to find unique device with identifier" \ + "\"${SLX_WRITABLE_DEVICE_IDENTIFIER}\"; matched devices:" \ + "\"${persistent_device}\"" +fi +if [ -n "$SLX_WRITABLE_DEVICE_STORAGE_FILE_PATH" ] && [ -n "$persistent_device" ] +then + persistent_mountpoint=/mnt/slx_writable_device + storage_file_path="${persistent_mountpoint}/$SLX_WRITABLE_DEVICE_STORAGE_FILE_PATH" + ! mkdir --parents "$(dirname "$storage_file_path")" + if ! mount --type auto "$persistent_device" "$persistent_mountpoint"; then + logging.warn "Failed to mount $persistent_device, checking filesystem." + ! $SLX_WRITABLE_DEVICE_STORAGE_FILESYSTEM_CHECK_COMMAND \ + "$persistent_device" + if ! mount --type auto "$persistent_device" "$persistent_mountpoint" + then + logging.warn "Mounting $persistent_device, still failing," \ + "creating new filesystem on device" + $SLX_WRITABLE_DEVICE_STORAGE_FILESYSTEM_CREATE_COMMAND \ + "$persistent_device" + fi + if ! mount --type auto "$persistent_device" "$persistent_mountpoint" + then + logging.warn "Mounting $persistent_device, still failing," \ + "giving up, and using ramdisk" + persistent_device="" + fi + fi + if [ -n "$persistent_device" ]; then + if [ ! -e "$storage_file_path" ]; then + # Create a sparse file. + dd of="$storage_file_path" bs=1M \ + seek="$SLX_WRITABLE_DEVICE_STORAGE_MAXIMUM_FILE_SIZE_IN_MB" count=0 + fi + persistent_device="$(losetup --find)" + losetup "$persistent_device" "$storage_file_path" + fi +fi + +# "P" for persistent storage, "N" for not persistent (affects dmsetup call, +# see scripts/device-add-write-layer.sh) +persistent='N' +if [ -n "$persistent_device" ]; then + writable_device="$persistent_device" + if [ "$SLX_WRITABLE_DEVICE_PERSISTENT" = "yes" ]; then + persistent='P' + fi +else + ramdisk_size_in_kb="$SLX_RAMDISK_SIZE_IN_KB" + if [ "$ramdisk_size_in_kb" = '' ]; then + ramdisk_size_in_kb="$(awk '/MemTotal/ {print $2}' /proc/meminfo)" + fi + # NOTE: If the kernel modul "brd" is compiled into current kernel we can't + # configure ram disk size dynamically. In this case it have to be + # configured via kernel command line: "brd.rd_size=SITE_IN_KILOBYTE" + # statically: + #! rmmod brd 2>/dev/null + #modprobe brd max_part=1 rd_size="$ramdisk_size_in_kb" + #writable_device='/dev/ram0' + ramdisk_location="$(mktemp)" + dd of="$ramdisk_location" seek="$ramdisk_size_in_kb" count=0 1>/dev/null + writable_device="$(losetup --find)" + losetup "$writable_device" "$ramdisk_location" +fi +# endregion +# region connect dnbd3 +IFS_backup="$IFS" +IFS="," +return_code=1 +for host in ${SLX_DNBD3_SERVERS}; do + logging.info "Trying host \"$host\"." + if systemd-preserve-process-marker dnbd3-client --host "$host" --image \ + "${SLX_DNBD3_IMAGE}" --device "$SLX_DNBD3_DEVICE" \ + --rid "$SLX_DNBD3_RID" + then + return_code=0 + break + fi +done +IFS="$IFS_backup" + +if [[ $return_code != 0 ]]; then + logging.warn "Failed to connect \"${SLX_DNBD3_IMAGE}\" (revision" \ + "\"$SLX_DNBD3_RID\") from one of \"$SLX_DNBD3_SERVERS\" to" \ + "\"$SLX_DNBD3_DEVICE\"." + exit 1 +fi +# endregion +# region scan partitions +if [ "$SLX_LOG_FILE_PATH" != "" ]; then + read_only_device="$(container-unpack-xmount "$SLX_DNBD3_DEVICE" \ + 2>>"$SLX_LOG_FILE_PATH")" +else + read_only_device="$(container-unpack-xmount "$SLX_DNBD3_DEVICE")" +fi + + +# Fail fast if no device could be determined. +[ -z "$read_only_device" ] && exit 1 +# endregion +# region find read-only partition +if [ -z "$SLX_SYSTEM_PARTITION_PREPARATION_SCRIPT" ]; then + if [ -z "$SLX_SYSTEM_PARTITION_IDENTIFIER" ]; then + # if empty use whole device + read_only_partition="$read_only_device" + true + else + read_only_partition="$(tools.find_block_device \ + "$SLX_SYSTEM_PARTITION_IDENTIFIER" "$read_only_device")" + fi +else + eval "$SLX_SYSTEM_PARTITION_PREPARATION_SCRIPT" +fi +if [[ ! $? || -z "$read_only_partition" ]]; then + logging.error "Failed to find unique device with identifier" \ + "\"${SLX_SYSTEM_PARTITION_IDENTIFIER}\"; matched devices:" \ + "\"${read_only_partition}\"" + exit 1 +fi +# endregion + +logging.info "Using read-only partition: $read_only_partition" +logging.info "Using writable device $writable_device, persistency: $persistent" + +# combine devices with device mapper +device-add-write-layer "root" "$read_only_partition" "$writable_device" \ + "$persistent" + +} +exceptions.catch +{ + logging.error "$exceptions_last_traceback" + emergency_shell "error in ${BASH_SOURCE[0]}" +} +# region vim modline + +# vim: set tabstop=4 shiftwidth=4 expandtab: +# vim: foldmethod=marker foldmarker=region,endregion: + +# endregion diff --git a/builder/modules.d/dnbd3-rootfs/hooks/set-dracut-environment-variables.sh b/builder/modules.d/dnbd3-rootfs/hooks/set-dracut-environment-variables.sh new file mode 100755 index 00000000..ad80349b --- /dev/null +++ b/builder/modules.d/dnbd3-rootfs/hooks/set-dracut-environment-variables.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash +# -*- coding: utf-8 -*- + +# Set rootok and root as dracut expects them to be set by the module preparing +# the root filesystem. + +# Tell dracut that we parsed the command line and all needed parameters are +# available. +rootok=1 +# Tell dracut where the final root fs will be located. +root=block:/dev/devicemapper/root + +# region vim modline +# vim: set tabstop=4 shiftwidth=4 expandtab: +# vim: foldmethod=marker foldmarker=region,endregion: +# endregion diff --git a/builder/modules.d/dnbd3-rootfs/hooks/shutdown-umount.sh b/builder/modules.d/dnbd3-rootfs/hooks/shutdown-umount.sh new file mode 100644 index 00000000..29b52187 --- /dev/null +++ b/builder/modules.d/dnbd3-rootfs/hooks/shutdown-umount.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +source /etc/openslx + +umount /oldroot +dmsetup --noudevsync remove root +losetup --detach-all +umount /mnt/* +dnbd3-client --device "$SLX_DNBD3_DEVICE" --close |