Эх сурвалжийг харах

Enforce running the script with root rights

Matthias Vogelgesang 8 жил өмнө
parent
commit
860be8183d
1 өөрчлөгдсөн 5 нэмэгдсэн , 0 устгасан
  1. 5 0
      reload.sh

+ 5 - 0
reload.sh

@@ -1,5 +1,10 @@
 #! /bin/bash
 
+if [ $(id -u) != "0" ]; then
+    sudo "$0" "$@"
+    exit $?
+fi
+
 device=`lspci -vv | grep -m 1 Xilinx | awk '{print $1}'`
 if [ -z "$device" ]; then
     echo "Xilinx device doesn't exist, rescanning..."