#!/bin/bash DIR=$(dirname $0) #copy config file mkdir -p ~/.config DCONF_PATH=$DIR/src/defaults.conf CONF_PATH=~/.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 ~/.local/bin/comfortable-swipe || exec echo "Installation aborted" echo "Successfully installed. You may now run 'comfortable-swipe start'."