Some systems are working alright with the old default of BUSYBOX=y and
no busybox installed. We should only force use of busybox if another
package installing initramfs scripts needs it.
Change the default from BUSYBOX=y to BUSYBOX=auto, and give that the
old semantics.
Closes: #809204
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
conf/initramfs.conf | 6 ++++--
hooks/busybox | 19 ++++++++++++-------
hooks/klibc | 3 ++-
3 files changed, 18 insertions(+), 10 deletions(-)
diff --git a/conf/initramfs.conf b/conf/initramfs.conf
index 367d561..f0f5071 100644
--- a/conf/initramfs.conf
+++ b/conf/initramfs.conf
@@ -20,12 +20,14 @@
MODULES=most
#
-# BUSYBOX: [ y | n ]
+# BUSYBOX: [ y | n | auto ]
#
# Use busybox shell and utilities. If set to n, klibc utilities will be used.
+# If set to auto (or unset), busybox will be used if installed and klibc will
+# be used otherwise.
#
-BUSYBOX=y
+BUSYBOX=auto
#
# KEYMAP: [ y | n ]
diff --git a/hooks/busybox b/hooks/busybox
index 45d4bea..c01d06d 100755
--- a/hooks/busybox
+++ b/hooks/busybox
@@ -16,14 +16,19 @@ prereqs)
esac
# busybox
-if [ "${BUSYBOX}" != "n" ]; then
- if ! [ -e ${BUSYBOXDIR}/busybox ]; then
+if [ "${BUSYBOX}" = "n" ]; then
+ exit 0
+fi
+if ! [ -e ${BUSYBOXDIR}/busybox ]; then
+ if [ "${BUSYBOX}" = "y" ]; then
echo >&2 "E: busybox is required but not installed"
exit 1
+ else
+ exit 0
fi
- . /usr/share/initramfs-tools/hook-functions
- rm -f ${DESTDIR}/bin/sh
- rm -f ${DESTDIR}/bin/busybox
- copy_exec ${BUSYBOXDIR}/busybox /bin/busybox
- ln -s busybox ${DESTDIR}/bin/sh
fi
+. /usr/share/initramfs-tools/hook-functions
+rm -f ${DESTDIR}/bin/sh
+rm -f ${DESTDIR}/bin/busybox
+copy_exec ${BUSYBOXDIR}/busybox /bin/busybox
+ln -s busybox ${DESTDIR}/bin/sh
diff --git a/hooks/klibc b/hooks/klibc
index 9047199..2e753ed 100755
--- a/hooks/klibc
+++ b/hooks/klibc
@@ -19,7 +19,8 @@ esac
cp -pnL /usr/lib/klibc/bin/* ${DESTDIR}/bin
cp -pL /lib/klibc-*.so ${DESTDIR}/lib
rm -f ${DESTDIR}/bin/kinit* ${DESTDIR}/bin/zcat
-if [ "${BUSYBOX}" = "n" ]; then
+if [ "${BUSYBOX}" = "n" ] || \
+ { [ "${BUSYBOX}" != "y" ] && ! [ -e ${BUSYBOXDIR}/busybox ]; }; then
if [ -e ${DESTDIR}/bin/sh.shared ]; then
# Some platforms build a shared klibc/sh:
mv ${DESTDIR}/bin/sh.shared ${DESTDIR}/bin/sh
Attachment:
signature.asc
Description: Digital signature