From: LaMont Jones Date: Fri, 21 Sep 2007 19:23:55 +0000 (-0600) Subject: mount.preinst: chroot-check was broken. Closes: #443466 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=470d183067dac8bb7682bc90a89c5676c0d8aa21;p=util-linux mount.preinst: chroot-check was broken. Closes: #443466 --- diff --git a/debian/mount.preinst b/debian/mount.preinst index 9e613f13..a0dd43cf 100644 --- a/debian/mount.preinst +++ b/debian/mount.preinst @@ -3,25 +3,25 @@ # Debian mount preinst # LaMont Jones -### do we have debconf? -##if [ -f /usr/share/debconf/confmodule ]; then -## . /usr/share/debconf/confmodule -## DEBCONF=true -##else -## DEBCONF= -##fi - -DISTRO=$(lsb_release -is 2>/dev/null || echo Debian); +chrooted() { + 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) ;; upgrade) version=$2 - export LANG=C # for the comparison of mail version... + DISTRO=$(lsb_release -is 2>/dev/null || echo Debian); if [ Debian = "$DISTRO" ]; then - if [ -f /var/lib/dpkg/info/nfs-common.list ] && [ -f /proc/mounts ]; then + if [ -f /proc/mounts ] && ! chrooted; then NFS_IN_USE=$(sed -n '/^[^ ]* [^ ]* nfs /p' /proc/mounts) else NFS_IN_USE=""