#!/usr/bin/env bash # - Test if script is running in a chrooted environment # - # - !! Script MUST run with root privileges!! # - if [ "$(id -u)" != "0" ]; then echo -e "\n\tThis script must be run as root.\n" 1>&2 exit 1 fi if [[ "$(stat -c %d:%i /)" = "$(stat -c %d:%i /proc/1/root/.)" ]]; then echo -e "\n\tRunning NOT in a chrooted environment.\n" else echo -e "\n\tRunning in a chrooted environment.\n" fi