Introduce terminal-based workflows for BackTunnel via TUI scripts and service menus
Add `backtunnel-open-term`, `backtunnel-share-tui`, and `backtunnel-access-tui` scripts for terminal-based interaction. Update Dolphin service menus to enable TUI workflows, with improved terminal detection logic. Enhance installation and uninstallation scripts to handle new files. Update README with terminal workflow details and logging information.
This commit is contained in:
37
scripts/backtunnel-access-tui
Normal file
37
scripts/backtunnel-access-tui
Normal file
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
SEL_DIR="${1:-}"
|
||||
[[ -n "$SEL_DIR" ]] || { echo "Usage: backtunnel-access-tui <selected-dir>"; exit 1; }
|
||||
|
||||
# Defaults: mount INTO the selected folder
|
||||
DEFAULT_MP="$SEL_DIR"
|
||||
|
||||
# If selected folder is not empty, propose subdir
|
||||
if [[ -d "$SEL_DIR" ]] && [[ -n "$(ls -A -- "$SEL_DIR" 2>/dev/null || true)" ]]; then
|
||||
DEFAULT_MP="$SEL_DIR/backtunnel"
|
||||
fi
|
||||
|
||||
read -r -p "Remote (user@host or user:host) [user@vps.example.com]: " REMOTE
|
||||
REMOTE="${REMOTE:-user@vps.example.com}"
|
||||
|
||||
read -r -p "Tunnel port on remote [2222]: " PORT
|
||||
PORT="${PORT:-2222}"
|
||||
|
||||
read -r -p "Mount point [${DEFAULT_MP}]: " MP
|
||||
MP="${MP:-$DEFAULT_MP}"
|
||||
|
||||
# Expand leading ~ if user typed it
|
||||
if [[ "$MP" == "~"* ]]; then
|
||||
MP="${MP/#\~/$HOME}"
|
||||
fi
|
||||
|
||||
# Ensure mountpoint exists & is writable
|
||||
mkdir -p -- "$MP"
|
||||
if [[ ! -w "$MP" ]]; then
|
||||
echo "Mount point '$MP' is not writable"; exit 1
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "Running: backtunnel-access '<remote-folder>' from '$REMOTE' -p '$PORT' -m '$MP'"
|
||||
echo "Note: you'll be prompted on the remote for the exact folder (as per your workflow)."
|
||||
exec backtunnel-access "$MP" from "$REMOTE" -p "$PORT" -m "$MP"
|
||||
Reference in New Issue
Block a user