#!/bin/sh # Remove socktop-swipe. # # ./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. set -eu PREFIX=${PREFIX:-/usr/local} 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" keep_config=no 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 done 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" fi pkill -x socktop-swipe 2>/dev/null || true # 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 fi 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 fi if [ "$keep_config" = no ] && [ -e "$CONF" ]; then rm -f "$CONF" rmdir "$CONF_DIR" 2>/dev/null || true say "removed $CONF" fi 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."