39 lines
915 B
Bash
39 lines
915 B
Bash
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
function trysudo {
|
|
$@ 2> /dev/null || sudo $@
|
|
}
|
|
|
|
function uninstall {
|
|
TARGET="${1?missing uninstall parameter}"
|
|
if [[ -f "$TARGET" ]]; then
|
|
trysudo rm -f "$TARGET"
|
|
echo "Removed: $TARGET"
|
|
elif [[ ! -z "$TARGET" ]]; then
|
|
echo "Not found: $TARGET"
|
|
fi
|
|
}
|
|
|
|
# stop program first if it is still running
|
|
comfortable-swipe stop 2> /dev/null || true
|
|
|
|
# uninstall binaries
|
|
uninstall "$(which comfortable-swipe || echo /usr/share/bin/comfortable-swipe)"
|
|
uninstall "$(which comfortable-swipe-buffer || echo /usr/share/bin/comfortable-swipe-buffer)"
|
|
|
|
# uninstall desktop file
|
|
uninstall "$HOME/.config/autostart/comfortable-swipe.desktop"
|
|
|
|
# tell user we are keeping configuration file
|
|
CONF_TARGET="$HOME/.config/comfortable-swipe.conf"
|
|
if [ -f "$CONF_TARGET" ]; then
|
|
echo "Keeping your configuration file: $CONF_TARGET"
|
|
fi
|
|
|
|
cat <<EOF
|
|
|
|
Successfully uninstalled comfortable-swipe
|
|
EOF
|