Files
AUR/backtunnel/PKGBUILD

97 lines
4.5 KiB
Bash
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Maintainer: Matjaž Mozetič <matjaz@matmoz.si>
# Project: BackTunnel Reverse SSH folder sharing toolkit with Dolphin (KDE) integration
# Repo: https://labs.pmisuite.com/PMISuite/BackTunnel
pkgname=backtunnel
pkgver=0.0.0
pkgrel=1
pkgdesc="BackTunnel Reverse SSH folder sharing toolkit with Dolphin (KDE) service menus, GUI/TUI wrappers, and profiles"
arch=('any')
url="https://labs.pmisuite.com/PMISuite/BackTunnel"
license=('GPL3')
depends=('bash' 'openssh' 'sshfs' 'kdialog' 'konsole' 'coreutils')
optdepends=(
'qrencode: show QR code for invites'
'bash-completion: tab completion for backtunnel tools'
'plasma-desktop: Dolphin (KDE/Plasma) service menus'
)
makedepends=('git')
install=${pkgname}.install
backup=('etc/backtunnel/profiles.ini')
source=("git+https://labs.pmisuite.com/PMISuite/BackTunnel.git")
sha256sums=('SKIP')
pkgver() {
cd "${srcdir}/BackTunnel"
# generate a pkgver like: 0.0.0.r<N>.g<commit>
printf "0.0.0.r%s.g%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}
build() {
cd "${srcdir}/BackTunnel"
: # 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"
install -Dm755 "scripts/backtunnel-share-gui" "${pkgdir}/usr/bin/backtunnel-share-gui"
install -Dm755 "scripts/backtunnel-access-gui" "${pkgdir}/usr/bin/backtunnel-access-gui"
install -Dm755 "scripts/backtunnel-open-term" "${pkgdir}/usr/bin/backtunnel-open-term"
install -Dm755 "scripts/backtunnel-share-tui" "${pkgdir}/usr/bin/backtunnel-share-tui"
install -Dm755 "scripts/backtunnel-access-tui" "${pkgdir}/usr/bin/backtunnel-access-tui"
install -Dm755 "scripts/backtunnel-auth-setup" "${pkgdir}/usr/bin/backtunnel-auth-setup"
install -Dm755 "scripts/backtunnel-keys" "${pkgdir}/usr/bin/backtunnel-keys"
install -Dm755 "scripts/backtunnel-authorize" "${pkgdir}/usr/bin/backtunnel-authorize"
install -Dm755 "scripts/backtunnel-umount" "${pkgdir}/usr/bin/backtunnel-umount"
# 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
# Man page
install -Dm644 "man/backtunnel.1" "${pkgdir}/usr/share/man/man1/backtunnel.1"
# Bash completion (install for all command entry points that source it)
if [[ -f "completions/backtunnel.bash" ]]; then
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"
install -Dm644 "completions/backtunnel.bash" "${pkgdir}/usr/share/bash-completion/completions/backtunnel-share-tui"
install -Dm644 "completions/backtunnel.bash" "${pkgdir}/usr/share/bash-completion/completions/backtunnel-access-tui"
fi
# 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 (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"
}