Initial commit
This commit is contained in:
19
snippets/is_chrooted.sh
Executable file
19
snippets/is_chrooted.sh
Executable file
@@ -0,0 +1,19 @@
|
||||
#!/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
|
||||
|
||||
Reference in New Issue
Block a user