summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCorentin LABBE <clabbe@baylibre.com>2018-01-08 14:30:24 +0100
committerCorentin LABBE <clabbe@baylibre.com>2018-01-08 15:15:50 +0100
commit633d0339534944b22c95e58dd069b76fb9dfcd44 (patch)
treeb5bf097bc8123a09a1ce0c736ddd144bf065a554
parent34c6269457b8075f2951c37ca2a1901bd71379ea (diff)
Some actions need root privileges
Some actions must be done by root, add a detection for that.
-rwxr-xr-xlavalab-gen.sh11
1 files changed, 9 insertions, 2 deletions
diff --git a/lavalab-gen.sh b/lavalab-gen.sh
index 06df881..31b45f8 100755
--- a/lavalab-gen.sh
+++ b/lavalab-gen.sh
@@ -13,8 +13,15 @@ fi
./lavalab-gen.py || exit 1
-rm /etc/udev/rules.d/lavalab*rules
-cp lavalab*rules /etc/udev/rules.d/
+#check for root
+BEROOT=""
+if [ $(id -u) -ne 0 ];then
+ BEROOT="sudo "
+fi
+$BEROOT rm /etc/udev/rules.d/*lavalab*rules
+$BEROOT cp *lavalab*rules /etc/udev/rules.d/
+$BEROOT udevadm control --reload-rules || exit $?
+$BEROOT udevadm trigger || exit $?
docker-compose build || exit 1
docker-compose up || exit 1