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 /update-initramfs | |
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
Diffstat (limited to 'update-initramfs')
-rwxr-xr-x | update-initramfs | 21 |
1 files changed, 19 insertions, 2 deletions
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 |