From f24c1f6f2d5cd374f45ca4ca7be1e9b577a0b59b Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Fri, 21 Oct 2016 13:56:13 +0100 Subject: [PATCH] Check if running as root --- src/freedombone-utils-setup | 8 ++++++++ src/freedombone-utils-wifi | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/src/freedombone-utils-setup b/src/freedombone-utils-setup index 5b935a66..38332182 100755 --- a/src/freedombone-utils-setup +++ b/src/freedombone-utils-setup @@ -81,6 +81,14 @@ CHECK_MESSAGE="Check your internet connection, /etc/network/interfaces and /etc/ # Default diffie-hellman key length in bits DH_KEYLENGTH=2048 +function running_as_root { + if [[ $EUID != 0 ]] ; then + echo "0" + else + echo "1" + fi +} + function initial_setup { if [[ $(is_completed $FUNCNAME) == "1" ]]; then return diff --git a/src/freedombone-utils-wifi b/src/freedombone-utils-wifi index 3ef55296..e51b6797 100755 --- a/src/freedombone-utils-wifi +++ b/src/freedombone-utils-wifi @@ -40,6 +40,10 @@ WIFI_NETWORKS_FILE=~/${PROJECT_NAME}-wifi.cfg ATHEROS_WIFI_REPO="https://github.com/qca/open-ath9k-htc-firmware.git" function setup_wifi_atheros { + if [[ $(running_as_root) == "0" ]]; then + return + fi + atheros_drivers_file=drivers/ath9k_htc_driver_bbb.tar.gz if [ ! -f $atheros_drivers_file ]; then if [ ! -f ~/freedombone/$atheros_drivers_file ]; then