#--------------------------------------------------------------------- ## @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/.)" ]] }