Files
BackTunnel/scripts/uninstall.sh
sysadminmatmoz fcbd6514cc Add accessor key authorization and enhance completion logic
Introduce `backtunnel-authorize` for managing restricted SFTP-only keys, and update `backtunnel-share` to support temporary accessor key authorization via `--allow-key` and `--allow-known`. Extend bash completion with profile, accessor, and SSH host suggestions. Revamp README sections to include updated workflows, quick starts, and key management details.
2025-09-20 17:17:26 +02:00

65 lines
1.9 KiB
Bash

#!/usr/bin/env bash
# BackTunnel uninstaller (use PURGE=1 to remove /usr/share/backtunnel and /etc/backtunnel)
set -euo pipefail
PREFIX=${PREFIX:-/usr}
DESTDIR=${DESTDIR:-}
PURGE=${PURGE:-0}
BINDIR="$DESTDIR$PREFIX/bin"
MANDIR="$DESTDIR$PREFIX/share/man/man1"
KIO_SM="$DESTDIR$PREFIX/share/kio/servicemenus"
KSVC5="$DESTDIR$PREFIX/share/kservices5/ServiceMenus"
APPDIR="$DESTDIR$PREFIX/share/applications"
BCOMP="$DESTDIR$PREFIX/share/bash-completion/completions"
SHARE_DIR="$DESTDIR$PREFIX/share/backtunnel"
ETC_DIR="$DESTDIR/etc/backtunnel"
say() { printf '[BackTunnel] %s\n' "$@"; }
# ... existing code ...
rm -f \
"$BINDIR/backtunnel-share" \
"$BINDIR/backtunnel-access" \
"$BINDIR/backtunnel-share-gui" \
"$BINDIR/backtunnel-access-gui" \
"$BINDIR/backtunnel-open-term" \
"$BINDIR/backtunnel-share-tui" \
"$BINDIR/backtunnel-access-tui" \
"$BINDIR/backtunnel-keys" \
"$BINDIR/backtunnel-authorize" \
"$BINDIR/backtunnel-auth-setup" \
"$BINDIR/backtunnel-init"
rm -f "$MANDIR/backtunnel.1"
rm -f \
"$BCOMP/backtunnel-share" \
"$BCOMP/backtunnel-access"
rm -f \
"$KIO_SM/backtunnel_share.desktop" \
"$KIO_SM/backtunnel_access.desktop" \
"$KSVC5/backtunnel_share.desktop" \
"$KSVC5/backtunnel_access.desktop"
rm -f "$APPDIR/backtunnel.desktop"
# ... existing code ...
# Optional purge of packaged defaults
if [[ "$PURGE" = "1" ]]; then
rm -rf "$SHARE_DIR" || true
rm -rf "$ETC_DIR" || true
say "Purged /usr/share/backtunnel and /etc/backtunnel"
fi
# Refresh caches only if not in DESTDIR (packaging)
if [[ -z "${DESTDIR}" ]]; then
command -v update-desktop-database >/dev/null 2>&1 && update-desktop-database -q || true
if command -v kbuildsycoca6 >/dev/null 2>&1; then
kbuildsycoca6 --noincremental >/dev/null 2>&1 || true
elif command -v kbuildsycoca5 >/dev/null 2>&1; then
kbuildsycoca5 --noincremental >/dev/null 2>&1 || true
fi
fi
say "Uninstall complete."