From 949849b9ac61976199fe224db6f035956863102a Mon Sep 17 00:00:00 2001 From: Jonathan Bauer Date: Wed, 7 Apr 2021 15:16:29 +0200 Subject: [dnbd3-rootfs] copy dnbd3-client over to stage4 --- .../hooks/copy-dnbd3-files-into-newroot.sh | 21 +++++++++++++++++++++ .../hooks/copy-dnbd3-service-into-newroot.sh | 12 ------------ modules.d/dnbd3-rootfs/module-setup.sh | 2 +- 3 files changed, 22 insertions(+), 13 deletions(-) create mode 100755 modules.d/dnbd3-rootfs/hooks/copy-dnbd3-files-into-newroot.sh delete mode 100755 modules.d/dnbd3-rootfs/hooks/copy-dnbd3-service-into-newroot.sh diff --git a/modules.d/dnbd3-rootfs/hooks/copy-dnbd3-files-into-newroot.sh b/modules.d/dnbd3-rootfs/hooks/copy-dnbd3-files-into-newroot.sh new file mode 100755 index 00000000..2ff8664f --- /dev/null +++ b/modules.d/dnbd3-rootfs/hooks/copy-dnbd3-files-into-newroot.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash +# -*- coding: utf-8 -*- + +# copy dnbd3root.service to NEWROOT to ensure it stays known to systemd +systemd_system_unit_path="$(dirname \ + "$(systemctl show -p FragmentPath dracut-mount.service | cut -c 14-)")" +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" + +# copy dnbd3-client binary to NEWROOT to make sure it is compatible with the +# kernel module +dnbd3_client_path="$(type -p dnbd3-client)" +if [ -n "$dnbd3_client_path" ]; then + mkdir -p "${NEWROOT}/${dnbd3_client_path%/*}" + cp "$dnbd3_client_path" "${NEWROOT}/${dnbd3_client_path}" +fi +true diff --git a/modules.d/dnbd3-rootfs/hooks/copy-dnbd3-service-into-newroot.sh b/modules.d/dnbd3-rootfs/hooks/copy-dnbd3-service-into-newroot.sh deleted file mode 100755 index ddfe4992..00000000 --- a/modules.d/dnbd3-rootfs/hooks/copy-dnbd3-service-into-newroot.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash -# -*- coding: utf-8 -*- -type emergency_shell >/dev/null 2>&1 || source /lib/dracut-lib.sh - -systemd_system_unit_path="$(dirname \ - "$(systemctl show -p FragmentPath dracut-mount.service | cut -c 14-)")" -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" diff --git a/modules.d/dnbd3-rootfs/module-setup.sh b/modules.d/dnbd3-rootfs/module-setup.sh index c23eed26..866c086a 100755 --- a/modules.d/dnbd3-rootfs/module-setup.sh +++ b/modules.d/dnbd3-rootfs/module-setup.sh @@ -169,7 +169,7 @@ install() { # Copy systemd services to new root (so they don't get killed after # switch_root) inst_hook pre-pivot 00 \ - "$moddir/hooks/copy-dnbd3-service-into-newroot.sh" + "$moddir/hooks/copy-dnbd3-files-into-newroot.sh" inst_hook pre-pivot 00 \ "$moddir/hooks/copy-dracut-systemd-files-into-newroot.sh" inst_hook pre-shutdown 00 "$moddir/hooks/shutdown-umount.sh" -- cgit v1.2.3-55-g7522