Quellcode durchsuchen

Check if running as root

Bob Mottram vor 8 Jahren
Ursprung
Commit
f24c1f6f2d
2 geänderte Dateien mit 12 neuen und 0 gelöschten Zeilen
  1. 8
    0
      src/freedombone-utils-setup
  2. 4
    0
      src/freedombone-utils-wifi

+ 8
- 0
src/freedombone-utils-setup Datei anzeigen

@@ -81,6 +81,14 @@ CHECK_MESSAGE="Check your internet connection, /etc/network/interfaces and /etc/
81 81
 # Default diffie-hellman key length in bits
82 82
 DH_KEYLENGTH=2048
83 83
 
84
+function running_as_root {
85
+    if [[ $EUID != 0 ]] ; then
86
+        echo "0"
87
+    else
88
+        echo "1"
89
+    fi
90
+}
91
+
84 92
 function initial_setup {
85 93
     if [[ $(is_completed $FUNCNAME) == "1" ]]; then
86 94
         return

+ 4
- 0
src/freedombone-utils-wifi Datei anzeigen

@@ -40,6 +40,10 @@ WIFI_NETWORKS_FILE=~/${PROJECT_NAME}-wifi.cfg
40 40
 ATHEROS_WIFI_REPO="https://github.com/qca/open-ath9k-htc-firmware.git"
41 41
 
42 42
 function setup_wifi_atheros {
43
+    if [[ $(running_as_root) == "0" ]]; then
44
+        return
45
+    fi
46
+
43 47
     atheros_drivers_file=drivers/ath9k_htc_driver_bbb.tar.gz
44 48
     if [ ! -f $atheros_drivers_file ]; then
45 49
         if [ ! -f ~/freedombone/$atheros_drivers_file ]; then