linux-ibeacon
linux-ibeacon copied to clipboard
Fix 'run with sudo' check to check euid as well as sudo environment variable
At present, the check_for_sudo function checks for the presence of an environment
variable to see if the command was run with sudo, and therefore has the correct
permissions to interact with the bluetooth device. This does not work in cases
where the script is invoked directly, for example from a systemd unit or init script
This patch extends check_for_sudo to examine the effective uid to see if it is '0'
(root) if the environment variable is not found