summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Hutchings <ben@decadent.org.uk>2016-01-20 20:12:38 +0000
committerBen Hutchings <ben@decadent.org.uk>2016-01-20 21:44:14 +0000
commitd4febbd442f922f8cba7ea9c7207ecdfe6582efc (patch)
treea6fedc5df5d3f251fffecfa0a520840b232ebd2c
parent913a861175d65a5423f4de47c4a033b94485ec28 (diff)
Remove busybox hook in favour of busybox's own
- Set BUSYBOXDIR empty initially and let busybox's conf hook override it - Fail if BUSYBOX=y and BUSYBOXDIR remains empty after running conf hooks - Bump the minimum version to the first version that has the conf hook - Update the automatic selection of klibc utilities to check whether BUSYBOXDIR is empty Closes: #810154 Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
-rw-r--r--debian/initramfs-tools-core.dirs1
-rw-r--r--debian/initramfs-tools-core.install1
-rwxr-xr-xdebian/rules9
-rwxr-xr-xhooks/busybox34
-rwxr-xr-xhooks/klibc3
-rwxr-xr-xmkinitramfs10
6 files changed, 18 insertions, 40 deletions
diff --git a/debian/initramfs-tools-core.dirs b/debian/initramfs-tools-core.dirs
index bcb978b..21f605c 100644
--- a/debian/initramfs-tools-core.dirs
+++ b/debian/initramfs-tools-core.dirs
@@ -10,6 +10,7 @@ etc/initramfs-tools/scripts/nfs-top
etc/initramfs-tools/scripts/panic
etc/initramfs-tools/hooks
etc/initramfs-tools/conf.d
+usr/sbin
usr/share/initramfs-tools/conf.d
usr/share/initramfs-tools/conf-hooks.d
usr/share/initramfs-tools/modules.d
diff --git a/debian/initramfs-tools-core.install b/debian/initramfs-tools-core.install
index 91d0378..2b57045 100644
--- a/debian/initramfs-tools-core.install
+++ b/debian/initramfs-tools-core.install
@@ -1,5 +1,4 @@
lsinitramfs usr/bin
-mkinitramfs usr/sbin
init usr/share/initramfs-tools
scripts usr/share/initramfs-tools
conf/initramfs.conf etc/initramfs-tools
diff --git a/debian/rules b/debian/rules
index ea2ff3b..d630547 100755
--- a/debian/rules
+++ b/debian/rules
@@ -6,8 +6,15 @@
# On Debian we can use either busybox or busybox-static, but on Ubuntu
# and derivatives only busybox-initramfs will work.
BUSYBOX_PACKAGES := $(shell if dpkg-vendor --derives-from ubuntu; then echo busybox-initramfs; else echo busybox busybox-static; fi)
-BUSYBOX_MIN_VERSION := 1:1.01-3
+BUSYBOX_MIN_VERSION := 1:1.22.0-17~
override_dh_gencontrol:
echo >> debian/initramfs-tools-core.substvars "busybox:Recommends=$(wordlist 2,100,$(BUSYBOX_PACKAGES:%=| % (>= $(BUSYBOX_MIN_VERSION))))"
dh_gencontrol
+
+override_dh_install:
+ sed -e 's,@BUSYBOX_PACKAGES@,$(wordlist 2,100,$(BUSYBOX_PACKAGES:%=or %)),' \
+ -e 's/@BUSYBOX_MIN_VERSION@/$(BUSYBOX_MIN_VERSION)/' \
+ mkinitramfs > debian/initramfs-tools-core/usr/sbin/mkinitramfs
+ chmod 755 debian/initramfs-tools-core/usr/sbin/mkinitramfs
+ dh_install
diff --git a/hooks/busybox b/hooks/busybox
deleted file mode 100755
index c01d06d..0000000
--- a/hooks/busybox
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/bin/sh
-
-PREREQ=""
-
-prereqs()
-{
- echo "$PREREQ"
-}
-
-case $1 in
-# get pre-requisites
-prereqs)
- prereqs
- exit 0
- ;;
-esac
-
-# busybox
-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
-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 2e753ed..d985036 100755
--- a/hooks/klibc
+++ b/hooks/klibc
@@ -19,8 +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" ] || \
- { [ "${BUSYBOX}" != "y" ] && ! [ -e ${BUSYBOXDIR}/busybox ]; }; then
+if [ "${BUSYBOX}" = "n" ] || [ -z "${BUSYBOXDIR}" ]; then
if [ -e ${DESTDIR}/bin/sh.shared ]; then
# Some platforms build a shared klibc/sh:
mv ${DESTDIR}/bin/sh.shared ${DESTDIR}/bin/sh
diff --git a/mkinitramfs b/mkinitramfs
index fac0049..5cc6608 100755
--- a/mkinitramfs
+++ b/mkinitramfs
@@ -7,8 +7,8 @@ export PATH='/usr/bin:/sbin:/bin'
keep="n"
CONFDIR="/etc/initramfs-tools"
verbose="n"
-test -e /bin/busybox && BUSYBOXDIR=/bin
-test -e /usr/lib/initramfs-tools/bin/busybox && BUSYBOXDIR=/usr/lib/initramfs-tools/bin
+# Will be updated by busybox's conf hook, if present
+BUSYBOXDIR=
export BUSYBOXDIR
OPTIONS=`getopt -o c:d:ko:r:v -n "$0" -- "$@"`
@@ -90,6 +90,12 @@ for i in /usr/share/initramfs-tools/conf-hooks.d/*; do
fi
done
+# Check busybox dependency
+if [ "${BUSYBOX}" = "y" ] && [ -z "${BUSYBOXDIR}" ]; then
+ echo >&2 "E: @BUSYBOX_PACKAGES@, version @BUSYBOX_MIN_VERSION@ or later, is required but not installed"
+ exit 1
+fi
+
if [ -n "${UMASK:-}" ]; then
umask "${UMASK}"
fi