diff options
author | maximilian attems <max@stro.at> | 2007-09-04 11:35:32 +0200 |
---|---|---|
committer | maximilian attems <max@stro.at> | 2007-09-04 11:35:32 +0200 |
commit | 803cf67dabfe32516f2ed08ba76dc9de7f9311cb (patch) | |
tree | 54ec7912e9401e6e2e5b6c855984fa393622179d | |
parent | 5ac8a35ffa7db1c1295f46c75e6b8cc7cd698546 (diff) | |
download | initramfs-tools-803cf67dabfe32516f2ed08ba76dc9de7f9311cb.tar.gz initramfs-tools-803cf67dabfe32516f2ed08ba76dc9de7f9311cb.zip |
update-initramfs: Don't check for ro /boot inside of a chroot.
debian-live may as well be build on a host with ro /boot
-rw-r--r-- | debian/changelog | 3 | ||||
-rwxr-xr-x | update-initramfs | 21 |
2 files changed, 21 insertions, 3 deletions
diff --git a/debian/changelog b/debian/changelog index f5ace4e..f479eb9 100644 --- a/debian/changelog +++ b/debian/changelog @@ -15,8 +15,9 @@ initramfs-tools (0.91) UNRELEASED; urgency=low bogus init bootarg too. * scripts/{functions,nfs}: Split networking code in separate function. Thanks Vagrant Cascadian <vagrant+debianbugs@freegeek.org> for the patch. + * update-initramfs: Don't check for ro /boot inside of a chroot. - -- maximilian attems <maks@debian.org> Tue, 04 Sep 2007 10:39:07 +0200 + -- maximilian attems <maks@debian.org> Tue, 04 Sep 2007 11:34:15 +0200 initramfs-tools (0.90a) unstable; urgency=high diff --git a/update-initramfs b/update-initramfs index 774da61..a257f1c 100755 --- a/update-initramfs +++ b/update-initramfs @@ -33,6 +33,19 @@ EOF exit 1 } +# chroot check +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 +} + mild_panic() { if [ -n "${1}" ]; then @@ -86,7 +99,7 @@ backup_booted_initramfs() # first time run thus no backup [ ! -r "${initramfs_bak}" ] && return 0 - # chroot + # chroot with no /proc [ ! -r /proc/uptime ] && rm -f "${initramfs_bak}" && return 0 # no kept backup wanted @@ -248,7 +261,11 @@ delete_sha1() # ro /boot is not modified ro_boot_check() { - [ -r /proc/mounts ] || return 0 + # check irrelevant inside of a chroot + if [ ! -r /proc/mounts ] || chrooted; then + return 0 + fi + boot_opts=$(awk '/boot/{if (match($4, /ro/) && $2 == "/boot") print "ro"}' /proc/mounts) if [ -n "${boot_opts}" ]; then |