|
| 1 | +# Maintainer: hyperpolymath <hyperpolymath@users.noreply.github.com> |
| 2 | +# SPDX-License-Identifier: AGPL-3.0-or-later |
| 3 | +pkgname=cloud-sync-tuner |
| 4 | +pkgver=1.0.0 |
| 5 | +pkgrel=1 |
| 6 | +pkgdesc='Ada TUI for managing rclone cloud mount configurations with rate limiting and SELinux support' |
| 7 | +arch=('x86_64' 'i686' 'aarch64') |
| 8 | +url='https://github.com/hyperpolymath/cloud-sync-tuner' |
| 9 | +license=('AGPL-3.0-or-later') |
| 10 | +depends=('rclone' 'fuse3' 'glibc') |
| 11 | +makedepends=('gnat' 'gprbuild' 'rust' 'cargo') |
| 12 | +optdepends=( |
| 13 | + 'systemd: for user service management' |
| 14 | + 'libnotify: for desktop notifications' |
| 15 | + 'nautilus: for GNOME Files sync status emblems' |
| 16 | + 'dolphin: for KDE file manager integration' |
| 17 | + 'selinux-utils: for SELinux policy installation' |
| 18 | + 'audit: for enterprise compliance logging' |
| 19 | +) |
| 20 | +provides=('cloud-sync-tuner') |
| 21 | +conflicts=('cloud-sync-tuner-git') |
| 22 | +source=("${pkgname}-${pkgver}.tar.gz::https://github.com/hyperpolymath/${pkgname}/archive/v${pkgver}.tar.gz") |
| 23 | +sha256sums=('SKIP') |
| 24 | + |
| 25 | +build() { |
| 26 | + cd "${pkgname}-${pkgver}" |
| 27 | + |
| 28 | + # Build Ada TUI |
| 29 | + gprbuild -P cloud_sync_tuner.gpr -XBUILD_MODE=release |
| 30 | + |
| 31 | + # Build Rust overlay daemon |
| 32 | + cd overlay-daemon |
| 33 | + cargo build --release |
| 34 | + cd .. |
| 35 | + |
| 36 | + # Build Rust tray daemon |
| 37 | + cd tray-daemon |
| 38 | + cargo build --release |
| 39 | + cd .. |
| 40 | +} |
| 41 | + |
| 42 | +check() { |
| 43 | + cd "${pkgname}-${pkgver}" |
| 44 | + |
| 45 | + # Run Ada tests |
| 46 | + gprbuild -P tests/tests.gpr |
| 47 | + ./bin/test_runner |
| 48 | + ./bin/verify_formal |
| 49 | +} |
| 50 | + |
| 51 | +package() { |
| 52 | + cd "${pkgname}-${pkgver}" |
| 53 | + |
| 54 | + # Install main binary |
| 55 | + install -Dm755 "bin/cloud_sync_tuner" "${pkgdir}/usr/bin/cloud-sync-tuner" |
| 56 | + |
| 57 | + # Install Rust daemons |
| 58 | + install -Dm755 "overlay-daemon/target/release/cloud-sync-overlay" "${pkgdir}/usr/bin/cloud-sync-overlay" |
| 59 | + install -Dm755 "tray-daemon/target/release/cloud-sync-tray" "${pkgdir}/usr/bin/cloud-sync-tray" |
| 60 | + |
| 61 | + # Install health check script |
| 62 | + install -Dm755 "scripts/cloud-sync-status" "${pkgdir}/usr/bin/cloud-sync-status" |
| 63 | + |
| 64 | + # Install systemd user services |
| 65 | + install -Dm644 "systemd/rclone-dropbox.service" "${pkgdir}/usr/lib/systemd/user/rclone-dropbox.service" |
| 66 | + install -Dm644 "systemd/cloud-sync-watchdog.service" "${pkgdir}/usr/lib/systemd/user/cloud-sync-watchdog.service" |
| 67 | + install -Dm644 "systemd/cloud-sync-watchdog.timer" "${pkgdir}/usr/lib/systemd/user/cloud-sync-watchdog.timer" |
| 68 | + install -Dm644 "overlay-daemon/cloud-sync-overlay.service" "${pkgdir}/usr/lib/systemd/user/cloud-sync-overlay.service" |
| 69 | + install -Dm644 "tray-daemon/cloud-sync-tray.service" "${pkgdir}/usr/lib/systemd/user/cloud-sync-tray.service" |
| 70 | + |
| 71 | + # Install config example |
| 72 | + install -Dm644 "config/config.toml.example" "${pkgdir}/usr/share/cloud-sync-tuner/config.toml.example" |
| 73 | + install -Dm644 "config/schema.ncl" "${pkgdir}/usr/share/cloud-sync-tuner/schema.ncl" |
| 74 | + |
| 75 | + # Install Nautilus extension |
| 76 | + install -Dm644 "nautilus-extension/cloud_sync_overlay.py" "${pkgdir}/usr/share/nautilus-python/extensions/cloud_sync_overlay.py" |
| 77 | + |
| 78 | + # Install Dolphin service menu |
| 79 | + install -Dm644 "dolphin-extension/cloud_sync_overlay.desktop" "${pkgdir}/usr/share/kservices5/ServiceMenus/cloud_sync_overlay.desktop" |
| 80 | + |
| 81 | + # Install SELinux policy sources (user can compile if needed) |
| 82 | + install -Dm644 "selinux/cloud_sync_tuner.te" "${pkgdir}/usr/share/cloud-sync-tuner/selinux/cloud_sync_tuner.te" |
| 83 | + install -Dm644 "selinux/cloud_sync_tuner.fc" "${pkgdir}/usr/share/cloud-sync-tuner/selinux/cloud_sync_tuner.fc" |
| 84 | + install -Dm644 "selinux/cloud_sync_tuner.if" "${pkgdir}/usr/share/cloud-sync-tuner/selinux/cloud_sync_tuner.if" |
| 85 | + install -Dm644 "selinux/Makefile" "${pkgdir}/usr/share/cloud-sync-tuner/selinux/Makefile" |
| 86 | + |
| 87 | + # Install audit rules |
| 88 | + install -Dm644 "audit/cloud-sync-tuner.rules" "${pkgdir}/usr/share/cloud-sync-tuner/audit/cloud-sync-tuner.rules" |
| 89 | + |
| 90 | + # Install man page |
| 91 | + install -Dm644 "man/cloud-sync-tuner.1" "${pkgdir}/usr/share/man/man1/cloud-sync-tuner.1" |
| 92 | + |
| 93 | + # Install documentation |
| 94 | + install -Dm644 "README.adoc" "${pkgdir}/usr/share/doc/${pkgname}/README.adoc" |
| 95 | + install -Dm644 "SECURITY-REVIEW.md" "${pkgdir}/usr/share/doc/${pkgname}/SECURITY-REVIEW.md" |
| 96 | + install -Dm644 "LICENSE" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE" |
| 97 | +} |
| 98 | + |
| 99 | +post_install() { |
| 100 | + echo ":: To enable cloud sync services for your user:" |
| 101 | + echo " systemctl --user enable --now cloud-sync-watchdog.timer" |
| 102 | + echo " systemctl --user enable --now cloud-sync-overlay.service" |
| 103 | + echo " systemctl --user enable --now cloud-sync-tray.service" |
| 104 | + echo "" |
| 105 | + echo ":: Copy example config to ~/.config/cloud-sync-tuner/config.toml" |
| 106 | + echo ":: For SELinux: cd /usr/share/cloud-sync-tuner/selinux && sudo make install" |
| 107 | + echo ":: For audit: sudo cp /usr/share/cloud-sync-tuner/audit/*.rules /etc/audit/rules.d/" |
| 108 | +} |
0 commit comments