From 470d183067dac8bb7682bc90a89c5676c0d8aa21 Mon Sep 17 00:00:00 2001 From: LaMont Jones Date: Fri, 21 Sep 2007 13:23:55 -0600 Subject: [PATCH] mount.preinst: chroot-check was broken. Closes: #443466 --- debian/mount.preinst | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) 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="" -- 2.39.5