diff -Nru klibc-2.0.4/debian/changelog klibc-2.0.4/debian/changelog --- klibc-2.0.4/debian/changelog 2016-01-18 17:02:18.000000000 +0000 +++ klibc-2.0.4/debian/changelog 2016-02-10 23:33:56.000000000 +0000 @@ -1,3 +1,11 @@ +klibc (2.0.4-8) unstable; urgency=medium + + * run-init: Update documentation comment to cover -n option + * Add initramfs-tools hook script, in preparation for dropping it from + the initramfs-tools-core package + + -- Ben Hutchings Wed, 10 Feb 2016 23:33:55 +0000 + klibc (2.0.4-7) unstable; urgency=medium * Drop "revert upstream nuked insmod", as nothing needs it any more diff -Nru klibc-2.0.4/debian/initramfs-tools/hooks/klibc-utils klibc-2.0.4/debian/initramfs-tools/hooks/klibc-utils --- klibc-2.0.4/debian/initramfs-tools/hooks/klibc-utils 1970-01-01 00:00:00.000000000 +0000 +++ klibc-2.0.4/debian/initramfs-tools/hooks/klibc-utils 2016-01-26 02:08:39.000000000 +0000 @@ -0,0 +1,33 @@ +#!/bin/sh + +PREREQ="" + +prereqs() +{ + echo "$PREREQ" +} + +case $1 in +# get pre-requisites +prereqs) + prereqs + exit 0 + ;; +esac + +# klibc +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" ] || [ -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 + elif [ -e /usr/lib/klibc/bin/sh ]; then + # Others build a static version instead: + cp -pL /usr/lib/klibc/bin/sh ${DESTDIR}/bin/sh + fi +else + # Nobody wanted it, so save a tiny bit of space: + rm -f ${DESTDIR}/bin/sh.shared +fi diff -Nru klibc-2.0.4/debian/klibc-utils.install klibc-2.0.4/debian/klibc-utils.install --- klibc-2.0.4/debian/klibc-utils.install 2016-01-06 04:04:59.000000000 +0000 +++ klibc-2.0.4/debian/klibc-utils.install 2016-02-10 23:32:48.000000000 +0000 @@ -1 +1,2 @@ debian/tmp/usr/lib/klibc/bin/* +debian/initramfs-tools/hooks/klibc-utils /usr/share/initramfs-tools/hooks/ diff -Nru klibc-2.0.4/debian/klibc-utils.postrm klibc-2.0.4/debian/klibc-utils.postrm --- klibc-2.0.4/debian/klibc-utils.postrm 1970-01-01 00:00:00.000000000 +0000 +++ klibc-2.0.4/debian/klibc-utils.postrm 2016-02-10 23:18:08.000000000 +0000 @@ -0,0 +1,12 @@ +#!/bin/sh -e + +if [ "$1" = remove ] || [ "$1" = abort-install ] || [ "$1" = disappear ] || \ + { { [ "$1" = abort-upgrade ] || [ "$1" = upgrade ]; } && \ + dpkg --compare-versions "$2" lt 2.0.4-8~; }; then + # Restore the klibc hook installed by older versions of initramfs-tools + dpkg-divert --package klibc-utils --remove --rename \ + --divert /usr/share/initramfs-tools/hooks/klibc^i-t \ + /usr/share/initramfs-tools/hooks/klibc +fi + +#DEBHELPER# diff -Nru klibc-2.0.4/debian/klibc-utils.preinst klibc-2.0.4/debian/klibc-utils.preinst --- klibc-2.0.4/debian/klibc-utils.preinst 1970-01-01 00:00:00.000000000 +0000 +++ klibc-2.0.4/debian/klibc-utils.preinst 2016-01-26 03:01:38.000000000 +0000 @@ -0,0 +1,10 @@ +#!/bin/sh -e + +if [ "$1" != upgrade ] || dpkg --compare-versions "$2" lt 2.0.4-8~; then + # Disable the klibc hook installed by older versions of initramfs-tools + dpkg-divert --package klibc-utils --add --rename \ + --divert /usr/share/initramfs-tools/hooks/klibc^i-t \ + /usr/share/initramfs-tools/hooks/klibc +fi + +#DEBHELPER# diff -Nru klibc-2.0.4/debian/patches/run-init-add-dry-run-mode.patch klibc-2.0.4/debian/patches/run-init-add-dry-run-mode.patch --- klibc-2.0.4/debian/patches/run-init-add-dry-run-mode.patch 2016-01-17 20:20:25.000000000 +0000 +++ klibc-2.0.4/debian/patches/run-init-add-dry-run-mode.patch 2016-01-19 15:07:22.000000000 +0000 @@ -15,15 +15,38 @@ --- --- a/usr/kinit/run-init/run-init.c +++ b/usr/kinit/run-init/run-init.c -@@ -39,6 +39,7 @@ - * - Spawns the specified init program (with arguments.) +@@ -26,19 +26,23 @@ + * ----------------------------------------------------------------------- */ + + /* +- * Usage: exec run-init [-d caps] [-c /dev/console] /real-root /sbin/init "$@" ++ * Usage: exec run-init [-d caps] [-c /dev/console] [-n] /real-root /sbin/init "$@" + * + * This program should be called as the last thing in a shell script + * acting as /init in an initramfs; it does the following: + * +- * - Delete all files in the initramfs; +- * - Remounts /real-root onto the root filesystem; +- * - Drops comma-separated list of capabilities; +- * - Chroots; +- * - Opens /dev/console; +- * - Spawns the specified init program (with arguments.) ++ * 1. Delete all files in the initramfs; ++ * 2. Remounts /real-root onto the root filesystem; ++ * 3. Drops comma-separated list of capabilities; ++ * 4. Chroots; ++ * 5. Opens /dev/console; ++ * 6. Spawns the specified init program (with arguments.) ++ * ++ * With the -n option, it skips steps 1, 2 and 6 and can be used to check ++ * whether the given root and init are likely to work. */ +#include #include #include #include -@@ -51,7 +52,7 @@ static const char *program; +@@ -51,7 +55,7 @@ static const char *program; static void __attribute__ ((noreturn)) usage(void) { fprintf(stderr, @@ -32,7 +55,7 @@ program); exit(1); } -@@ -64,6 +65,7 @@ int main(int argc, char *argv[]) +@@ -64,6 +68,7 @@ int main(int argc, char *argv[]) const char *init; const char *error; const char *drop_caps = NULL; @@ -40,7 +63,7 @@ char **initargs; /* Variables... */ -@@ -72,11 +74,13 @@ int main(int argc, char *argv[]) +@@ -72,11 +77,13 @@ int main(int argc, char *argv[]) /* Parse the command line */ program = argv[0]; @@ -55,7 +78,7 @@ } else { usage(); } -@@ -89,9 +93,13 @@ int main(int argc, char *argv[]) +@@ -89,9 +96,13 @@ int main(int argc, char *argv[]) init = argv[optind + 1]; initargs = argv + optind + 1;