[linux] 02/02: linux-image: prerm: Use ischroot to detect running in a chroot

debian-kernel at lists.debian.org debian-kernel at lists.debian.org
Sat Jun 4 17:18:46 UTC 2016


This is an automated email from the git hooks/post-receive script.

benh pushed a commit to branch benh/new-maint-scripts
in repository linux.

commit b489157e982c523c6b72ef13ecf37ffb19326235
Author: Ben Hutchings <ben at decadent.org.uk>
Date:   Sat Jun 4 18:15:33 2016 +0100

    linux-image: prerm: Use ischroot to detect running in a chroot
    
    Aurelien Jarno and Santiago Vila pointed out the ischroot command
    which is in an essential package - so we can use it without adding
    a dependency.
---
 debian/templates/image.prerm.in | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/debian/templates/image.prerm.in b/debian/templates/image.prerm.in
index 39cd59e..e020336 100755
--- a/debian/templates/image.prerm.in
+++ b/debian/templates/image.prerm.in
@@ -15,13 +15,8 @@ in_container() {
     grep -qz '^container=' /proc/1/environ
 }
 
-# Are we in in a chroot?  Compare root device and inode numbers with pid 1.
-in_chroot() {
-    test "$(stat -L -c %d:%i /)" != "$(stat -L -c %d:%i /proc/1/root)"
-}
-
 # Check to see if we are trying to remove a running kernel.
-if ! in_container && ! in_chroot && [ "$(uname -r)" = $version ]; then
+if ! in_container && ! ischroot && [ "$(uname -r)" = $version ]; then
     # If we can ask debconf questions, ask whether that's intended
     # and abort if not.
     if [ "$DEBIAN_FRONTEND" = noninteractive ]; then

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/kernel/linux.git



More information about the Kernel-svn-changes mailing list