diff options
-rwxr-xr-x | hooks/busybox | 31 | ||||
-rwxr-xr-x | hooks/klibc | 3 | ||||
-rwxr-xr-x | mkinitramfs | 18 |
3 files changed, 36 insertions, 16 deletions
diff --git a/hooks/busybox b/hooks/busybox new file mode 100755 index 0000000..7845f58 --- /dev/null +++ b/hooks/busybox @@ -0,0 +1,31 @@ +#!/bin/sh + +PREREQ="" + +prereqs() +{ + echo "$PREREQ" +} + +case $1 in +# get pre-requisites +prereqs) + prereqs + exit 0 + ;; +esac + +# busybox +if [ "${BUSYBOX}" = "n" ] || [ ! -e ${BUSYBOXDIR}/busybox ]; then + # those root need busybox + eval "$(mount | awk '/ \/ / {print "r_dev=" $1; exit}')" + if [ "${r_dev#/dev/mapper/}" != "${r_dev}" ]; then + echo "Warning: Busybox is required for successful boot!" + fi +else + . /usr/share/initramfs-tools/hook-functions + rm -f ${DESTDIR}/bin/sh + rm -f ${DESTDIR}/bin/busybox + copy_exec ${BUSYBOXDIR}/busybox /bin/busybox + ln -s ${BUSYBOXDIR}/busybox ${DESTDIR}/bin/sh +fi diff --git a/hooks/klibc b/hooks/klibc index c6bb75e..56f49ef 100755 --- a/hooks/klibc +++ b/hooks/klibc @@ -19,3 +19,6 @@ esac ln -s /usr/lib/klibc/bin/* ${DESTDIR}/bin ln -s /lib/klibc-*.so ${DESTDIR}/lib rm -f ${DESTDIR}/bin/kinit* ${DESTDIR}/bin/gzip ${DESTDIR}/bin/zcat ${DESTDIR}/bin/gunzip +if [ "${BUSYBOX}" = "n" ] || [ ! -e ${BUSYBOXDIR}/busybox ]; then + mv ${DESTDIR}/bin/sh.shared ${DESTDIR}/bin/sh +fi diff --git a/mkinitramfs b/mkinitramfs index 11f44f8..f4f122c 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -9,7 +9,7 @@ CONFDIR="/etc/initramfs-tools" verbose="n" errors_to="2>/dev/null" # BUSYBOXDIR="/usr/lib/initramfs-tools/bin/" -BUSYBOXDIR="/bin" +export BUSYBOXDIR="/bin" OPTIONS=`getopt -o d:ko:r:v -n "$0" -- "$@"` @@ -153,6 +153,7 @@ export DPKG_ARCH export verbose export KEYMAP export MODULES +export BUSYBOX # Private, used by 'catenate_cpiogz'. export __TMPCPIOGZ @@ -231,21 +232,6 @@ if [ -n "${ROOT}" ]; then echo "ROOT=${ROOT}" > ${DESTDIR}/conf/conf.d/root fi -# Busybox -if [ "${BUSYBOX}" = "n" ] || [ ! -e ${BUSYBOXDIR}/busybox ]; then - mv ${DESTDIR}/bin/sh.shared ${DESTDIR}/bin/sh - # those root need busybox - eval "$(mount | awk '/ \/ / {print "r_dev=" $1; exit}')" - if [ "${r_dev#/dev/mapper/}" != "${r_dev}" ]; then - echo "Warning: Busybox is required for successful boot!" - fi -else - rm -f ${DESTDIR}/bin/sh - rm -f ${DESTDIR}/bin/busybox - copy_exec ${BUSYBOXDIR}/busybox /bin/busybox - ln -s ${BUSYBOXDIR}/busybox ${DESTDIR}/bin/sh -fi - # Modutils copy_exec /sbin/modprobe /sbin copy_exec /sbin/depmod /sbin |