Bug#433190: inhibit /etc/initramfs-tools/conf.d/resume creation in chroot
Package: initramfs-tools
Version: 0.89
Severity: wishlist
Tags: patch
Hi maks,
When installing initramfs-tools in a chroot, I'd like to propose
that /etc/initramfs-tools/conf.d/resume not be created.
debian-live and other custom debian distributions build their system up in a
chroot environment, therefore it is not good for the resulting
initramfs-tools generated initial ramdisk to be configured for the system
that hosted the original chroot.
Plus, who can use suspend in a chroot environment? ;-)
Patch is attached. chrooted() function borrowed from udev's postinst.
Thanks, Kel.
diff -Nrup initramfs-tools-0.89/debian/initramfs-tools.preinst initramfs-tools-0.89-patched/debian/initramfs-tools.preinst
--- initramfs-tools-0.89/debian/initramfs-tools.preinst 2007-05-29 08:00:39.000000000 +1000
+++ initramfs-tools-0.89-patched/debian/initramfs-tools.preinst 2007-07-15 18:47:16.000000000 +1000
@@ -2,6 +2,16 @@
set -e
+chrooted() {
+ # borrowed from udev's postinst
+ if [ "$(stat -c %d/%i /)" = "$(stat -Lc %d/%i /proc/1/root 2>/dev/null)" ]; then
+ # the devicenumber/inode pair of / is the same as that of /sbin/init's
+ # root, so we're *not* in a chroot and hence return false.
+ return 1
+ fi
+ return 0
+}
+
case "$1" in
install)
mkdir -p /etc/initramfs-tools/conf.d
@@ -15,7 +25,8 @@ case "$1" in
if [ -e /etc/mkinitrd/mkinitrd.conf ]; then
. /etc/mkinitrd/mkinitrd.conf
fi
- if [ -n "${RESUME}" ]; then
+ # write conf.d/resume if not in a chroot
+ if [ -n "${RESUME}" ] && ! chrooted; then
echo "RESUME=${RESUME}" > /etc/initramfs-tools/conf.d/resume
fi
Reply to: