summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Bauer2021-08-13 15:24:52 +0200
committerJonathan Bauer2021-08-13 15:24:52 +0200
commit18859afb02ca0b78a0307f86b0eac7fb06b89310 (patch)
tree3d2b4c02c7fa6ba5510fbd7a4396dfb76a10093a
parentremove dnbd3 patch (diff)
downloadsystemd-init-18859afb02ca0b78a0307f86b0eac7fb06b89310.tar.gz
systemd-init-18859afb02ca0b78a0307f86b0eac7fb06b89310.tar.xz
systemd-init-18859afb02ca0b78a0307f86b0eac7fb06b89310.zip
[busybox] compat: /bin/ash in NEWROOT
-rw-r--r--modules.d/busybox/install-busybox-stage4.sh24
1 files changed, 16 insertions, 8 deletions
diff --git a/modules.d/busybox/install-busybox-stage4.sh b/modules.d/busybox/install-busybox-stage4.sh
index 03071773..bcd1f94d 100644
--- a/modules.d/busybox/install-busybox-stage4.sh
+++ b/modules.d/busybox/install-busybox-stage4.sh
@@ -1,18 +1,26 @@
#!/bin/bash
if hash busybox; then
- # check if the stage4 has a busybox in the same location
- # as within the initramfs. If so, we keep it and just hope
- # that everything works out and that the apps are symlinked.
- # Otherwise we copy it and activate applets in /opt/openslx/{s,}/bin
- bb_path="$(type -p busybox)"
- if [ -n "$bb_path" ] && [ ! -x "${NEWROOT}/opt/openslx/bin/busybox" ]; then
+ # copy busybox to NEWROOT unless one exists at the expected path.
+ bb_target_path="/opt/openslx/bin/busybox"
+ bb_source_path="$(type -p busybox)"
+
+ if [ -n "$bb_source_path" ] && [ ! -x "${NEWROOT}${bb_target_path}" ]; then
mkdir -p "${NEWROOT}"/opt/openslx/{s,}bin
- cp -f "$bb_path" "${NEWROOT}/opt/openslx/bin/busybox"
+ cp -f "$bb_source_path" "${NEWROOT}${bb_target_path}"
# --list-full gives {s,}bin prefixes
for app in $(busybox --list-full); do
- ln -s "/opt/openslx/bin/busybox" "${NEWROOT}/opt/openslx/$app"
+ ln -s "$bb_target_path" "${NEWROOT}/opt/openslx/$app"
done
fi
+ # compat: /bin/ash if not exists
+ if [ ! -e "${NEWROOT}/bin/ash" ]; then
+ # either dead symlink or nothing there.
+ ln -sf "$bb_target_path" "${NEWROOT}/bin/ash"
+ else
+ # either valid symlink or binary, log it and ignore.
+ type -p warn &>/dev/null || . /lib/dracut-lib.sh
+ warn "'/bin/ash' is a valid symlink or binary, ignoring."
+ fi
fi
true