hooks/busybox: Fail if busybox is wanted but not found

Currently we silently fall back to klibc if BUSYBOX=y but we can't
find it.  This can result in an unusable initramfs, so fail instead
of continuing.

This mitigates bug #783297.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
This commit is contained in:
Ben Hutchings 2015-12-06 01:19:55 +00:00
parent 41eb6ac420
commit 7285ffb144
4 changed files with 17 additions and 3 deletions

View File

@ -22,7 +22,7 @@ MODULES=most
#
# BUSYBOX: [ y | n ]
#
# Use busybox if available.
# Use busybox shell and utilities. If set to n, klibc utilities will be used.
#
BUSYBOX=y

10
debian/NEWS vendored
View File

@ -1,3 +1,13 @@
initramfs-tools (0.121) UNRELEASED; urgency=medium
* If initramfs-tools is configured to use busybox but it is not
installed, mkinitramfs will now fail. Previously it would quietly use
klibc instead, sometimes producing a broken initramfs. You may need
to modify /etc/initramfs-tools/initramfs-tools.conf or install busybox
when upgrading.
-- Ben Hutchings <ben@decadent.org.uk> Sun, 06 Dec 2015 02:58:35 +0000
initramfs-tools (0.119) unstable; urgency=medium
* The initramfs will now run fsck on the root filesystem before

View File

@ -16,7 +16,11 @@ prereqs)
esac
# busybox
if [ "${BUSYBOX}" != "n" ] && [ -e ${BUSYBOXDIR}/busybox ]; then
if [ "${BUSYBOX}" != "n" ]; then
if ! [ -e ${BUSYBOXDIR}/busybox ]; then
echo >&2 "E: busybox is required but not installed"
exit 1
fi
. /usr/share/initramfs-tools/hook-functions
rm -f ${DESTDIR}/bin/sh
rm -f ${DESTDIR}/bin/busybox

View File

@ -19,7 +19,7 @@ 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" ] || [ ! -e ${BUSYBOXDIR}/busybox ]; then
if [ "${BUSYBOX}" = "n" ]; then
if [ -e ${DESTDIR}/bin/sh.shared ]; then
# Some platforms build a shared klibc/sh:
mv ${DESTDIR}/bin/sh.shared ${DESTDIR}/bin/sh