Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Francis <francis@sugarlabs.org>2013-01-24 01:12:30 (GMT)
committer Daniel Francis <francis@sugarlabs.org>2013-01-24 01:12:30 (GMT)
commit107ec296ca35c9f44e676e2d0d8eaf880f230987 (patch)
treecde367512c38fb6232b1a07e8c0f0c2df7e73443
parent04fad2963b171a07e9debf8db2002ebd0d177cf7 (diff)
Check if running as root
Signed-off-by: Daniel Francis <francis@sugarlabs.org>
-rwxr-xr-xenv.sh19
1 files changed, 15 insertions, 4 deletions
diff --git a/env.sh b/env.sh
index 62e66ea..30851a0 100755
--- a/env.sh
+++ b/env.sh
@@ -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