dburr / linux-ibeacon

Python script that creates an iBeacon-compatible Bluetooth LE beacon using Linux and a Bluetooth LE adapter
BSD 3-Clause "New" or "Revised" License
162 stars 48 forks source link

must run with sudo? running as root should also work #5

Open apgodshall opened 5 years ago

apgodshall commented 5 years ago

Please apply this:

$ git diff
diff --git a/ibeacon b/ibeacon
index 5f5da1a..5cf7a05 100755
--- a/ibeacon
+++ b/ibeacon
@@ -74,6 +74,9 @@ def process_command(c):
 def check_for_sudo():
   if 'SUDO_UID' in os.environ.keys():
     return 1
+  if 'USER' in os.environ.keys():
+    if os.environ['USER'] == 'root':
+      return 1
   else:
     print "Error: this script requires superuser privileges.  Please re-run with `sudo.'"
     return 0
wysman commented 4 years ago

+1