diff --git a/backtunnel/PKGBUILD b/backtunnel/PKGBUILD index 10fd83f..b9d4a39 100644 --- a/backtunnel/PKGBUILD +++ b/backtunnel/PKGBUILD @@ -5,7 +5,7 @@ pkgname=backtunnel pkgver=0.0.0 pkgrel=1 -pkgdesc="BackTunnel – Reverse SSH folder sharing toolkit with Dolphin (KDE) service menus (with GUI wrapper)" +pkgdesc="BackTunnel – Reverse SSH folder sharing toolkit with Dolphin (KDE) service menus, GUI wrapper, and profiles" arch=('any') url="https://labs.pmisuite.com/PMISuite/BackTunnel" license=('GPL3') @@ -26,35 +26,57 @@ pkgver() { build() { cd "${srcdir}/BackTunnel" - # nothing to build - : + : # nothing to build } package() { cd "${srcdir}/BackTunnel" # Binaries - install -Dm755 "scripts/backtunnel-share" "${pkgdir}/usr/bin/backtunnel-share" - install -Dm755 "scripts/backtunnel-access" "${pkgdir}/usr/bin/backtunnel-access" - # NEW: GUI wrapper for Dolphin service menu - install -Dm755 "scripts/backtunnel-share-gui" "${pkgdir}/usr/bin/backtunnel-share-gui" + install -Dm755 "scripts/backtunnel-share" "${pkgdir}/usr/bin/backtunnel-share" + install -Dm755 "scripts/backtunnel-access" "${pkgdir}/usr/bin/backtunnel-access" + install -Dm755 "scripts/backtunnel-share-gui" "${pkgdir}/usr/bin/backtunnel-share-gui" - # Man page - install -Dm644 "man/backtunnel.1" "${pkgdir}/usr/share/man/man1/backtunnel.1" - - # Bash completion (install for both command names) - install -Dm644 "completions/backtunnel.bash" "${pkgdir}/usr/share/bash-completion/completions/backtunnel-share" - install -Dm644 "completions/backtunnel.bash" "${pkgdir}/usr/share/bash-completion/completions/backtunnel-access" - - # Desktop launcher (if present) - if [[ -f "desktop/backtunnel.desktop" ]]; then - install -Dm644 "desktop/backtunnel.desktop" "${pkgdir}/usr/share/applications/backtunnel.desktop" + # Optional helper to create per-user config from example + if [[ -f "scripts/backtunnel-init" ]]; then + install -Dm755 "scripts/backtunnel-init" "${pkgdir}/usr/bin/backtunnel-init" + else + # Provide a tiny builtin version if script missing (safe) + install -Dm755 /dev/stdin "${pkgdir}/usr/bin/backtunnel-init" <<'EOF' +#!/usr/bin/env bash +set -euo pipefail +SRC="/usr/share/backtunnel/profiles.ini" +DST="${XDG_CONFIG_HOME:-$HOME/.config}/backtunnel/profiles.ini" +mkdir -p "$(dirname "$DST")" +if [[ -f "$DST" ]]; then + echo "backtunnel: ${DST} already exists — not overwriting." + exit 0 +fi +cp "$SRC" "$DST" +echo "backtunnel: wrote ${DST}. Edit it to customize profiles." +EOF fi - # Dolphin service menus + # Man page + install -Dm644 "man/backtunnel.1" "${pkgdir}/usr/share/man/man1/backtunnel.1" + + # Bash completion (install for both command names) + install -Dm644 "completions/backtunnel.bash" "${pkgdir}/usr/share/bash-completion/completions/backtunnel-share" + install -Dm644 "completions/backtunnel.bash" "${pkgdir}/usr/share/bash-completion/completions/backtunnel-access" + + # Dolphin service menus (Plasma 6 path) install -Dm644 "servicemenus/backtunnel_share.desktop" "${pkgdir}/usr/share/kio/servicemenus/backtunnel_share.desktop" install -Dm644 "servicemenus/backtunnel_access.desktop" "${pkgdir}/usr/share/kio/servicemenus/backtunnel_access.desktop" - # Plasma 5 legacy path (keep for users on older Plasma) + # Plasma 5 legacy path (harmless if unused) install -Dm644 "servicemenus/backtunnel_share.desktop" "${pkgdir}/usr/share/kservices5/ServiceMenus/backtunnel_share.desktop" install -Dm644 "servicemenus/backtunnel_access.desktop" "${pkgdir}/usr/share/kservices5/ServiceMenus/backtunnel_access.desktop" + + # Optional desktop launcher if present + if [[ -f "desktop/backtunnel.desktop" ]]; then + install -Dm644 "desktop/backtunnel.desktop" "${pkgdir}/usr/share/applications/backtunnel.desktop" + fi + + # Profiles: system default + packaged example/fallback + install -Dm644 "docs/profiles.ini.example" "${pkgdir}/etc/backtunnel/profiles.ini" + install -Dm644 "docs/profiles.ini.example" "${pkgdir}/usr/share/backtunnel/profiles.ini" } diff --git a/backtunnel/backtunnel.install b/backtunnel/backtunnel.install index bc901d8..c9d0569 100644 --- a/backtunnel/backtunnel.install +++ b/backtunnel/backtunnel.install @@ -9,6 +9,20 @@ post_install() { elif command -v kbuildsycoca5 >/dev/null 2>&1; then kbuildsycoca5 --noincremental >/dev/null 2>&1 || true fi + + cat <<'EOF' +==> BackTunnel profiles + Per-user: ~/.config/backtunnel/profiles.ini + System-wide: /etc/backtunnel/profiles.ini + Example: /usr/share/backtunnel/profiles.ini + + To create a per-user config from the example, run: + backtunnel-init + or manually: + mkdir -p ~/.config/backtunnel + cp /usr/share/backtunnel/profiles.ini ~/.config/backtunnel/profiles.ini + # then edit ~/.config/backtunnel/profiles.ini +EOF } post_upgrade() {