Files
BackTunnel/scripts/backtunnel-umount
sysadminmatmoz ae8ab9a7e0 Add backtunnel-umount script, host key policy support, and extend TUI/CLI integration
Introduce `backtunnel-umount` as a portable unmount helper, preferring `fusermount3`, `fusermount`, or `umount`. Add `BACKTUNNEL_HOSTKEY_POLICY` for configurable host key handling in `backtunnel-share` and `backtunnel-access`. Update TUIs for remote folder prompts and mount point handling. Enhance bash completion for TUI commands with directory suggestions. Revamp terminal selection logic in `backtunnel-open-term` to prioritize modern emulators like wezterm. Extend tests with scaffolds for host key policy and unmount behavior. Update README with new scripts, workflows, features, and troubleshooting tips.
2025-09-21 18:56:15 +02:00

36 lines
775 B
Bash

#!/usr/bin/env bash
# SPDX-License-Identifier: GPL-3.0-or-later
# Name: backtunnel-umount
# Summary: Unmount a BackTunnel FUSE mount point using the best available helper.
# Usage:
# backtunnel-umount <mountpoint>
# Notes:
# - Prefers fusermount3, then fusermount; falls back to umount.
# - Expands a leading "~" in the mountpoint.
set -euo pipefail
usage() {
echo "Usage: $(basename "$0") <mountpoint>" >&2
exit 1
}
case "${1:-}" in
-h|--help) usage ;;
esac
MP="${1:-}"
[[ -n "$MP" ]] || usage
# Expand leading ~
if [[ "$MP" == "~"* ]]; then
MP="${MP/#\~/$HOME}"
fi
if command -v fusermount3 >/dev/null 2>&1; then
exec fusermount3 -u -- "$MP"
elif command -v fusermount >/dev/null 2>&1; then
exec fusermount -u -- "$MP"
else
exec umount -- "$MP"
fi