Added chrooted function

This commit is contained in:
Tobias Schmidl 2019-07-24 13:49:49 +02:00
parent b5bc7350fe
commit 11dbc8071b

View file

@ -18,6 +18,18 @@ function mkcdir () {
cd -P -- "$1"
}
function chrooted() {
ROOT_MP="$(awk '$5=="/" {print $1}' </proc/1/mountinfo)"
SHELL_MP="$(awk '$5=="/" {print $1}' </proc/$$/mountinfo)"
if [ "$ROOT_MP" -eq "$SHELL_MP" ];
then
echo "We are not chrooted."
else
echo "We are chrooted."
fi
return $(test "$ROOT_MP" -eq "$SHELL_MP")
}
if [ -x "$(which lsb_release)" ];
then
current_dist=`lsb_release -c -s`