X-Git-Url: http://git.grml.org/?a=blobdiff_plain;f=policy-rc.d;h=8ba05a4b1c23fe70005eefadd6c115b071c38020;hb=9f3776169287f4c7d7d6840ed49bf5c9e9ef3d5f;hp=3964dc57a1d954400800a75e11bce862c64a00cd;hpb=d7dd305e129fde8366289aa752583706bb8a6ad1;p=grml-policyrcd.git diff --git a/policy-rc.d b/policy-rc.d index 3964dc5..8ba05a4 100755 --- a/policy-rc.d +++ b/policy-rc.d @@ -6,10 +6,15 @@ # License: This file is licensed under the GPL v2. ################################################################################ -# test for chroot -if test "$(/usr/bin/stat -c "%d/%i" /)" != "$(/usr/bin/stat -Lc "%d/%i" /proc/1/root 2>/dev/null)" ; then - # notify invoke-rc.d that nothing should be done -- we are in a chroot - exit 101 +## test for chroot +# make sure /proc/1/root can be read, if not either /proc is not mounted +# or it is not executed with root permissions (and "sudo invoke-rc.d $service" +# might fail), if so don't continue +if [ -d /proc/1 ] && readlink -f /proc/1/root >/dev/null 2>&1; then + if test "$(/usr/bin/stat -c "%d/%i" /)" != "$(/usr/bin/stat -Lc "%d/%i" /proc/1/root 2>/dev/null)" ; then + # notify invoke-rc.d that nothing should be done -- we are in a chroot + exit 101 + fi fi # read configuration file