diff options
author | Remko van der Vossen | 2018-11-01 02:27:55 +0100 |
---|---|---|
committer | Remko van der Vossen | 2018-11-02 08:33:27 +0100 |
commit | 577be8dad91bc56d22140004cb44ce051dfd6dd1 (patch) | |
tree | 43d85d5f04959607f2b2946d9d6f91151210e60f /chroot.function | |
parent | 8f4734f932e2db98866e8e0379c3aa5c19ea985d (diff) |
eudev: only check kernel config when not in a chroot
Diffstat (limited to 'chroot.function')
-rw-r--r-- | chroot.function | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/chroot.function b/chroot.function new file mode 100644 index 0000000000..5ebb93ed20 --- /dev/null +++ b/chroot.function @@ -0,0 +1,18 @@ +#--------------------------------------------------------------------- +## @Synopsis Set of functions for handling chroots +## +## @Copyright Source Mage Team +#--------------------------------------------------------------------- + +#--------------------------------------------------------------------- +## Determine whether the current environment is a chroot or not. +## +## Limitation; the chroot will not be detected if the chroot is using +## "/" as a mountpoint or if pid 1 itself is the chroot. +## +## @return 0 if the current environment is a chroot +## @return 1 if the current environment is not a chroot +#--------------------------------------------------------------------- +function is_chroot() { + [[ "$(stat -c %d:%i /)" != "$(stat -c %d:%i /proc/1/root/.)" ]] +} |