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
This commit is contained in:
maximilian attems 2007-09-04 11:35:32 +02:00
parent 5ac8a35ffa
commit 803cf67dab
2 changed files with 21 additions and 3 deletions

3
debian/changelog vendored
View File

@ -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

View File

@ -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