summaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
Diffstat (limited to 'share')
-rwxr-xr-xshare/hydractl/usb-disable9
1 files changed, 7 insertions, 2 deletions
diff --git a/share/hydractl/usb-disable b/share/hydractl/usb-disable
index d281f70..0ee2471 100755
--- a/share/hydractl/usb-disable
+++ b/share/hydractl/usb-disable
@@ -9,14 +9,19 @@
# Parameters
BASENAME="`basename $0`"
+# Sudo config
+if [ "`whoami`" != 'root' ]; then
+ SUDO="sudo"
+fi
+
# Set hotplug state
function usb_set_state {
echo "Applying at /sys/module/usbcore/parameters/authorized_default..."
- sudo su -c "echo $1 > /sys/module/usbcore/parameters/authorized_default"
+ $SUDO su -c "echo $1 > /sys/module/usbcore/parameters/authorized_default"
for bus in /sys/bus/usb/devices/usb*; do
echo "Applying at ${bus}/authorized_default..."
- sudo su -c "echo $1 > ${bus}/authorized_default"
+ $SUDO su -c "echo $1 > ${bus}/authorized_default"
done
}