comfortable-swipe/install
Rico Tiongson db0bce369c Update install
Just a silly error in the install script. The command that should be tested should not be `git` but `comfortable-swipe`.
2017-11-07 01:30:46 +08:00

40 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
DIR=$(dirname $0)
PROGRAM=$HOME/.local/bin/comfortable-swipe
if [ -x "$(command -v $PROGRAM)" ]; then
# stop any running comfortable-swipe if it exists
$PROGRAM stop
fi
#copy config file
mkdir -p ~/.config
DCONF_PATH=$DIR/src/defaults.conf
CONF_PATH=${XDG_CONFIG_HOME:-$HOME/.config}/comfortable-swipe.conf
if [ ! -f $CONF_PATH ]; then
cat $DCONF_PATH > $CONF_PATH
else
# config file found, ask user if overwrite
echo "Old conf file found in $CONF_PATH"
read -r -p "Keep the old conf file? (default: yes) [Y/n] " response
response=${response,,} # tolower
if [[ "$response" =~ ^(no|n)$ ]]; then
read -r -p "Conf file will be overwritten. Are you sure? [Y/n] " response
response=${response,,}
if [[ "$response" =~ ^(yes|y)$ ]]; then
cat $DCONF_PATH > $CONF_PATH
else
exec echo "Installation aborted."
fi
fi
fi
echo "Installing..."
mkdir -p ~/.local/bin
g++ -std=c++11 -O2 $DIR/src/comfortable-swipe.cpp -lxdo -o $PROGRAM || exec echo "Installation aborted"
# toggle autostart twice to refresh any changes
$PROGRAM autostart > /dev/null || exec echo "Installation aborted"
$PROGRAM autostart > /dev/null || exec echo "Installation aborted"
echo "Successfully installed. You may now run 'comfortable-swipe start'."