diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 0000000..277f09d --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,60 @@ +# Maintainer: Matjaž Mozetič +# Project: BackTunnel – Reverse SSH folder sharing toolkit with Dolphin (KDE) integration +# Repo: https://labs.pmisuite.com/PMISuite/BackTunnel + +pkgname=backtunnel +pkgver=1.1.0 +pkgrel=1 +pkgdesc="BackTunnel – Reverse SSH folder sharing toolkit with Dolphin (KDE) service menus" +arch=('any') +url="https://labs.pmisuite.com/PMISuite/BackTunnel" +license=('GPL3') +depends=('bash' 'openssh' 'sshfs' 'kdialog' 'konsole') +optdepends=('bash-completion: tab completion for backtunnel-share/access' + 'plasma-desktop: Dolphin (KDE/Plasma) service menus') +makedepends=('git') +source=("git+https://labs.pmisuite.com/PMISuite/BackTunnel.git") +sha256sums=('SKIP') +install=${pkgname}.install + +pkgver() { + cd "${srcdir}/BackTunnel" + if git describe --tags --abbrev=0 >/dev/null 2>&1; then + local tag; tag=$(git describe --tags --abbrev=0) + local desc; desc=$(git describe --tags --long --match "${tag}" 2>/dev/null || git describe --tags --long) + # v1.2.3-4-gabcd123 -> 1.2.3.r4.gabcd123 + echo "${desc}" | sed -E 's/^v//; s/-([0-9]+)-g/.r\1.g/; s/-/./g' + else + printf "0.0.0.r%s.g%s\n" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)" + fi +} + +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" + + # 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 + install -Dm644 "desktop/backtunnel.desktop" "${pkgdir}/usr/share/applications/backtunnel.desktop" + + # Dolphin service menus (Plasma 6 and Plasma 5) + 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" + 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" + + # Docs + install -Dm644 "docs/README.md" "${pkgdir}/usr/share/doc/${pkgname}/README.md" + + # License + install -Dm644 "LICENSE" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE" +} diff --git a/backtunnel.install b/backtunnel.install new file mode 100644 index 0000000..bc901d8 --- /dev/null +++ b/backtunnel.install @@ -0,0 +1,27 @@ +post_install() { + # Refresh desktop DB + if command -v update-desktop-database >/dev/null 2>&1; then + update-desktop-database -q || true + fi + # Rebuild KDE service cache + 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 +} + +post_upgrade() { + post_install +} + +post_remove() { + if command -v update-desktop-database >/dev/null 2>&1; then + update-desktop-database -q || true + fi + 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 +}