diff options
author | Daniel Francis <francis@sugarlabs.org> | 2013-01-24 01:12:30 (GMT) |
---|---|---|
committer | Daniel Francis <francis@sugarlabs.org> | 2013-01-24 01:12:30 (GMT) |
commit | 107ec296ca35c9f44e676e2d0d8eaf880f230987 (patch) | |
tree | cde367512c38fb6232b1a07e8c0f0c2df7e73443 | |
parent | 04fad2963b171a07e9debf8db2002ebd0d177cf7 (diff) |
Check if running as root
Signed-off-by: Daniel Francis <francis@sugarlabs.org>
-rwxr-xr-x | env.sh | 19 |
1 files changed, 15 insertions, 4 deletions
@@ -17,6 +17,20 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, # MA 02110-1301, USA. +check_root () { + echo "Checking for root permissions" + if [ `whoami` != root ]; then + echo $0 ": Need to run as root. Stopping." + exit + fi + echo "[OK]" +} + +# Installation function +installenv () { + check_root + exit +} # Help message usage () { @@ -29,9 +43,6 @@ usage () { #Check for arguments case $1 in - help) - usage - ;; install) installenv ;; @@ -40,4 +51,4 @@ case $1 in ;; esac -usage() +usage |