From 87ccc940751c182aa0e70ad0cdb7883bafc4eb7d Mon Sep 17 00:00:00 2001 From: Andrew Hamilton Date: Sun, 13 Sep 2026 21:25:51 +1000 Subject: [PATCH] feat: add uninstall.sh mirroring install.sh (leaves libwlroots alone) --- uninstall.sh | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100755 uninstall.sh diff --git a/uninstall.sh b/uninstall.sh new file mode 100755 index 0000000..ca76ff6 --- /dev/null +++ b/uninstall.sh @@ -0,0 +1,48 @@ +#!/bin/sh +# ./uninstall.sh [--prefix PREFIX] +# +# Removes what install.sh installed by plain copy: +# $DESTDIR$PREFIX/bin/kick +# $DESTDIR$PREFIX/bin/kick-session +# $DESTDIR$PREFIX/share/applications/kick.desktop +# $DESTDIR$PREFIX/share/wayland-sessions/kick.desktop +# +# Never touches libwlroots-0.20.so: install.sh only ships that fallback +# when no system copy exists, so deleting it here could destroy a +# distro-owned file. A leftover fallback lib is left in place. +# +# Defaults to PREFIX=/usr to match install.sh. +# DESTDIR is honoured for staging (e.g. DESTDIR=/tmp/stage ./uninstall.sh). +set -e +cd "$(dirname "$0")" + +PREFIX=/usr +if [ "$1" = "--prefix" ]; then + [ $# -ge 2 ] || { echo "usage: $0 [--prefix PREFIX]" >&2; exit 2; } + PREFIX=$2 + shift 2 +fi +[ $# -eq 0 ] || { echo "usage: $0 [--prefix PREFIX]" >&2; exit 2; } +[ -n "$PREFIX" ] || { echo "uninstall: empty --prefix" >&2; exit 2; } +case "$PREFIX" in + /*) ;; + *) echo "uninstall: --prefix must be absolute: $PREFIX" >&2; exit 2 ;; +esac + +DEST=${DESTDIR:-} +ROOT="$DEST$PREFIX" + +# Need root only when the target isn't writable (system prefix, no DESTDIR): +# walk up to the first existing ancestor and test that. +SUDO= +_anc="$ROOT" +while [ ! -e "$_anc" ] && [ "$_anc" != "/" ]; do + _anc=$(dirname "$_anc") +done +[ -w "$_anc" ] || SUDO=sudo + +set -x +$SUDO rm -f "$ROOT/bin/kick" \ + "$ROOT/bin/kick-session" \ + "$ROOT/share/applications/kick.desktop" \ + "$ROOT/share/wayland-sessions/kick.desktop"