install.sh: add overwrite safeguard + overwrite flag
authorkremlin <ian@kremlin.cc>
Sat, 11 Feb 2017 05:06:03 +0000 (23:06 -0600)
committerkremlin <ian@kremlin.cc>
Sat, 11 Feb 2017 05:06:03 +0000 (23:06 -0600)
misc/install.sh

index 859f38ed398dba97144c9b16596d8ee3eb926ad2..a36aecb9e260b46346f06b75368ba25b2dcb1bec 100755 (executable)
@@ -1,4 +1,20 @@
 #!/bin/ksh
 
+EUID=`id -g`
+if [[ $EUID -ne 0 ]]; then
+       echo "run me as root!"
+       exit 1
+fi
+
+set -e
+
 cd $(dirname "$0")/..
+cp misc/armmake /usr/local/bin/armmake
+chmod +x /usr/local/bin/armmake
+
+if [[ -a /sys/arch/armv7/omap/ammusb.c && $1 != "-f" ]]; then
+       echo "file already exists! pass -f to overwrite"
+       exit 1
+fi
+
 cp -R src/* /usr/src