diff options
Diffstat (limited to 'src/prokit.sh')
-rw-r--r-- | src/prokit.sh | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/prokit.sh b/src/prokit.sh index b87d1ef..91e76c8 100644 --- a/src/prokit.sh +++ b/src/prokit.sh @@ -83,6 +83,7 @@ main() else cmd="${1}" shift + check_uid || error 1 "$(get_msg 'uid_0_req')" fi run_cmd "${cmd}" "${@}" @@ -90,4 +91,23 @@ main() return ${?} } +check_uid() +{ + local uname_s= + local uid= + + uname_s="$( (uname -s) 2>/dev/null)" || uname_s='unknown' + uid="$(id -u)" + + case "${uname_s}" in + 'Linux') + if [ ${uid} -ne 0 ]; then + return 1 + fi + ;; + esac + + return 0 +} + main "${@}" |