Remove deprecated install script
This commit is contained in:
parent
3354fe93dd
commit
b097123884
82
install
82
install
@ -1,82 +0,0 @@
|
||||
#!/bin/bash
|
||||
# prefer running as root
|
||||
DIR=$(dirname $0)
|
||||
PROGRAM=/usr/local/bin/comfortable-swipe
|
||||
COMPILE=$DIR/comfortable-swipe.compile.sh
|
||||
CONF_PATH=/usr/local/share/comfortable-swipe/comfortable-swipe.conf
|
||||
DCONF_PATH=$DIR/defaults.conf
|
||||
OLD_CONF_PATH=${XDG_CONFIG_HOME:-$HOME/.config}/comfortable-swipe.conf
|
||||
|
||||
if [ -x "$(command -v $PROGRAM)" ]; then
|
||||
# stop any running comfortable-swipe if it exists
|
||||
$PROGRAM stop
|
||||
fi
|
||||
|
||||
#copy config file
|
||||
abort () {
|
||||
exec echo "Installation aborted"
|
||||
}
|
||||
sudo mkdir -p $(dirname $CONF_PATH) || abort
|
||||
|
||||
# check if "-y" or "--yes" is passed as an argument
|
||||
YES=false
|
||||
while test $# -gt 0
|
||||
do
|
||||
case "$1" in
|
||||
-y) YES=true
|
||||
;;
|
||||
--yes) YES=true
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
sudo chown $USER $(dirname $CONF_PATH)
|
||||
if [ ! -f $CONF_PATH ]; then
|
||||
if [ ! -f $OLD_CONF_PATH ]; then
|
||||
# old config file not found, create from scratch
|
||||
cat $DCONF_PATH > $CONF_PATH || abort
|
||||
else
|
||||
# old config file found, move to the new path
|
||||
cat $OLD_CONF_PATH > $CONF_PATH || abort
|
||||
echo "Configuration copied from $OLD_CONF_PATH to $CONF_PATH"
|
||||
fi
|
||||
else
|
||||
# config file found, ask user if overwrite
|
||||
echo "Old conf file found in $CONF_PATH"
|
||||
if [ $YES == false ]; then
|
||||
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 || abort
|
||||
else
|
||||
abort
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Installing..."
|
||||
|
||||
# remove existing comfortable-swipe
|
||||
if [ -x "$(command -v $PROGRAM)" ]; then
|
||||
sudo rm -f $(which comfortable-swipe)
|
||||
fi
|
||||
|
||||
# compile library
|
||||
sudo $COMPILE $PROGRAM || abort
|
||||
|
||||
# add permissions to input group (defer)
|
||||
# GROUP=$(ls -l /dev/input/event* | awk '{print $4}' | head --line=1) || abort
|
||||
|
||||
# toggle autostart twice to refresh any changes
|
||||
$PROGRAM autostart > /dev/null || abort
|
||||
$PROGRAM autostart > /dev/null || abort
|
||||
|
||||
echo "Successfully installed comfortable-swipe."
|
||||
echo "Configuration file is located at $CONF_PATH"
|
||||
echo ""
|
||||
echo "Try running 'comfortable-swipe start' to test."
|
||||
Loading…
Reference in New Issue
Block a user