diff --git a/README.md b/README.md index badace7..fd3db2b 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ A minimal Gtk+ GUI app for libinput-gestures Use: -- `sudo ./install.sh` to install in /opt/gestures +- `./make.sh; sudo ./install.sh` to install in /usr/local/bin. An alternative path for the binary can be specified as parameter to `install.sh` ## Video demo: diff --git a/install.sh b/install.sh index d5ff922..4417af1 100755 --- a/install.sh +++ b/install.sh @@ -1,7 +1,20 @@ -./make.sh +if ! [ $(id -u) = 0 ]; then + echo "This script must be run as root!" + exit -1 +fi -mkdir /opt/gestures -cp ./build/gestures /opt/gestures/ -sed -e 's/\/usr\/bin/\/opt\/gestures/g' -i ./build/org.cunidev.gestures.desktop +INSTALL="/usr/local/bin" + +if [ -z "$1" ] +then + echo "Notice: Using default install path ($INSTALL)" +else + INSTALL=$1 +fi + +cp ./build/gestures $INSTALL/gestures +sed -e 's~/usr/bin~$INSTALL~g' -i ./build/org.cunidev.gestures.desktop cp ./build/org.cunidev.gestures.desktop /usr/share/applications/ cp ./data/org.cunidev.gestures.svg /usr/share/icons/hicolor/scalable/apps + +echo "Installed to $INSTALL/gestures!" diff --git a/make.sh b/make.sh index de2f242..8c7a5fb 100755 --- a/make.sh +++ b/make.sh @@ -1,6 +1,5 @@ -if [[ $EUID = 0 ]]; then +if [ $(id -u) = 0 ]; then echo "Warning: This script shouldn't be run as root!" - echo fi rm -rf build