From 5abe486c0de68a413fa275f587d6c439bc89aad1 Mon Sep 17 00:00:00 2001 From: fherrero <fherrero@iri.upc.edu> Date: Wed, 2 Oct 2019 16:15:40 +0200 Subject: [PATCH] Fix empty SUDO_USER variable bug --- scripts/debian/postinst | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/scripts/debian/postinst b/scripts/debian/postinst index edcb12d..7a56aa5 100755 --- a/scripts/debian/postinst +++ b/scripts/debian/postinst @@ -6,11 +6,14 @@ case "$1" in configure) #echo " Calling script" #/var/lib/dpkg/info/iri-comm-dev.hello_world - echo " Addind user to dialout group..." - sudo usermod -a -G dialout $SUDO_USER - echo " Done." - echo " Adding 99-iri-comm-ftdi udev rule..." + if [ ! -z "$SUDO_USER" ]; then + echo " Addind user to dialout group..." + sudo usermod -a -G dialout $SUDO_USER + echo " Done." + fi + + echo " Adding 99-iri-comm-ftdi udev rule..." FILE="/lib/udev/rules.d/99-iri-comm-ftdi.rules" LINE0="#The following line allow the users on dialout to access SUBSYSTEM:VENDOR:PRODUCT=usb|usb_device:0403:6001 devices" LINE1="SUBSYSTEM==\"usb|usb_device\", ATTRS{idVendor}==\"0403\", ATTRS{idProduct}==\"6001\", GROUP=\"dialout\"" -- GitLab