feat: add uninstall.sh mirroring install.sh (leaves libwlroots alone)

This commit is contained in:
Andrew Hamilton 2026-09-13 21:25:51 +10:00
parent c82954cf7d
commit 87ccc94075

48
uninstall.sh Executable file
View file

@ -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"