2026-08-09 01:22:23 -07:00
|
|
|
#!/bin/sh
|
2026-09-09 13:08:42 -07:00
|
|
|
# Remove socktop-swipe.
|
2026-08-09 01:22:23 -07:00
|
|
|
#
|
2026-09-09 13:08:42 -07:00
|
|
|
# ./uninstall.sh binary, config, udev rule, X snippets, autologin
|
|
|
|
|
# ./uninstall.sh --keep-config leave the config file alone
|
|
|
|
|
#
|
|
|
|
|
# The Rust toolchain, tmux, socktop and friends, and your 'input' group
|
|
|
|
|
# membership are all left in place: they are useful independently, and removing
|
|
|
|
|
# them could break something else. What was skipped is printed at the end.
|
2026-08-09 01:22:23 -07:00
|
|
|
set -eu
|
|
|
|
|
|
|
|
|
|
PREFIX=${PREFIX:-/usr/local}
|
2026-09-09 13:08:42 -07:00
|
|
|
BIN="$PREFIX/bin/socktop-swipe"
|
|
|
|
|
CONF_DIR="$HOME/.config/socktop-swipe"
|
|
|
|
|
CONF="$CONF_DIR/config.yaml"
|
|
|
|
|
UDEV=/etc/udev/rules.d/70-socktop-swipe.rules
|
|
|
|
|
XBLANK=/etc/X11/xorg.conf.d/10-no-blanking-socktop-swipe.conf
|
|
|
|
|
XIGNORE=/etc/X11/xorg.conf.d/99-ignore-touch-socktop-swipe.conf
|
|
|
|
|
LIGHTDM=/etc/lightdm/lightdm.conf.d/50-autologin-socktop-swipe.conf
|
|
|
|
|
UNIT="$HOME/.config/systemd/user/socktop-swipe.service"
|
2026-08-09 01:22:23 -07:00
|
|
|
|
|
|
|
|
keep_config=no
|
2026-09-09 13:08:42 -07:00
|
|
|
for a in "$@"; do
|
|
|
|
|
case "$a" in
|
|
|
|
|
--keep-config) keep_config=yes ;;
|
|
|
|
|
-h | --help) sed -n '2,10p' "$0" | sed 's/^# \{0,1\}//'; exit 0 ;;
|
|
|
|
|
*) echo "unknown option: $a" >&2; exit 2 ;;
|
|
|
|
|
esac
|
2026-08-09 01:22:23 -07:00
|
|
|
done
|
|
|
|
|
|
2026-09-09 13:08:42 -07:00
|
|
|
say() { printf '%s\n' "$*"; }
|
|
|
|
|
|
|
|
|
|
# Stop it first, so nothing is holding the touch device or the tmux session.
|
|
|
|
|
if command -v systemctl >/dev/null 2>&1 && [ -e "$UNIT" ]; then
|
|
|
|
|
systemctl --user disable --now socktop-swipe 2>/dev/null || true
|
|
|
|
|
rm -f "$UNIT"
|
|
|
|
|
systemctl --user daemon-reload 2>/dev/null || true
|
|
|
|
|
say "removed $UNIT"
|
2026-08-09 01:22:23 -07:00
|
|
|
fi
|
2026-09-09 13:08:42 -07:00
|
|
|
pkill -x socktop-swipe 2>/dev/null || true
|
2026-08-09 01:22:23 -07:00
|
|
|
|
2026-09-09 13:08:42 -07:00
|
|
|
# Session name comes from the config, which may be about to be deleted.
|
|
|
|
|
if [ -r "$CONF" ] && command -v tmux >/dev/null 2>&1; then
|
|
|
|
|
session=$(sed -n 's/^session:[[:space:]]*//p' "$CONF" | head -1)
|
|
|
|
|
[ -n "${session:-}" ] || session=socktop-swipe
|
|
|
|
|
tmux kill-session -t "$session" 2>/dev/null || true
|
2026-08-09 01:22:23 -07:00
|
|
|
fi
|
|
|
|
|
|
2026-09-09 13:08:42 -07:00
|
|
|
for f in "$BIN" "$UDEV" "$XBLANK" "$XIGNORE" "$LIGHTDM"; do
|
|
|
|
|
if [ -e "$f" ]; then
|
|
|
|
|
sudo rm -f "$f"
|
|
|
|
|
say "removed $f"
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
if [ -e "$UDEV" ] || command -v udevadm >/dev/null 2>&1; then
|
|
|
|
|
sudo udevadm control --reload 2>/dev/null || true
|
2026-08-10 00:47:36 -07:00
|
|
|
fi
|
|
|
|
|
|
2026-09-09 13:08:42 -07:00
|
|
|
if [ "$keep_config" = no ] && [ -e "$CONF" ]; then
|
|
|
|
|
rm -f "$CONF"
|
|
|
|
|
rmdir "$CONF_DIR" 2>/dev/null || true
|
|
|
|
|
say "removed $CONF"
|
2026-08-28 09:53:39 -07:00
|
|
|
fi
|
|
|
|
|
|
2026-09-09 13:08:42 -07:00
|
|
|
say ""
|
|
|
|
|
say "Left in place on purpose:"
|
|
|
|
|
say " * the Rust toolchain -- remove with: rustup self uninstall"
|
|
|
|
|
say " * tmux -- your package manager installed it"
|
|
|
|
|
say " * socktop and friends -- cargo uninstall socktop uptime-kuma-status"
|
|
|
|
|
say " * the source checkout -- rm -rf ~/.local/src/socktop-swipe"
|
|
|
|
|
say " * 'input' group -- sudo gpasswd -d $(id -un) input"
|
|
|
|
|
say " * i3 autostart -- delete the 'socktop-swipe' block in ~/.config/i3/config"
|
|
|
|
|
say ""
|
|
|
|
|
say "Screen blanking and the login prompt come back after the next X restart"
|
|
|
|
|
say "or reboot."
|