Files
socktop-swipe/uninstall.sh
T
jasonwitty ce6acec299 v2 release prep: installer, README, packaging, notes; retire the v1 scripts
Installer rewritten around a preflight: distro, package manager, display
manager, window manager, terminal, tmux, cargo, git, screen locker, touch
device, device permissions and free disk are all checked BEFORE anything is
installed, and the total cost is printed once for a single confirmation.
Prompts read /dev/tty so they still work when the script is piped from curl,
and fall back to defaults with a notice when there is no terminal at all.

Several "[ test ] && action" statements were set -e landmines: under set -e an
AND-OR list that ends up false aborts the script, so a box with no lightdm, no
i3 or nothing to install would have exited silently partway through detection
-- which is exactly the fresh-Debian case the installer exists for. Rewritten
as if-statements and verified against a stripped PATH with no tmux, cargo, git
or package manager present. Also fixed cargo detection reporting blank instead
of NOT INSTALLED: the status of `cargo --version | cut` is cut's, and cut
succeeds on empty input, so the fallback never fired.

Device access now defaults to a udev rule matching touchscreens only, rather
than the input group, which grants access to every input device including the
keyboard and needs a full logout.

README rewritten for someone who has not seen the project: what the photo
shows, the hardware, install, then a config built up step by step, each step
with the YAML and the resulting map. Every example is verified verbatim
against the binary, and every relative link resolves. The mechanism and the
reasoning move to notes/: DESIGN.md, HARDWARE-NOTES.md, V1-BASH.md, TODO.md.

cad/README.md was a verbatim copy of the one inside
geeekpi_rack_adapter_release_v1/, so every path in it -- including the
screenshot -- was broken from where it sits. Corrected to its own level, and
it now states once that the 9-inch screen, the 10-inch mini-rack mount and the
19-inch rack are three different measurements.

The v1 shell implementation is removed; it stays recoverable at tag v1.2 and
notes/V1-BASH.md carries the setting-by-setting migration table.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-09 13:08:42 -07:00

77 lines
2.6 KiB
Bash
Executable File

#!/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."