diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2016-10-27 14:00:18 -0200 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2016-10-27 14:00:18 -0200 |
commit | 601eb9c3e9bd140745d62e9931bb5c2a8be85724 (patch) | |
tree | eb2c275dba36208753097372ccbbb20eb2d1e761 /share/hydractl | |
parent | 536c33213619751b41519049ac2d12a29ab553ff (diff) | |
download | hydra-601eb9c3e9bd140745d62e9931bb5c2a8be85724.tar.gz hydra-601eb9c3e9bd140745d62e9931bb5c2a8be85724.tar.bz2 |
Usb: sudo config
Diffstat (limited to 'share/hydractl')
-rwxr-xr-x | share/hydractl/usb-disable | 9 |
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 } |