From: kremlin Date: Sat, 11 Feb 2017 05:06:03 +0000 (-0600) Subject: install.sh: add overwrite safeguard + overwrite flag X-Git-Url: https://uglyman.kremlin.cc/gitweb/gitweb.cgi?a=commitdiff_plain;h=d1b824e31c7dcfa000ad9da9604d4b26e4c6f249;p=bbb-usb.git install.sh: add overwrite safeguard + overwrite flag --- diff --git a/misc/install.sh b/misc/install.sh index 859f38e..a36aecb 100755 --- a/misc/install.sh +++ b/misc/install.sh @@ -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