mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 04:07:35 +00:00
Meta: Add exit_if_running_as_root() to shell_include.sh
This adds the method exit_if_running_as_root() which checks if the script is executed under root, and if that's the case exits the script.
This commit is contained in:
parent
f2f14ad9bd
commit
b4a0fee03d
1 changed files with 6 additions and 0 deletions
|
@ -17,6 +17,12 @@ die() {
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
exit_if_running_as_root() {
|
||||||
|
if [ "$(id -u)" -eq 0 ]; then
|
||||||
|
die "$*"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
find_executable() {
|
find_executable() {
|
||||||
paths=("/usr/sbin" "/sbin")
|
paths=("/usr/sbin" "/sbin")
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue