From c45aa7c01520aeb42493396b422457385dd0633a Mon Sep 17 00:00:00 2001 From: damachin3 Date: Fri, 6 Feb 2026 18:46:38 +0100 Subject: [PATCH 1/5] pull changes to next (#132) --- .github/workflows/release.yml | 5 +- VERSION | 2 +- aur/PKGBUILD | 281 +++++++++------------------------- aur/coolerdash.install | 18 +-- packaging/coolerdash.spec | 1 + packaging/debian/install | 1 + 6 files changed, 83 insertions(+), 225 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f0e65bf..10416e7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -499,7 +499,10 @@ jobs: sed -i "s/^pkgrel=.*/pkgrel=1/" $GITHUB_WORKSPACE/aur-deploy/PKGBUILD echo "βœ… Updated PKGBUILD:" - grep -E "^pkgver=|^_commit=|^pkgrel=" $GITHUB_WORKSPACE/aur-deploy/PKGBUILD + echo "--- Content check ---" + cat $GITHUB_WORKSPACE/aur-deploy/PKGBUILD | head -20 + echo "--- Grep for variables ---" + grep -E "^pkgver=|^_commit=|^pkgrel=" $GITHUB_WORKSPACE/aur-deploy/PKGBUILD || echo "⚠️ Warning: grep found no matches" - name: Deploy to AUR uses: KSXGitHub/github-actions-deploy-aur@a97f56a8425a7a7f3b8c58607f769c69b089cadb # v3 diff --git a/VERSION b/VERSION index ccbccc3..c043eea 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.2.0 +2.2.1 diff --git a/aur/PKGBUILD b/aur/PKGBUILD index a47dbb4..0c69693 100644 --- a/aur/PKGBUILD +++ b/aur/PKGBUILD @@ -1,224 +1,89 @@ + # Created by: damachin3 (damachine3 at proton dot me) # Website: https://github.com/damachine/coolerdash -pre_install() { - echo "Checking for legacy files and performing migration cleanup..." 2>/dev/null - # Stop and disable service before install or update to prevent conflicts with plugin mode - if systemctl list-unit-files coolerdash.service 2>/dev/null || systemctl list-unit-files coolerdash.service 2>/dev/null; then - echo "Stopping coolerdash service..." 2>/dev/null - systemctl stop coolerdash.service 2>/dev/null - echo "Disabling coolerdash service (CoolerControl plugin mode preferred)..." 2>/dev/null - systemctl disable coolerdash.service 2>/dev/null - fi - - # Remove old systemd service file if it exists (migration from standalone to plugin mode) - if [ -f /etc/systemd/system/coolerdash.service ]; then - echo "Removing deprecated systemd service file..." 2>/dev/null - rm -f /etc/systemd/system/coolerdash.service 2>/dev/null - fi - - # Remove legacy installation directories if they exist - if [ -d /opt/coolerdash ]; then - echo "Removing legacy installation: /opt/coolerdash/" 2>/dev/null - rm -rf /opt/coolerdash 2>/dev/null - fi - - # Remove legacy config directory if it exists - if [ -d /etc/coolerdash ]; then - echo "Removing legacy config: /etc/coolerdash/" 2>/dev/null - rm -rf /etc/coolerdash 2>/dev/null - fi - - # Remove legacy config.ini and ui.html if they exist in plugin directory - if [ -f /etc/coolercontrol/plugins/coolerdash/config.ini ]; then - echo "Removing legacy config.ini..." 2>/dev/null - rm -f /etc/coolercontrol/plugins/coolerdash/config.ini 2>/dev/null - fi - if [ -f /etc/coolercontrol/plugins/coolerdash/ui.html ]; then - echo "Removing legacy ui.html..." 2>/dev/null - rm -f /etc/coolercontrol/plugins/coolerdash/ui.html 2>/dev/null - fi - if [ -f /usr/share/applications/coolerdash-settings.desktop ]; then - echo "Removing legacy coolerdash-settings.desktop..." 2>/dev/null - rm -f /usr/share/applications/coolerdash-settings.desktop 2>/dev/null - fi - - # Remove legacy user if it exists - if id -u coolerdash &>/dev/null; then - echo "Removing legacy coolerdash user..." 2>/dev/null - userdel -rf coolerdash 2>/dev/null || true - fi - - # Remove legacy symlinks in /bin/ and /usr/bin/ if they exist (migration from standalone) - if [ -L /bin/coolerdash ] || [ -f /bin/coolerdash ]; then - echo "Removing legacy symlink: /bin/coolerdash" - rm -f /bin/coolerdash - fi - if [ -L /usr/bin/coolerdash ] || [ -f /usr/bin/coolerdash ]; then - echo "Removing legacy symlink: /usr/bin/coolerdash" - rm -f /usr/bin/coolerdash - fi +pkgname=coolerdash-git +pkgver= +pkgrel=1 +provides=('coolerdash') +replaces=('coolerdash') +conflicts=('coolerdash') +pkgdesc="Monitor telemetry data on an AIO liquid cooler with an integrated LCD display" +arch=('x86_64') +url="https://github.com/damachine/coolerdash" +license=('MIT') +depends=('cairo' 'coolercontrol' 'jansson' 'libcurl-gnutls' 'ttf-roboto') +makedepends=('gcc' 'make' 'pkg-config' 'git') +backup=('etc/coolercontrol/plugins/coolerdash/config.json') +install=coolerdash.install +_commit= +source=("git+https://github.com/damachine/coolerdash.git#commit=${_commit}") +sha256sums=('SKIP') # SKIP for git repo source builds + +pkgver() { + cd "${srcdir}/coolerdash" + git fetch --tags + git describe --tags --long --match "v*" | sed -E 's/^v//; s/-([0-9]+)-g/\.r\1.g/; s/-/./g' } -post_install() { - # Ensure plugin directory files have correct permissions - if [ -d /etc/coolercontrol/plugins/coolerdash ]; then - echo "Plugin directory permissions configured" - chmod 755 /etc/coolercontrol/plugins/coolerdash 2>/dev/null || true - chmod 755 /etc/coolercontrol/plugins/coolerdash/coolerdash 2>/dev/null || true - chmod 644 /etc/coolercontrol/plugins/coolerdash/*.md 2>/dev/null || true - chmod 644 /etc/coolercontrol/plugins/coolerdash/VERSION 2>/dev/null || true - chmod 644 /etc/coolercontrol/plugins/coolerdash/LICENSE 2>/dev/null || true - chmod 644 /etc/coolercontrol/plugins/coolerdash/*.toml 2>/dev/null || true - chmod 644 /etc/coolercontrol/plugins/coolerdash/*.png 2>/dev/null || true - chmod 666 /etc/coolercontrol/plugins/coolerdash/config.json 2>/dev/null || true - chmod 755 /etc/coolercontrol/plugins/coolerdash/ui 2>/dev/null || true - chmod 644 /etc/coolercontrol/plugins/coolerdash/ui/* 2>/dev/null || true - fi - - # Reload udev rules for USB power management - if [ -f /usr/lib/udev/rules.d/99-coolerdash.rules ]; then - echo "Reloading udev rules..." - udevadm control --reload-rules 2>/dev/null || true - udevadm trigger --subsystem-match=usb 2>/dev/null || true - fi - - # Create systemd drop-in for startup delay (allow shutdown.png to display) - mkdir -p /etc/systemd/system/cc-plugin-coolerdash.service.d - printf "[Service]\nExecStartPre=/bin/sleep 10\n" > /etc/systemd/system/cc-plugin-coolerdash.service.d/startup-delay.conf - chmod 644 /etc/systemd/system/cc-plugin-coolerdash.service.d/startup-delay.conf - echo "Systemd drop-in created: 10s startup delay" - - # Create/ensure shutdown notifier unit (uses printf to avoid cat heredocs) - printf "[Unit]\nDescription=CoolerDash helper daemon\nBindsTo=coolercontrold.service\nPartOf=coolercontrold.service\nAfter=coolercontrold.service\n\n[Service]\nType=simple\nExecStart=/bin/sleep infinity\nExecStop=/etc/coolercontrol/plugins/coolerdash/coolerdash --shutdown\nTimeoutStopSec=3\nRestart=no\n\n[Install]\nWantedBy=multi-user.target\n" > /etc/systemd/system/coolerdash-helperd.service - chmod 644 /etc/systemd/system/coolerdash-helperd.service || true - echo "Helper unit created: coolerdash-helperd.service" - - # Reload systemd manager configuration - systemctl daemon-reload +build() { + # Build inside the checked-out repository + cd "${srcdir}/coolerdash" || return 1 - # Create shutdown notifier unit - if systemctl list-unit-files coolerdash-helperd.service >/dev/null 2>&1; then - echo "Enabling and starting coolerdash-helperd.service..." - systemctl enable --now coolerdash-helperd.service || echo "Note: coolerdash-helperd.service enable/start failed. Please enable/start manually." - fi + # Remove all previous tarball builds + rm -rf coolerdash-*.pkg.* || true - # Restart CoolerControl to pick up the new plugin - if systemctl list-unit-files coolercontrold.service >/dev/null 2>&1; then - echo "Restarting CoolerControl service to load new plugin..." - systemctl restart coolercontrold.service || echo "Note: CoolerControl service restart failed. Please restart manually." + # Clean any previous builds if a Makefile exists + if [[ -f Makefile || -f GNUmakefile ]]; then + make clean || true fi - echo "================================================================" - echo "CoolerDash has been installed successfully!" - echo "================================================================" + # Build + make || return 1 } -post_upgrade() { - # Ensure plugin directory files have correct permissions after upgrade - if [ -d /etc/coolercontrol/plugins/coolerdash ]; then - echo "Plugin directory permissions configured" - chmod 755 /etc/coolercontrol/plugins/coolerdash 2>/dev/null || true - chmod 755 /etc/coolercontrol/plugins/coolerdash/coolerdash 2>/dev/null || true - chmod 644 /etc/coolercontrol/plugins/coolerdash/*.md 2>/dev/null || true - chmod 644 /etc/coolercontrol/plugins/coolerdash/VERSION 2>/dev/null || true - chmod 644 /etc/coolercontrol/plugins/coolerdash/LICENSE 2>/dev/null || true - chmod 644 /etc/coolercontrol/plugins/coolerdash/*.toml 2>/dev/null || true - chmod 644 /etc/coolercontrol/plugins/coolerdash/*.png 2>/dev/null || true - chmod 666 /etc/coolercontrol/plugins/coolerdash/config.json 2>/dev/null || true - chmod 755 /etc/coolercontrol/plugins/coolerdash/ui 2>/dev/null || true - chmod 644 /etc/coolercontrol/plugins/coolerdash/ui/* 2>/dev/null || true - fi - - # Create systemd drop-in for startup delay (allow shutdown.png to display) - mkdir -p /etc/systemd/system/cc-plugin-coolerdash.service.d - printf "[Service]\nExecStartPre=/bin/sleep 10\n" > /etc/systemd/system/cc-plugin-coolerdash.service.d/startup-delay.conf - chmod 644 /etc/systemd/system/cc-plugin-coolerdash.service.d/startup-delay.conf - echo "Systemd drop-in updated: 10s startup delay" - - # Create/ensure shutdown notifier unit (uses printf to avoid cat heredocs) - printf "[Unit]\nDescription=CoolerDash helper daemon\nBindsTo=coolercontrold.service\nPartOf=coolercontrold.service\nAfter=coolercontrold.service\n\n[Service]\nType=simple\nExecStart=/bin/sleep infinity\nExecStop=/etc/coolercontrol/plugins/coolerdash/coolerdash --shutdown\nTimeoutStopSec=3\nRestart=no\n\n[Install]\nWantedBy=multi-user.target\n" > /etc/systemd/system/coolerdash-helperd.service - chmod 644 /etc/systemd/system/coolerdash-helperd.service || true - echo "Helper unit updated: coolerdash-helperd.service" - - # Reload systemd manager configuration - systemctl daemon-reload - - # Create shutdown notifier unit - if systemctl list-unit-files coolerdash-helperd.service >/dev/null 2>&1; then - echo "Enabling and starting coolerdash-helperd.service..." - systemctl enable --now coolerdash-helperd.service || echo "Note: coolerdash-helperd.service enable/start failed. Please enable/start manually." - fi +check() { + # Check in the checked-out repository + cd "${srcdir}/coolerdash" || return 1 - # Restart CoolerDash to pick up the updated plugin - if systemctl list-unit-files cc-plugin-coolerdash.service >/dev/null 2>&1; then - echo "Restarting CoolerDash service to load updated plugin..." - systemctl restart cc-plugin-coolerdash.service || echo "Note: CoolerDash service restart failed. Please restart manually." + # Verify that the binary was created successfully + if [[ -f bin/coolerdash ]]; then + echo "Build successful - binary created" + else + echo "ERROR: Binary not found" + return 1 fi - - echo "================================================================" - echo "CoolerDash has been upgraded successfully!" - echo "================================================================" } -pre_remove() { - # Stop and disable service before uninstallation - if systemctl is-active --quiet coolerdash.service || systemctl is-enabled --quiet coolerdash.service; then - echo "Stopping coolerdash service..." - systemctl stop coolerdash.service - echo "Disabling coolerdash service" - systemctl disable coolerdash.service - fi - - # Stop and disable service before uninstallation - if systemctl is-active --quiet cc-plugin-coolerdash.service || systemctl is-enabled --quiet cc-plugin-coolerdash.service; then - echo "Stopping cc-plugin-coolerdash service..." - systemctl stop cc-plugin-coolerdash.service - echo "Disabling cc-plugin-coolerdash service" - systemctl disable cc-plugin-coolerdash.service - fi - - # Remove systemd drop-in directory - if [ -d /etc/systemd/system/cc-plugin-coolerdash.service.d ]; then - echo "Removing systemd drop-in directory..." - rm -rf /etc/systemd/system/cc-plugin-coolerdash.service.d || echo "Note: Failed to remove systemd drop-in directory. Please remove manually." - fi - - # Remove notify unit (stop, disable and remove) - if systemctl list-unit-files coolerdash-helperd.service >/dev/null 2>&1; then - echo "Stopping, disabling and removing coolerdash-helperd.service..." - systemctl stop --no-block coolerdash-helperd.service 2>/dev/null || true - systemctl disable --now coolerdash-helperd.service 2>/dev/null || true - rm -f /etc/systemd/system/coolerdash-helperd.service || echo "Note: Failed to remove coolerdash-helperd.service file. Please remove manually." - fi - - # Remove all installed users, files and directories - if id -u coolerdash &>/dev/null; then - echo "Removing legacy coolerdash user..." 2>/dev/null - userdel -rf coolerdash || true - fi - - # Remove old systemd service file if it exists (migration from standalone to plugin mode) - if [ -f /etc/systemd/system/coolerdash.service ]; then - echo "Removing deprecated systemd service file..." - rm -f /etc/systemd/system/coolerdash.service || echo "Note: Failed to remove coolerdash.service file. Please remove manually." - fi - - # Remove legacy installation directories if they exist - rm -f /usr/share/applications/coolerdash-settings.desktop - rm -f /bin/coolerdash - rm -f /usr/bin/coolerdash - rm -rf /opt/coolerdash - rm -rf /etc/coolerdash - - systemctl daemon-reload - - # Restart CoolerControl to remove the plugin - if systemctl list-unit-files coolercontrold.service >/dev/null 2>&1; then - echo "Restarting CoolerControl service to unload plugin..." - systemctl restart coolercontrold.service || echo "Note: CoolerControl service restart failed. Please restart manually." - fi - echo "================================================================" - echo "CoolerDash and all related files have been removed." - echo "================================================================" +package() { + # Plugin-mode installation: Everything in /etc/coolercontrol/plugins/coolerdash/ + install -dm755 "${pkgdir}/etc/coolercontrol/plugins/coolerdash" + install -m755 "${srcdir}/coolerdash/bin/coolerdash" "${pkgdir}/etc/coolercontrol/plugins/coolerdash/coolerdash" + install -m644 "${srcdir}/coolerdash/README.md" "${pkgdir}/etc/coolercontrol/plugins/coolerdash/README.md" + install -m644 "${srcdir}/coolerdash/VERSION" "${pkgdir}/etc/coolercontrol/plugins/coolerdash/VERSION" + install -m644 "${srcdir}/coolerdash/LICENSE" "${pkgdir}/etc/coolercontrol/plugins/coolerdash/LICENSE" + install -m644 "${srcdir}/coolerdash/CHANGELOG.md" "${pkgdir}/etc/coolercontrol/plugins/coolerdash/CHANGELOG.md" + install -m666 "${srcdir}/coolerdash/etc/coolercontrol/plugins/coolerdash/config.json" "${pkgdir}/etc/coolercontrol/plugins/coolerdash/config.json" + + # Create ui directory first with correct permissions + install -dm755 "${pkgdir}/etc/coolercontrol/plugins/coolerdash/ui" + install -m644 "${srcdir}/coolerdash/etc/coolercontrol/plugins/coolerdash/ui/index.html" "${pkgdir}/etc/coolercontrol/plugins/coolerdash/ui/index.html" + install -m644 "${srcdir}/coolerdash/etc/coolercontrol/plugins/coolerdash/ui/cc-plugin-lib.js" "${pkgdir}/etc/coolercontrol/plugins/coolerdash/ui/cc-plugin-lib.js" + install -m644 "${srcdir}/coolerdash/images/shutdown.png" "${pkgdir}/etc/coolercontrol/plugins/coolerdash/shutdown.png" + install -m644 "${srcdir}/coolerdash/etc/coolercontrol/plugins/coolerdash/manifest.toml" "${pkgdir}/etc/coolercontrol/plugins/coolerdash/manifest.toml" + + # Substitute VERSION placeholder in manifest.toml + sed -i "s/{{VERSION}}/${pkgver}/g" "${pkgdir}/etc/coolercontrol/plugins/coolerdash/manifest.toml" + + # Manual page + install -Dm644 "${srcdir}/coolerdash/man/coolerdash.1" "${pkgdir}/usr/share/man/man1/coolerdash.1" + + # Desktop shortcut for settings UI + install -Dm644 "${srcdir}/coolerdash/etc/applications/coolerdash.desktop" "${pkgdir}/usr/share/applications/coolerdash.desktop" + + # USB power management udev rule for + install -Dm644 "${srcdir}/coolerdash/etc/udev/rules.d/99-coolerdash.rules" "${pkgdir}/usr/lib/udev/rules.d/99-coolerdash.rules" + + # Application icon + install -Dm644 "${srcdir}/coolerdash/etc/icons/coolerdash.svg" "${pkgdir}/usr/share/icons/hicolor/scalable/apps/coolerdash.svg" } diff --git a/aur/coolerdash.install b/aur/coolerdash.install index b7f9a2c..a47dbb4 100644 --- a/aur/coolerdash.install +++ b/aur/coolerdash.install @@ -76,23 +76,11 @@ post_install() { chmod 644 /etc/coolercontrol/plugins/coolerdash/ui/* 2>/dev/null || true fi - # Reload udev rules for NZXT USB power management + # Reload udev rules for USB power management if [ -f /usr/lib/udev/rules.d/99-coolerdash.rules ]; then - echo "Reloading udev rules for NZXT devices..." + echo "Reloading udev rules..." udevadm control --reload-rules 2>/dev/null || true - udevadm trigger --subsystem-match=usb --attr-match=idVendor=1e71 2>/dev/null || true - - # Apply settings to already connected NZXT devices (udev rules only trigger on add/bind) - for device in /sys/bus/usb/devices/*/idVendor; do - if [ -f "$device" ] && [ "$(cat $device 2>/dev/null)" = "1e71" ]; then - device_path=$(dirname "$device") - if [ -f "$device_path/power/autosuspend_delay_ms" ]; then - echo -1 > "$device_path/power/autosuspend_delay_ms" 2>/dev/null || true - echo on > "$device_path/power/control" 2>/dev/null || true - echo "Configured USB autosuspend delay for $(basename $device_path)" - fi - fi - done + udevadm trigger --subsystem-match=usb 2>/dev/null || true fi # Create systemd drop-in for startup delay (allow shutdown.png to display) diff --git a/packaging/coolerdash.spec b/packaging/coolerdash.spec index ee3d78c..81e53c2 100644 --- a/packaging/coolerdash.spec +++ b/packaging/coolerdash.spec @@ -78,6 +78,7 @@ fi /usr/share/man/man1/coolerdash.1.gz /usr/share/applications/coolerdash.desktop /usr/share/icons/hicolor/scalable/apps/coolerdash.svg +/usr/lib/udev/rules.d/99-coolerdash.rules %changelog * %(date "+%a %b %d %Y") damachine - %{version}-1 diff --git a/packaging/debian/install b/packaging/debian/install index 2423637..25ab8c9 100644 --- a/packaging/debian/install +++ b/packaging/debian/install @@ -11,3 +11,4 @@ etc/coolercontrol/plugins/coolerdash/ui/cc-plugin-lib.js usr/share/man/man1/coolerdash.1 usr/share/applications/coolerdash.desktop usr/share/icons/hicolor/scalable/apps/coolerdash.svg +usr/lib/udev/rules.d/99-coolerdash.rules From 559add8c6b4f9924b86bcf1984c214db0348172a Mon Sep 17 00:00:00 2001 From: damachine Date: Mon, 9 Feb 2026 00:58:12 +0100 Subject: [PATCH 2/5] VERSION: bump to 2.2.2 - Upstream-friendly - SELinux-aware - Linux-compliance "Refactoring for better compliance. Improving SELinux support and adhering to standard filesystem hierarchies (FHS/XDG)." --- .SRCINFO | 2 +- .github/workflows/gitlab.yml | 36 +-- .github/workflows/install.yml | 94 +++++++- Makefile | 115 +++++----- PKGBUILD | 20 +- README.md | 8 +- VERSION | 2 +- aur/PKGBUILD | 18 +- aur/coolerdash.install | 204 +++++------------ coolerdash.install | 205 ++++-------------- .../plugins/coolerdash/manifest.toml | 2 +- etc/systemd/coolerdash-helperd.service | 2 +- man/coolerdash.1 | 26 +-- packaging/coolerdash.spec | 47 ++-- packaging/debian/control | 7 +- packaging/debian/copyright | 27 +++ packaging/debian/install | 6 +- packaging/debian/postinst | 11 +- packaging/debian/prerm | 8 +- src/device/config.c | 5 +- src/device/config.h | 5 +- src/main.c | 11 +- src/mods/circle.c | 6 +- src/mods/circle.h | 5 +- src/mods/display.c | 5 +- src/mods/display.h | 5 +- src/mods/dual.c | 5 +- src/mods/dual.h | 5 +- src/srv/cc_conf.c | 5 +- src/srv/cc_conf.h | 5 +- src/srv/cc_main.c | 5 +- src/srv/cc_main.h | 5 +- src/srv/cc_sensor.c | 7 +- src/srv/cc_sensor.h | 6 +- 34 files changed, 400 insertions(+), 525 deletions(-) create mode 100644 packaging/debian/copyright diff --git a/.SRCINFO b/.SRCINFO index d1924fd..e3f944f 100644 --- a/.SRCINFO +++ b/.SRCINFO @@ -1,6 +1,6 @@ pkgbase = coolerdash pkgdesc = Monitor telemetry data on an AIO liquid cooler with an integrated LCD display - pkgver = 2.2.0 + pkgver = 2.2.2 pkgrel = 1 url = https://github.com/damachine/coolerdash install = coolerdash.install diff --git a/.github/workflows/gitlab.yml b/.github/workflows/gitlab.yml index 329d89b..b67efe8 100644 --- a/.github/workflows/gitlab.yml +++ b/.github/workflows/gitlab.yml @@ -14,18 +14,18 @@ jobs: sync: name: Synchronize with GitLab runs-on: ubuntu-latest - + steps: - name: Checkout repository uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 with: fetch-depth: 0 # Fetch complete history for proper sync - + - name: Configure Git run: | git config --global user.name "GitHub Actions" git config --global user.email "actions@github.com" - + - name: Add GitLab remote and selective sync env: GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }} @@ -35,15 +35,15 @@ jobs: echo "Please add your GitLab Personal Access Token to GitHub Secrets as 'GITLAB_TOKEN'" exit 1 fi - + # Add GitLab remote with token authentication git remote add gitlab https://oauth2:${GITLAB_TOKEN}@gitlab.com/damachine/coolerdash.git - + echo "πŸ”„ Creating selective sync (with GitLab-specific README)..." - + # Create temporary branch for selective sync git checkout -b gitlab-sync - + # Create GitLab-specific README.md cat > README.md << 'EOF' # CoolerDash - GitLab Mirror @@ -52,7 +52,7 @@ jobs: ## πŸ“ Main Repository - **Primary development happens on GitHub:** + **Primary development happens on GitHub:** πŸ”— **[https://github.com/damachine/coolerdash](https://github.com/damachine/coolerdash)** ## πŸ”„ Synchronization Info @@ -73,7 +73,7 @@ jobs: **CoolerDash** is a real-time sensor monitoring tool for AIO liquid coolers with integrated LCD displays. - Enhances your liquid-cooling display with extra features - - Support for additional sensor values + - Support for additional sensor values - Polished, customizable LCD dashboard - Add-on wrapper for [CoolerControl](https://gitlab.com/coolercontrol/coolercontrol) @@ -85,14 +85,14 @@ jobs: --- - **πŸ”— Visit the main repository for the latest updates and full documentation:** + **πŸ”— Visit the main repository for the latest updates and full documentation:** **[github.com/damachine/coolerdash](https://github.com/damachine/coolerdash)** EOF # Stage and commit the new README git add README.md git commit -m "INFO: this is a GitLab mirror - see GitHub for main repo: https://github.com/damachine/coolerdash" - + echo "πŸ”„ Synchronizing to GitLab (with GitLab README)..." # Try normal push first, fallback to sync branch if main is protected if ! git push gitlab gitlab-sync:main --force; then @@ -100,16 +100,16 @@ jobs: git push gitlab gitlab-sync:github-sync --force echo "πŸ“ Created 'github-sync' branch on GitLab" fi - + # Clean up temporary branch - git checkout main + git checkout master git branch -D gitlab-sync - + echo "🏷️ Synchronizing tags to GitLab..." git push gitlab --tags --force - + echo "βœ… Synchronization completed (GitLab README created)" - + - name: Create sync summary if: success() run: | @@ -124,7 +124,7 @@ jobs: echo "" >> $GITHUB_STEP_SUMMARY echo "πŸ“ **Note**: GitLab README explains this is a mirror and directs users to GitHub" >> $GITHUB_STEP_SUMMARY echo "🎯 **GitLab repository is now synchronized with GitHub (selective sync)**" >> $GITHUB_STEP_SUMMARY - + - name: Error summary if: failure() run: | @@ -134,4 +134,4 @@ jobs: echo "1. **Check GitLab Token**: Ensure GITLAB_TOKEN secret is set" >> $GITHUB_STEP_SUMMARY echo "2. **Token Permissions**: Token needs 'write_repository' scope" >> $GITHUB_STEP_SUMMARY echo "3. **Repository Access**: Verify you have push access to GitLab repo" >> $GITHUB_STEP_SUMMARY - echo "4. **Protected Branches**: Check GitLab repository branch protection settings" >> $GITHUB_STEP_SUMMARY \ No newline at end of file + echo "4. **Protected Branches**: Check GitLab repository branch protection settings" >> $GITHUB_STEP_SUMMARY diff --git a/.github/workflows/install.yml b/.github/workflows/install.yml index e62c092..558db38 100644 --- a/.github/workflows/install.yml +++ b/.github/workflows/install.yml @@ -4,8 +4,6 @@ on: push: paths: - "VERSION" - branches: - - master workflow_dispatch: permissions: @@ -92,10 +90,10 @@ jobs: echo "πŸ“ Checking installed files:" find /tmp/install-test -type f -name "*coolerdash*" | head -10 - # Check binary (Plugin mode: /etc/coolercontrol/plugins/coolerdash/) - if [ -f "/tmp/install-test/etc/coolercontrol/plugins/coolerdash/coolerdash" ]; then - echo "βœ… Binary installed correctly (plugin mode)" - file /tmp/install-test/etc/coolercontrol/plugins/coolerdash/coolerdash + # Check binary + if [ -f "/tmp/install-test/usr/libexec/coolerdash/coolerdash" ]; then + echo "βœ… Binary installed correctly" + file /tmp/install-test/usr/libexec/coolerdash/coolerdash else echo "❌ Binary not found at expected location" find /tmp/install-test -name "coolerdash" -type f @@ -157,6 +155,38 @@ jobs: echo "⚠️ Manual page not found" fi + # Check systemd helperd service + if [ -f "/tmp/install-test/usr/lib/systemd/system/coolerdash-helperd.service" ]; then + echo "βœ… Systemd helperd service installed" + else + echo "❌ Systemd helperd service not found" + exit 1 + fi + + # Check systemd startup-delay drop-in + if [ -f "/tmp/install-test/etc/systemd/system/cc-plugin-coolerdash.service.d/startup-delay.conf" ]; then + echo "βœ… Systemd startup-delay drop-in installed" + else + echo "❌ Systemd startup-delay drop-in not found" + exit 1 + fi + + # Check udev rules + if [ -f "/tmp/install-test/usr/lib/udev/rules.d/99-coolerdash.rules" ]; then + echo "βœ… Udev rules installed" + else + echo "❌ Udev rules not found" + exit 1 + fi + + # Check license file (Linux packaging standard) + if [ -f "/tmp/install-test/usr/share/licenses/coolerdash/LICENSE" ]; then + echo "βœ… License file installed (/usr/share/licenses/)" + else + echo "❌ License file not found at /usr/share/licenses/coolerdash/" + exit 1 + fi + echo "βœ… Installation test completed on ${{ matrix.name }}" # Additional test for Arch Linux (your development system) @@ -174,7 +204,7 @@ jobs: - name: Setup Arch Linux run: | pacman -Syu --noconfirm - pacman -S --noconfirm cairo libcurl-gnutls libinih gcc make pkg-config jansson ttf-roboto sudo systemd + pacman -S --noconfirm cairo libcurl-gnutls gcc make pkg-config jansson ttf-roboto sudo systemd file - name: Test make install on Arch run: | @@ -184,16 +214,56 @@ jobs: mkdir -p /tmp/install-test SUDO="" REALOS=no make install DESTDIR=/tmp/install-test - # Verify plugin installation - if [ -f "/tmp/install-test/etc/coolercontrol/plugins/coolerdash/coolerdash" ]; then - echo "βœ… Plugin binary installed" - file /tmp/install-test/etc/coolercontrol/plugins/coolerdash/coolerdash + # Verify binary installation + if [ -f "/tmp/install-test/usr/libexec/coolerdash/coolerdash" ]; then + echo "βœ… Binary installed" + file /tmp/install-test/usr/libexec/coolerdash/coolerdash else - echo "❌ Plugin binary not found" + echo "❌ Binary not found" find /tmp/install-test -name "coolerdash" -type f exit 1 fi + # Check plugin config + if [ -f "/tmp/install-test/etc/coolercontrol/plugins/coolerdash/config.json" ]; then + echo "βœ… Config file installed" + else + echo "❌ Config file not found" + exit 1 + fi + + # Check systemd helperd service + if [ -f "/tmp/install-test/usr/lib/systemd/system/coolerdash-helperd.service" ]; then + echo "βœ… Systemd helperd service installed" + else + echo "❌ Systemd helperd service not found" + exit 1 + fi + + # Check systemd startup-delay drop-in + if [ -f "/tmp/install-test/etc/systemd/system/cc-plugin-coolerdash.service.d/startup-delay.conf" ]; then + echo "βœ… Systemd startup-delay drop-in installed" + else + echo "❌ Systemd startup-delay drop-in not found" + exit 1 + fi + + # Check udev rules + if [ -f "/tmp/install-test/usr/lib/udev/rules.d/99-coolerdash.rules" ]; then + echo "βœ… Udev rules installed" + else + echo "❌ Udev rules not found" + exit 1 + fi + + # Check license file (Arch packaging guideline) + if [ -f "/tmp/install-test/usr/share/licenses/coolerdash/LICENSE" ]; then + echo "βœ… License file installed (/usr/share/licenses/)" + else + echo "❌ License file not found at /usr/share/licenses/coolerdash/" + exit 1 + fi + echo "βœ… Arch Linux installation test completed (reference)" # Summary report diff --git a/Makefile b/Makefile index 473f661..bf83d6a 100644 --- a/Makefile +++ b/Makefile @@ -98,7 +98,7 @@ clean: rm -rf $(OBJDIR) $(BINDIR) @printf "$(ICON_SUCCESS) $(GREEN)Cleanup completed$(RESET)\n" -# Detect Linux Distribution (internal function) +# Detect Linux distro via release files, os-release as fallback detect-distro: @if [ -f /etc/arch-release ]; then \ echo "arch"; \ @@ -106,15 +106,15 @@ detect-distro: echo "debian"; \ elif [ -f /etc/fedora-release ]; then \ echo "fedora"; \ + elif grep -qi 'opensuse\|suse' /etc/os-release 2>/dev/null; then \ + echo "opensuse"; \ elif [ -f /etc/redhat-release ]; then \ echo "rhel"; \ - elif [ -f /etc/opensuse-release ]; then \ - echo "opensuse"; \ else \ echo "unknown"; \ fi -# Install Dependencies (internal function) +# Install build/runtime deps per distro install-deps: @DISTRO=$$($(MAKE) detect-distro); \ case $$DISTRO in \ @@ -182,7 +182,7 @@ install-deps: ;; \ esac -# Check Dependencies for Installation (internal function called by install) +# Check if required libs are available via pkg-config check-deps: @MISSING=""; \ for dep in cairo libcurl jansson; do \ @@ -197,7 +197,7 @@ check-deps: printf "$(ICON_SUCCESS) $(GREEN)All dependencies found$(RESET)\n"; \ fi -# Install Target - Installs to /etc/coolercontrol/plugins/coolerdash/ (Plugin-mode only, with migration cleanup) +# Install binary to /usr/libexec, plugin data to /etc/coolercontrol/plugins/coolerdash/ install: check-deps $(TARGET) @printf "\n" @printf "$(ICON_INSTALL) $(WHITE)═══ COOLERDASH INSTALLATION ═══$(RESET)\n" @@ -206,47 +206,47 @@ install: check-deps $(TARGET) printf "$(ICON_SERVICE) $(CYAN)Migration: Checking for legacy files and services...$(RESET)\n"; \ LEGACY_FOUND=0; \ if $(SUDO) systemctl is-active --quiet coolerdash.service 2>/dev/null; then \ - $(SUDO) systemctl stop coolerdash.service 2>/dev/null || true; \ + $(SUDO) systemctl stop coolerdash.service; \ LEGACY_FOUND=1; \ fi; \ if $(SUDO) systemctl is-enabled --quiet coolerdash.service 2>/dev/null; then \ - $(SUDO) systemctl disable coolerdash.service 2>/dev/null || true; \ + $(SUDO) systemctl disable coolerdash.service; \ LEGACY_FOUND=1; \ fi; \ if [ -f /etc/systemd/system/coolerdash.service ]; then \ - $(SUDO) rm -f /etc/systemd/system/coolerdash.service 2>/dev/null || true; \ + $(SUDO) rm -f /etc/systemd/system/coolerdash.service; \ LEGACY_FOUND=1; \ fi; \ if [ -d /opt/coolerdash ]; then \ - $(SUDO) rm -rf /opt/coolerdash 2>/dev/null || true; \ + $(SUDO) rm -rf /opt/coolerdash; \ LEGACY_FOUND=1; \ fi; \ if [ -d /etc/coolerdash ]; then \ - $(SUDO) rm -rf /etc/coolerdash 2>/dev/null || true; \ + $(SUDO) rm -rf /etc/coolerdash; \ LEGACY_FOUND=1; \ fi; \ if [ -f /etc/coolercontrol/plugins/coolerdash/config.ini ]; then \ - $(SUDO) rm -f /etc/coolercontrol/plugins/coolerdash/config.ini 2>/dev/null || true; \ + $(SUDO) rm -f /etc/coolercontrol/plugins/coolerdash/config.ini; \ LEGACY_FOUND=1; \ fi; \ if [ -f /etc/coolercontrol/plugins/coolerdash/ui.html ]; then \ - $(SUDO) rm -f /etc/coolercontrol/plugins/coolerdash/ui.html 2>/dev/null || true; \ + $(SUDO) rm -f /etc/coolercontrol/plugins/coolerdash/ui.html; \ LEGACY_FOUND=1; \ fi; \ if [ -f /usr/share/applications/coolerdash-settings.desktop ]; then \ - $(SUDO) rm -f /usr/share/applications/coolerdash-settings.desktop 2>/dev/null || true; \ + $(SUDO) rm -f /usr/share/applications/coolerdash-settings.desktop; \ LEGACY_FOUND=1; \ fi; \ if [ -L /bin/coolerdash ] || [ -f /bin/coolerdash ]; then \ - $(SUDO) rm -f /bin/coolerdash 2>/dev/null || true; \ + $(SUDO) rm -f /bin/coolerdash; \ LEGACY_FOUND=1; \ fi; \ if [ -L /usr/bin/coolerdash ] || [ -f /usr/bin/coolerdash ]; then \ - $(SUDO) rm -f /usr/bin/coolerdash 2>/dev/null || true; \ + $(SUDO) rm -f /usr/bin/coolerdash; \ LEGACY_FOUND=1; \ fi; \ - if id -u coolerdash &>/dev/null 2>&1; then \ - $(SUDO) userdel -rf coolerdash 2>/dev/null || true; \ + if id -u coolerdash >/dev/null 2>&1; then \ + $(SUDO) userdel -rf coolerdash; \ LEGACY_FOUND=1; \ fi; \ if [ "$$LEGACY_FOUND" -eq 1 ]; then \ @@ -272,34 +272,24 @@ install: check-deps $(TARGET) printf "$(ICON_INFO) $(YELLOW)Migration skipped (CI environment).$(RESET)\n" >/dev/null 2>&1; \ fi @printf "\n" - @printf "$(ICON_INFO) $(CYAN)Installing plugin files to /etc/coolercontrol/plugins/coolerdash/...$(RESET)\n" + @printf "$(ICON_INFO) $(CYAN)Installing plugin files...$(RESET)\n" @install -dm755 "$(DESTDIR)/etc/coolercontrol/plugins/coolerdash" - @install -m755 $(BINDIR)/$(TARGET) "$(DESTDIR)/etc/coolercontrol/plugins/coolerdash/coolerdash" + @install -Dm755 $(BINDIR)/$(TARGET) "$(DESTDIR)/usr/libexec/coolerdash/coolerdash" @install -m644 $(README) "$(DESTDIR)/etc/coolercontrol/plugins/coolerdash/README.md" - @install -m644 LICENSE "$(DESTDIR)/etc/coolercontrol/plugins/coolerdash/LICENSE" @install -m644 CHANGELOG.md "$(DESTDIR)/etc/coolercontrol/plugins/coolerdash/CHANGELOG.md" @install -m644 VERSION "$(DESTDIR)/etc/coolercontrol/plugins/coolerdash/VERSION" @install -m666 etc/coolercontrol/plugins/coolerdash/config.json "$(DESTDIR)/etc/coolercontrol/plugins/coolerdash/config.json" - @# Create ui directory first with correct permissions @install -dm755 "$(DESTDIR)/etc/coolercontrol/plugins/coolerdash/ui" @install -m644 etc/coolercontrol/plugins/coolerdash/ui/index.html "$(DESTDIR)/etc/coolercontrol/plugins/coolerdash/ui/index.html" @install -m644 etc/coolercontrol/plugins/coolerdash/ui/cc-plugin-lib.js "$(DESTDIR)/etc/coolercontrol/plugins/coolerdash/ui/cc-plugin-lib.js" @install -m644 images/shutdown.png "$(DESTDIR)/etc/coolercontrol/plugins/coolerdash/shutdown.png" @install -m644 $(MANIFEST) "$(DESTDIR)/etc/coolercontrol/plugins/coolerdash/manifest.toml" - @# Substitute VERSION placeholder in manifest.toml during install @sed -i 's/{{VERSION}}/$(VERSION)/g' "$(DESTDIR)/etc/coolercontrol/plugins/coolerdash/manifest.toml" - @install -dm755 "$(DESTDIR)/etc/systemd/system/cc-plugin-coolerdash.service.d" - @# Create systemd drop-in for startup delay (allow shutdown.png to display) - @if [ "$(REALOS)" = "yes" ]; then \ - $(SUDO) mkdir -p /etc/systemd/system/cc-plugin-coolerdash.service.d 2>/dev/null || true; \ - $(SUDO) sh -c 'printf "[Service]\nExecStartPre=/bin/sleep 10\nExecStopPre=/bin/sleep 10\nExecStop=/bin/sleep 10\nTimeoutStopSec=10\n" > /etc/systemd/system/cc-plugin-coolerdash.service.d/startup-delay.conf' 2>/dev/null || true; \ - $(SUDO) chmod 644 /etc/systemd/system/cc-plugin-coolerdash.service.d/startup-delay.conf 2>/dev/null || true; \ - printf " $(GREEN)Drop-in:$(RESET) /etc/systemd/system/cc-plugin-coolerdash.service.d/startup-delay.conf\n"; \ - $(SUDO) sh -c 'printf "[Unit]\nDescription=CoolerDash helper daemon\nBindsTo=coolercontrold.service\nPartOf=coolercontrold.service\nAfter=coolercontrold.service\n\n[Service]\nType=simple\nExecStart=/bin/sleep infinity\nExecStop=/etc/coolercontrol/plugins/coolerdash/coolerdash --shutdown\nTimeoutStopSec=3\nRestart=no\n\n[Install]\nWantedBy=multi-user.target\n" > /etc/systemd/system/coolerdash-helperd.service' 2>/dev/null || true; \ - $(SUDO) chmod 644 /etc/systemd/system/coolerdash-helperd.service 2>/dev/null || true; \ - printf " $(GREEN)Drop-in:$(RESET) /etc/systemd/system/coolerdash-helperd.service.d\n"; \ - fi - @printf " $(GREEN)Binary:$(RESET) $(DESTDIR)/etc/coolercontrol/plugins/coolerdash/coolerdash\n" + @install -Dm644 etc/systemd/cc-plugin-coolerdash.service.d/startup-delay.conf "$(DESTDIR)/etc/systemd/system/cc-plugin-coolerdash.service.d/startup-delay.conf" + @install -Dm644 etc/systemd/coolerdash-helperd.service "$(DESTDIR)/usr/lib/systemd/system/coolerdash-helperd.service" + @printf " $(GREEN)Drop-in:$(RESET) $(DESTDIR)/etc/systemd/system/cc-plugin-coolerdash.service.d/startup-delay.conf\n" + @printf " $(GREEN)Service:$(RESET) $(DESTDIR)/usr/lib/systemd/system/coolerdash-helperd.service\n" + @printf " $(GREEN)Binary:$(RESET) $(DESTDIR)/usr/libexec/coolerdash/coolerdash\n" @printf " $(GREEN)Config JSON:$(RESET) $(DESTDIR)/etc/coolercontrol/plugins/coolerdash/config.json\n" @printf " $(GREEN)Web UI:$(RESET) $(DESTDIR)/etc/coolercontrol/plugins/coolerdash/ui/index.html\n" @printf " $(GREEN)Plugin Lib:$(RESET) $(DESTDIR)/etc/coolercontrol/plugins/coolerdash/ui/cc-plugin-lib.js\n" @@ -307,11 +297,14 @@ install: check-deps $(TARGET) @printf " $(GREEN)Image:$(RESET) shutdown.png (coolerdash.png)\n" @printf " $(GREEN)Documentation:$(RESET) README.md, LICENSE, CHANGELOG.md, VERSION\n" @printf "\n" - @printf "$(ICON_INFO) $(CYAN)Note: Plugin binary is available at /etc/coolercontrol/plugins/coolerdash/coolerdash$(RESET)\\n" + @printf "$(ICON_INFO) $(CYAN)Note: Plugin binary is available at /usr/libexec/coolerdash/coolerdash$(RESET)\\n" @printf "\n" @printf "$(ICON_SERVICE) $(CYAN)Installing documentation...$(RESET)\n" @install -Dm644 $(MANPAGE) "$(DESTDIR)/usr/share/man/man1/coolerdash.1" @printf " $(GREEN)Manual:$(RESET) $(DESTDIR)/usr/share/man/man1/coolerdash.1\n" + @printf "$(ICON_SERVICE) $(CYAN)Installing license...$(RESET)\n" + @install -Dm644 LICENSE "$(DESTDIR)/usr/share/licenses/coolerdash/LICENSE" + @printf " $(GREEN)License:$(RESET) $(DESTDIR)/usr/share/licenses/coolerdash/LICENSE\n" @printf "$(ICON_SERVICE) $(CYAN)Installing desktop shortcut...$(RESET)\n" @install -Dm644 etc/applications/coolerdash.desktop "$(DESTDIR)/usr/share/applications/coolerdash.desktop" @printf " $(GREEN)Shortcut:$(RESET) $(DESTDIR)/usr/share/applications/coolerdash.desktop\n" @@ -354,69 +347,71 @@ uninstall: @if [ "$(REALOS)" = "yes" ]; then \ LEGACY_FOUND=0; \ if $(SUDO) systemctl is-active --quiet coolerdash.service 2>/dev/null; then \ - $(SUDO) systemctl stop coolerdash.service >/dev/null 2>&1 || true; \ + $(SUDO) systemctl stop coolerdash.service; \ LEGACY_FOUND=1; \ fi; \ if $(SUDO) systemctl is-enabled --quiet coolerdash.service 2>/dev/null; then \ - $(SUDO) systemctl disable coolerdash.service >/dev/null 2>&1 || true; \ + $(SUDO) systemctl disable coolerdash.service; \ LEGACY_FOUND=1; \ fi; \ if [ -f /etc/systemd/system/coolerdash.service ]; then \ - $(SUDO) rm -f /etc/systemd/system/coolerdash.service >/dev/null 2>&1 || true; \ + $(SUDO) rm -f /etc/systemd/system/coolerdash.service; \ LEGACY_FOUND=1; \ fi; \ if [ -d /opt/coolerdash ]; then \ - $(SUDO) rm -rf /opt/coolerdash >/dev/null 2>&1 || true; \ + $(SUDO) rm -rf /opt/coolerdash; \ LEGACY_FOUND=1; \ fi; \ if [ -d /etc/coolerdash ]; then \ - $(SUDO) rm -rf /etc/coolerdash >/dev/null 2>&1 || true; \ + $(SUDO) rm -rf /etc/coolerdash; \ LEGACY_FOUND=1; \ fi; \ if [ -f /etc/coolercontrol/plugins/coolerdash/config.ini ]; then \ - $(SUDO) rm -f /etc/coolercontrol/plugins/coolerdash/config.ini >/dev/null 2>&1 || true; \ + $(SUDO) rm -f /etc/coolercontrol/plugins/coolerdash/config.ini; \ LEGACY_FOUND=1; \ fi; \ if [ -f /etc/coolercontrol/plugins/coolerdash/ui.html ]; then \ - $(SUDO) rm -f /etc/coolercontrol/plugins/coolerdash/ui.html >/dev/null 2>&1 || true; \ + $(SUDO) rm -f /etc/coolercontrol/plugins/coolerdash/ui.html; \ LEGACY_FOUND=1; \ fi; \ if [ -f /usr/share/applications/coolerdash-settings.desktop ]; then \ - $(SUDO) rm -f /usr/share/applications/coolerdash-settings.desktop 2>/dev/null || true; \ + $(SUDO) rm -f /usr/share/applications/coolerdash-settings.desktop; \ LEGACY_FOUND=1; \ fi; \ if [ -L /bin/coolerdash ] || [ -f /bin/coolerdash ]; then \ - $(SUDO) rm -f /bin/coolerdash >/dev/null 2>&1 || true; \ + $(SUDO) rm -f /bin/coolerdash; \ LEGACY_FOUND=1; \ fi; \ if [ -L /usr/bin/coolerdash ] || [ -f /usr/bin/coolerdash ]; then \ - $(SUDO) rm -f /usr/bin/coolerdash >/dev/null 2>&1 || true; \ + $(SUDO) rm -f /usr/bin/coolerdash; \ LEGACY_FOUND=1; \ fi; \ - if id -u coolerdash &>/dev/null 2>&1; then \ - $(SUDO) userdel -rf coolerdash >/dev/null 2>&1 || true; \ + if id -u coolerdash >/dev/null 2>&1; then \ + $(SUDO) userdel -rf coolerdash; \ LEGACY_FOUND=1; \ fi; \ fi - @# Remove systemd drop-in directory @if [ "$(REALOS)" = "yes" ]; then \ - $(SUDO) rm -rf /etc/systemd/system/cc-plugin-coolerdash.service.d >/dev/null 2>&1 || true; \ - $(SUDO) rm -f /etc/systemd/system/coolerdash-helperd.service >/dev/null 2>&1 || true; \ + $(SUDO) rm -f /etc/systemd/system/coolerdash-helperd.service; \ fi - @$(SUDO) rm -rf "$(DESTDIR)/etc/coolercontrol/plugins/coolerdash" >/dev/null 2>&1 || true - @$(SUDO) rm -f "$(DESTDIR)/usr/share/man/man1/coolerdash.1" >/dev/null 2>&1 || true - @$(SUDO) rm -f "$(DESTDIR)/usr/share/applications/coolerdash.desktop" >/dev/null 2>&1 || true + @$(SUDO) rm -f "$(DESTDIR)/usr/lib/systemd/system/coolerdash-helperd.service" || true + @$(SUDO) rm -rf "$(DESTDIR)/etc/systemd/system/cc-plugin-coolerdash.service.d" || true + @$(SUDO) rm -rf "$(DESTDIR)/etc/coolercontrol/plugins/coolerdash" || true + @$(SUDO) rm -rf "$(DESTDIR)/usr/libexec/coolerdash" || true + @$(SUDO) rm -rf "$(DESTDIR)/usr/share/licenses/coolerdash" || true + @$(SUDO) rm -f "$(DESTDIR)/usr/share/man/man1/coolerdash.1" || true + @$(SUDO) rm -f "$(DESTDIR)/usr/share/applications/coolerdash.desktop" || true @printf "$(ICON_CLEAN) $(CYAN)Removing udev rule...$(RESET)\n" - @$(SUDO) rm -f "$(DESTDIR)/usr/lib/udev/rules.d/99-coolerdash.rules" 2>/dev/null || true + @$(SUDO) rm -f "$(DESTDIR)/usr/lib/udev/rules.d/99-coolerdash.rules" || true @if [ "$(REALOS)" = "yes" ]; then \ $(SUDO) udevadm control --reload-rules 2>/dev/null || true; \ $(SUDO) udevadm trigger --subsystem-match=usb 2>/dev/null || true; \ printf " $(GREEN)βœ“$(RESET) udev rules reloaded\n"; \ fi - @$(SUDO) rm -f "$(DESTDIR)/usr/share/icons/hicolor/scalable/apps/coolerdash.svg" >/dev/null 2>&1 || true + @$(SUDO) rm -f "$(DESTDIR)/usr/share/icons/hicolor/scalable/apps/coolerdash.svg" || true @if [ "$(REALOS)" = "yes" ]; then \ - if id -u coolerdash &>/dev/null; then \ - $(SUDO) userdel -rf coolerdash >/dev/null 2>&1 || true; \ + if id -u coolerdash >/dev/null 2>&1; then \ + $(SUDO) userdel -rf coolerdash; \ fi; \ $(SUDO) mandb -q >/dev/null 2>&1 || true; \ $(SUDO) systemctl daemon-reload >/dev/null 2>&1 || true; \ @@ -448,7 +443,7 @@ help: @printf " $(GREEN)make debug$(RESET) - Debug build with AddressSanitizer\n" @printf "\n" @printf "$(YELLOW)πŸ“¦ Installation:$(RESET)\n" - @printf " $(GREEN)make install$(RESET) - Installs to /etc/coolercontrol/plugins/coolerdash/ as Plugin\n" + @printf " $(GREEN)make install$(RESET) - Installs binary + plugin data + systemd units\n" @printf " $(GREEN)make uninstall$(RESET)- Uninstalls the program\n" @printf "\n" @printf "$(YELLOW)βš™οΈ Plugin Management:$(RESET)\n" @@ -466,7 +461,7 @@ help: @printf " $(GREEN)README.md$(RESET) - πŸ‡ΊπŸ‡Έ English (main documentation)\n" @printf "\n" @printf "$(YELLOW)πŸ”„ Version Usage:$(RESET)\n" - @printf " $(GREEN)Program:$(RESET) /etc/coolercontrol/plugins/coolerdash/coolerdash [mode]\n" + @printf " $(GREEN)Program:$(RESET) /usr/libexec/coolerdash/coolerdash [mode]\n" @printf " $(GREEN)Config:$(RESET) /etc/coolercontrol/plugins/coolerdash/config.json\n" @printf " $(GREEN)Web UI:$(RESET) CoolerControl Plugin Settings\n" @printf "\n" diff --git a/PKGBUILD b/PKGBUILD index acb6c07..2309d65 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -56,6 +56,9 @@ build() { cp -a etc/applications/coolerdash.desktop "${srcdir}/etc/applications/" cp -a etc/icons/coolerdash.svg "${srcdir}/etc/icons/" cp -a etc/udev/rules.d/99-coolerdash.rules "${srcdir}/etc/udev/rules.d/" + mkdir -p "${srcdir}/etc/systemd/cc-plugin-coolerdash.service.d" + cp -a etc/systemd/coolerdash-helperd.service "${srcdir}/etc/systemd/" + cp -a etc/systemd/cc-plugin-coolerdash.service.d/startup-delay.conf "${srcdir}/etc/systemd/cc-plugin-coolerdash.service.d/" } check() { @@ -72,33 +75,28 @@ check() { } package() { - # Plugin-mode installation: Everything in /etc/coolercontrol/plugins/coolerdash/ + # Binary to /usr/libexec, plugin data stays in /etc/coolercontrol/plugins/ install -dm755 "${pkgdir}/etc/coolercontrol/plugins/coolerdash" - install -Dm755 "${srcdir}/bin/coolerdash" "${pkgdir}/etc/coolercontrol/plugins/coolerdash/coolerdash" + install -Dm755 "${srcdir}/bin/coolerdash" "${pkgdir}/usr/libexec/coolerdash/coolerdash" install -Dm644 "${srcdir}/README.md" "${pkgdir}/etc/coolercontrol/plugins/coolerdash/README.md" install -Dm644 "${srcdir}/VERSION" "${pkgdir}/etc/coolercontrol/plugins/coolerdash/VERSION" - install -Dm644 "${srcdir}/LICENSE" "${pkgdir}/etc/coolercontrol/plugins/coolerdash/LICENSE" install -Dm644 "${srcdir}/CHANGELOG.md" "${pkgdir}/etc/coolercontrol/plugins/coolerdash/CHANGELOG.md" install -Dm666 "${srcdir}/etc/coolercontrol/plugins/coolerdash/config.json" "${pkgdir}/etc/coolercontrol/plugins/coolerdash/config.json" - # Create ui directory first with correct permissions install -dm755 "${pkgdir}/etc/coolercontrol/plugins/coolerdash/ui" install -m644 "${srcdir}/etc/coolercontrol/plugins/coolerdash/ui/index.html" "${pkgdir}/etc/coolercontrol/plugins/coolerdash/ui/index.html" install -m644 "${srcdir}/etc/coolercontrol/plugins/coolerdash/ui/cc-plugin-lib.js" "${pkgdir}/etc/coolercontrol/plugins/coolerdash/ui/cc-plugin-lib.js" install -Dm644 "${srcdir}/images/shutdown.png" "${pkgdir}/etc/coolercontrol/plugins/coolerdash/shutdown.png" install -Dm644 "${srcdir}/etc/coolercontrol/plugins/coolerdash/manifest.toml" "${pkgdir}/etc/coolercontrol/plugins/coolerdash/manifest.toml" - # Substitute VERSION placeholder in manifest.toml sed -i "s/{{VERSION}}/${pkgver}/g" "${pkgdir}/etc/coolercontrol/plugins/coolerdash/manifest.toml" - # Manual page install -Dm644 "${srcdir}/man/coolerdash.1" "${pkgdir}/usr/share/man/man1/coolerdash.1" - # Desktop shortcut for settings UI install -Dm644 "${srcdir}/etc/applications/coolerdash.desktop" "${pkgdir}/usr/share/applications/coolerdash.desktop" - - # USB power management udev rule for install -Dm644 "${srcdir}/etc/udev/rules.d/99-coolerdash.rules" "${pkgdir}/usr/lib/udev/rules.d/99-coolerdash.rules" - - # Application icon install -Dm644 "${srcdir}/etc/icons/coolerdash.svg" "${pkgdir}/usr/share/icons/hicolor/scalable/apps/coolerdash.svg" + install -Dm644 "${srcdir}/etc/systemd/coolerdash-helperd.service" "${pkgdir}/usr/lib/systemd/system/coolerdash-helperd.service" + install -Dm644 "${srcdir}/etc/systemd/cc-plugin-coolerdash.service.d/startup-delay.conf" "${pkgdir}/etc/systemd/system/cc-plugin-coolerdash.service.d/startup-delay.conf" + + install -Dm644 "${srcdir}/LICENSE" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE" } diff --git a/README.md b/README.md index 6ae9a11..3cecdaa 100644 --- a/README.md +++ b/README.md @@ -130,12 +130,12 @@ systemctl status coolercontrold curl http://localhost:11987/devices # 2. Test CoolerDash manually (with clean output) -/etc/coolercontrol/plugins/coolerdash/coolerdash +/usr/libexec/coolerdash/coolerdash # 3. Test CoolerDash with detailed verbose logging -/etc/coolercontrol/plugins/coolerdash/coolerdash --verbose +/usr/libexec/coolerdash/coolerdash --verbose # or short form: -/etc/coolercontrol/plugins/coolerdash/coolerdash -v +/usr/libexec/coolerdash/coolerdash -v # 4. Debug build and installation (recommended) # Option A β€” Build and install with ASan in one command (safe): @@ -143,7 +143,7 @@ sudo make debug install # Option B β€” Build as your user and install the debug binary manually (recommended): make clean && make debug -sudo install -Dm755 bin/coolerdash /etc/coolercontrol/plugins/coolerdash/coolerdash +sudo install -Dm755 bin/coolerdash /usr/libexec/coolerdash/coolerdash # Notes: # β€’ Avoid running `make debug` followed by `sudo make install` β€” the separate `sudo make install` may trigger a rebuild without debug flags and cause linker errors (missing ASan symbols). diff --git a/VERSION b/VERSION index c043eea..b1b25a5 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.2.1 +2.2.2 diff --git a/aur/PKGBUILD b/aur/PKGBUILD index 0c69693..6f0dfc2 100644 --- a/aur/PKGBUILD +++ b/aur/PKGBUILD @@ -56,34 +56,28 @@ check() { } package() { - # Plugin-mode installation: Everything in /etc/coolercontrol/plugins/coolerdash/ + # Binary to /usr/libexec, plugin data stays in /etc/coolercontrol/plugins/ install -dm755 "${pkgdir}/etc/coolercontrol/plugins/coolerdash" - install -m755 "${srcdir}/coolerdash/bin/coolerdash" "${pkgdir}/etc/coolercontrol/plugins/coolerdash/coolerdash" + install -Dm755 "${srcdir}/coolerdash/bin/coolerdash" "${pkgdir}/usr/libexec/coolerdash/coolerdash" install -m644 "${srcdir}/coolerdash/README.md" "${pkgdir}/etc/coolercontrol/plugins/coolerdash/README.md" install -m644 "${srcdir}/coolerdash/VERSION" "${pkgdir}/etc/coolercontrol/plugins/coolerdash/VERSION" - install -m644 "${srcdir}/coolerdash/LICENSE" "${pkgdir}/etc/coolercontrol/plugins/coolerdash/LICENSE" install -m644 "${srcdir}/coolerdash/CHANGELOG.md" "${pkgdir}/etc/coolercontrol/plugins/coolerdash/CHANGELOG.md" install -m666 "${srcdir}/coolerdash/etc/coolercontrol/plugins/coolerdash/config.json" "${pkgdir}/etc/coolercontrol/plugins/coolerdash/config.json" - # Create ui directory first with correct permissions install -dm755 "${pkgdir}/etc/coolercontrol/plugins/coolerdash/ui" install -m644 "${srcdir}/coolerdash/etc/coolercontrol/plugins/coolerdash/ui/index.html" "${pkgdir}/etc/coolercontrol/plugins/coolerdash/ui/index.html" install -m644 "${srcdir}/coolerdash/etc/coolercontrol/plugins/coolerdash/ui/cc-plugin-lib.js" "${pkgdir}/etc/coolercontrol/plugins/coolerdash/ui/cc-plugin-lib.js" install -m644 "${srcdir}/coolerdash/images/shutdown.png" "${pkgdir}/etc/coolercontrol/plugins/coolerdash/shutdown.png" install -m644 "${srcdir}/coolerdash/etc/coolercontrol/plugins/coolerdash/manifest.toml" "${pkgdir}/etc/coolercontrol/plugins/coolerdash/manifest.toml" - # Substitute VERSION placeholder in manifest.toml sed -i "s/{{VERSION}}/${pkgver}/g" "${pkgdir}/etc/coolercontrol/plugins/coolerdash/manifest.toml" - # Manual page install -Dm644 "${srcdir}/coolerdash/man/coolerdash.1" "${pkgdir}/usr/share/man/man1/coolerdash.1" - - # Desktop shortcut for settings UI install -Dm644 "${srcdir}/coolerdash/etc/applications/coolerdash.desktop" "${pkgdir}/usr/share/applications/coolerdash.desktop" - - # USB power management udev rule for install -Dm644 "${srcdir}/coolerdash/etc/udev/rules.d/99-coolerdash.rules" "${pkgdir}/usr/lib/udev/rules.d/99-coolerdash.rules" - - # Application icon install -Dm644 "${srcdir}/coolerdash/etc/icons/coolerdash.svg" "${pkgdir}/usr/share/icons/hicolor/scalable/apps/coolerdash.svg" + install -Dm644 "${srcdir}/coolerdash/etc/systemd/coolerdash-helperd.service" "${pkgdir}/usr/lib/systemd/system/coolerdash-helperd.service" + install -Dm644 "${srcdir}/coolerdash/etc/systemd/cc-plugin-coolerdash.service.d/startup-delay.conf" "${pkgdir}/etc/systemd/system/cc-plugin-coolerdash.service.d/startup-delay.conf" + + install -Dm644 "${srcdir}/coolerdash/LICENSE" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE" } diff --git a/aur/coolerdash.install b/aur/coolerdash.install index a47dbb4..248a68c 100644 --- a/aur/coolerdash.install +++ b/aur/coolerdash.install @@ -1,224 +1,118 @@ # Created by: damachin3 (damachine3 at proton dot me) # Website: https://github.com/damachine/coolerdash -pre_install() { - echo "Checking for legacy files and performing migration cleanup..." 2>/dev/null - # Stop and disable service before install or update to prevent conflicts with plugin mode - if systemctl list-unit-files coolerdash.service 2>/dev/null || systemctl list-unit-files coolerdash.service 2>/dev/null; then - echo "Stopping coolerdash service..." 2>/dev/null - systemctl stop coolerdash.service 2>/dev/null - echo "Disabling coolerdash service (CoolerControl plugin mode preferred)..." 2>/dev/null - systemctl disable coolerdash.service 2>/dev/null - fi - - # Remove old systemd service file if it exists (migration from standalone to plugin mode) - if [ -f /etc/systemd/system/coolerdash.service ]; then - echo "Removing deprecated systemd service file..." 2>/dev/null - rm -f /etc/systemd/system/coolerdash.service 2>/dev/null - fi - - # Remove legacy installation directories if they exist - if [ -d /opt/coolerdash ]; then - echo "Removing legacy installation: /opt/coolerdash/" 2>/dev/null - rm -rf /opt/coolerdash 2>/dev/null - fi +# Pacman install hooks for local PKGBUILD - # Remove legacy config directory if it exists - if [ -d /etc/coolerdash ]; then - echo "Removing legacy config: /etc/coolerdash/" 2>/dev/null - rm -rf /etc/coolerdash 2>/dev/null +pre_install() { + # Stop legacy standalone service + if systemctl list-unit-files coolerdash.service >/dev/null 2>&1; then + systemctl stop coolerdash.service + systemctl disable coolerdash.service fi - # Remove legacy config.ini and ui.html if they exist in plugin directory - if [ -f /etc/coolercontrol/plugins/coolerdash/config.ini ]; then - echo "Removing legacy config.ini..." 2>/dev/null - rm -f /etc/coolercontrol/plugins/coolerdash/config.ini 2>/dev/null - fi - if [ -f /etc/coolercontrol/plugins/coolerdash/ui.html ]; then - echo "Removing legacy ui.html..." 2>/dev/null - rm -f /etc/coolercontrol/plugins/coolerdash/ui.html 2>/dev/null - fi - if [ -f /usr/share/applications/coolerdash-settings.desktop ]; then - echo "Removing legacy coolerdash-settings.desktop..." 2>/dev/null - rm -f /usr/share/applications/coolerdash-settings.desktop 2>/dev/null - fi + # Remove legacy files + rm -f /etc/systemd/system/coolerdash.service + rm -rf /opt/coolerdash + rm -rf /etc/coolerdash + rm -f /etc/coolercontrol/plugins/coolerdash/config.ini + rm -f /etc/coolercontrol/plugins/coolerdash/ui.html + rm -f /usr/share/applications/coolerdash-settings.desktop + rm -f /bin/coolerdash + rm -f /usr/bin/coolerdash - # Remove legacy user if it exists + # Remove legacy user if id -u coolerdash &>/dev/null; then - echo "Removing legacy coolerdash user..." 2>/dev/null - userdel -rf coolerdash 2>/dev/null || true - fi - - # Remove legacy symlinks in /bin/ and /usr/bin/ if they exist (migration from standalone) - if [ -L /bin/coolerdash ] || [ -f /bin/coolerdash ]; then - echo "Removing legacy symlink: /bin/coolerdash" - rm -f /bin/coolerdash - fi - if [ -L /usr/bin/coolerdash ] || [ -f /usr/bin/coolerdash ]; then - echo "Removing legacy symlink: /usr/bin/coolerdash" - rm -f /usr/bin/coolerdash + userdel -rf coolerdash fi } post_install() { - # Ensure plugin directory files have correct permissions - if [ -d /etc/coolercontrol/plugins/coolerdash ]; then - echo "Plugin directory permissions configured" - chmod 755 /etc/coolercontrol/plugins/coolerdash 2>/dev/null || true - chmod 755 /etc/coolercontrol/plugins/coolerdash/coolerdash 2>/dev/null || true - chmod 644 /etc/coolercontrol/plugins/coolerdash/*.md 2>/dev/null || true - chmod 644 /etc/coolercontrol/plugins/coolerdash/VERSION 2>/dev/null || true - chmod 644 /etc/coolercontrol/plugins/coolerdash/LICENSE 2>/dev/null || true - chmod 644 /etc/coolercontrol/plugins/coolerdash/*.toml 2>/dev/null || true - chmod 644 /etc/coolercontrol/plugins/coolerdash/*.png 2>/dev/null || true - chmod 666 /etc/coolercontrol/plugins/coolerdash/config.json 2>/dev/null || true - chmod 755 /etc/coolercontrol/plugins/coolerdash/ui 2>/dev/null || true - chmod 644 /etc/coolercontrol/plugins/coolerdash/ui/* 2>/dev/null || true - fi - - # Reload udev rules for USB power management + # Reload udev rules if [ -f /usr/lib/udev/rules.d/99-coolerdash.rules ]; then - echo "Reloading udev rules..." udevadm control --reload-rules 2>/dev/null || true udevadm trigger --subsystem-match=usb 2>/dev/null || true fi - # Create systemd drop-in for startup delay (allow shutdown.png to display) - mkdir -p /etc/systemd/system/cc-plugin-coolerdash.service.d - printf "[Service]\nExecStartPre=/bin/sleep 10\n" > /etc/systemd/system/cc-plugin-coolerdash.service.d/startup-delay.conf - chmod 644 /etc/systemd/system/cc-plugin-coolerdash.service.d/startup-delay.conf - echo "Systemd drop-in created: 10s startup delay" - - # Create/ensure shutdown notifier unit (uses printf to avoid cat heredocs) - printf "[Unit]\nDescription=CoolerDash helper daemon\nBindsTo=coolercontrold.service\nPartOf=coolercontrold.service\nAfter=coolercontrold.service\n\n[Service]\nType=simple\nExecStart=/bin/sleep infinity\nExecStop=/etc/coolercontrol/plugins/coolerdash/coolerdash --shutdown\nTimeoutStopSec=3\nRestart=no\n\n[Install]\nWantedBy=multi-user.target\n" > /etc/systemd/system/coolerdash-helperd.service - chmod 644 /etc/systemd/system/coolerdash-helperd.service || true - echo "Helper unit created: coolerdash-helperd.service" + # Migration: remove old helperd from /etc (now in /usr/lib) + rm -f /etc/systemd/system/coolerdash-helperd.service - # Reload systemd manager configuration systemctl daemon-reload - # Create shutdown notifier unit + # Enable helperd if systemctl list-unit-files coolerdash-helperd.service >/dev/null 2>&1; then - echo "Enabling and starting coolerdash-helperd.service..." - systemctl enable --now coolerdash-helperd.service || echo "Note: coolerdash-helperd.service enable/start failed. Please enable/start manually." + systemctl enable --now coolerdash-helperd.service || echo "Note: coolerdash-helperd.service failed. Enable manually." fi - # Restart CoolerControl to pick up the new plugin + # Restart CoolerControl if systemctl list-unit-files coolercontrold.service >/dev/null 2>&1; then - echo "Restarting CoolerControl service to load new plugin..." - systemctl restart coolercontrold.service || echo "Note: CoolerControl service restart failed. Please restart manually." + systemctl restart coolercontrold.service || echo "Note: CoolerControl restart failed." fi echo "================================================================" - echo "CoolerDash has been installed successfully!" + echo "CoolerDash installed successfully." echo "================================================================" } post_upgrade() { - # Ensure plugin directory files have correct permissions after upgrade - if [ -d /etc/coolercontrol/plugins/coolerdash ]; then - echo "Plugin directory permissions configured" - chmod 755 /etc/coolercontrol/plugins/coolerdash 2>/dev/null || true - chmod 755 /etc/coolercontrol/plugins/coolerdash/coolerdash 2>/dev/null || true - chmod 644 /etc/coolercontrol/plugins/coolerdash/*.md 2>/dev/null || true - chmod 644 /etc/coolercontrol/plugins/coolerdash/VERSION 2>/dev/null || true - chmod 644 /etc/coolercontrol/plugins/coolerdash/LICENSE 2>/dev/null || true - chmod 644 /etc/coolercontrol/plugins/coolerdash/*.toml 2>/dev/null || true - chmod 644 /etc/coolercontrol/plugins/coolerdash/*.png 2>/dev/null || true - chmod 666 /etc/coolercontrol/plugins/coolerdash/config.json 2>/dev/null || true - chmod 755 /etc/coolercontrol/plugins/coolerdash/ui 2>/dev/null || true - chmod 644 /etc/coolercontrol/plugins/coolerdash/ui/* 2>/dev/null || true - fi - - # Create systemd drop-in for startup delay (allow shutdown.png to display) - mkdir -p /etc/systemd/system/cc-plugin-coolerdash.service.d - printf "[Service]\nExecStartPre=/bin/sleep 10\n" > /etc/systemd/system/cc-plugin-coolerdash.service.d/startup-delay.conf - chmod 644 /etc/systemd/system/cc-plugin-coolerdash.service.d/startup-delay.conf - echo "Systemd drop-in updated: 10s startup delay" + # Migration: remove old helperd from /etc (now in /usr/lib) + rm -f /etc/systemd/system/coolerdash-helperd.service - # Create/ensure shutdown notifier unit (uses printf to avoid cat heredocs) - printf "[Unit]\nDescription=CoolerDash helper daemon\nBindsTo=coolercontrold.service\nPartOf=coolercontrold.service\nAfter=coolercontrold.service\n\n[Service]\nType=simple\nExecStart=/bin/sleep infinity\nExecStop=/etc/coolercontrol/plugins/coolerdash/coolerdash --shutdown\nTimeoutStopSec=3\nRestart=no\n\n[Install]\nWantedBy=multi-user.target\n" > /etc/systemd/system/coolerdash-helperd.service - chmod 644 /etc/systemd/system/coolerdash-helperd.service || true - echo "Helper unit updated: coolerdash-helperd.service" - - # Reload systemd manager configuration systemctl daemon-reload - # Create shutdown notifier unit + # Enable helperd if systemctl list-unit-files coolerdash-helperd.service >/dev/null 2>&1; then - echo "Enabling and starting coolerdash-helperd.service..." - systemctl enable --now coolerdash-helperd.service || echo "Note: coolerdash-helperd.service enable/start failed. Please enable/start manually." + systemctl enable --now coolerdash-helperd.service || echo "Note: coolerdash-helperd.service failed. Enable manually." fi - # Restart CoolerDash to pick up the updated plugin + # Restart plugin service if systemctl list-unit-files cc-plugin-coolerdash.service >/dev/null 2>&1; then - echo "Restarting CoolerDash service to load updated plugin..." - systemctl restart cc-plugin-coolerdash.service || echo "Note: CoolerDash service restart failed. Please restart manually." + systemctl restart cc-plugin-coolerdash.service || echo "Note: Plugin restart failed." fi echo "================================================================" - echo "CoolerDash has been upgraded successfully!" + echo "CoolerDash upgraded successfully." echo "================================================================" } pre_remove() { - # Stop and disable service before uninstallation + # Stop legacy standalone service if systemctl is-active --quiet coolerdash.service || systemctl is-enabled --quiet coolerdash.service; then - echo "Stopping coolerdash service..." systemctl stop coolerdash.service - echo "Disabling coolerdash service" systemctl disable coolerdash.service fi - # Stop and disable service before uninstallation + # Stop plugin service if systemctl is-active --quiet cc-plugin-coolerdash.service || systemctl is-enabled --quiet cc-plugin-coolerdash.service; then - echo "Stopping cc-plugin-coolerdash service..." systemctl stop cc-plugin-coolerdash.service - echo "Disabling cc-plugin-coolerdash service" systemctl disable cc-plugin-coolerdash.service fi - # Remove systemd drop-in directory - if [ -d /etc/systemd/system/cc-plugin-coolerdash.service.d ]; then - echo "Removing systemd drop-in directory..." - rm -rf /etc/systemd/system/cc-plugin-coolerdash.service.d || echo "Note: Failed to remove systemd drop-in directory. Please remove manually." - fi - - # Remove notify unit (stop, disable and remove) - if systemctl list-unit-files coolerdash-helperd.service >/dev/null 2>&1; then - echo "Stopping, disabling and removing coolerdash-helperd.service..." - systemctl stop --no-block coolerdash-helperd.service 2>/dev/null || true - systemctl disable --now coolerdash-helperd.service 2>/dev/null || true - rm -f /etc/systemd/system/coolerdash-helperd.service || echo "Note: Failed to remove coolerdash-helperd.service file. Please remove manually." - fi + # Stop and disable helperd (unit file removed by pacman) + systemctl stop --no-block coolerdash-helperd.service 2>/dev/null || true + systemctl disable coolerdash-helperd.service 2>/dev/null || true - # Remove all installed users, files and directories - if id -u coolerdash &>/dev/null; then - echo "Removing legacy coolerdash user..." 2>/dev/null - userdel -rf coolerdash || true - fi - - # Remove old systemd service file if it exists (migration from standalone to plugin mode) - if [ -f /etc/systemd/system/coolerdash.service ]; then - echo "Removing deprecated systemd service file..." - rm -f /etc/systemd/system/coolerdash.service || echo "Note: Failed to remove coolerdash.service file. Please remove manually." - fi - - # Remove legacy installation directories if they exist + # Remove legacy files + rm -f /etc/systemd/system/coolerdash-helperd.service + rm -f /etc/systemd/system/coolerdash.service rm -f /usr/share/applications/coolerdash-settings.desktop rm -f /bin/coolerdash rm -f /usr/bin/coolerdash rm -rf /opt/coolerdash rm -rf /etc/coolerdash + # Remove legacy user + if id -u coolerdash &>/dev/null; then + userdel -rf coolerdash + fi + systemctl daemon-reload - # Restart CoolerControl to remove the plugin + # Restart CoolerControl if systemctl list-unit-files coolercontrold.service >/dev/null 2>&1; then - echo "Restarting CoolerControl service to unload plugin..." - systemctl restart coolercontrold.service || echo "Note: CoolerControl service restart failed. Please restart manually." + systemctl restart coolercontrold.service || echo "Note: CoolerControl restart failed." fi + echo "================================================================" - echo "CoolerDash and all related files have been removed." + echo "CoolerDash removed." echo "================================================================" } diff --git a/coolerdash.install b/coolerdash.install index a3e666f..248a68c 100644 --- a/coolerdash.install +++ b/coolerdash.install @@ -1,227 +1,118 @@ # Created by: damachin3 (damachine3 at proton dot me) # Website: https://github.com/damachine/coolerdash -# This `coolerdash.install` script is for building the coolerdash package from local source. -# It assumes the source code is already present in the current directory. +# Pacman install hooks for local PKGBUILD pre_install() { - echo "Checking for legacy files and performing migration cleanup..." 2>/dev/null - # Stop and disable service before install or update to prevent conflicts with plugin mode - if systemctl list-unit-files coolerdash.service 2>/dev/null || systemctl list-unit-files coolerdash.service 2>/dev/null; then - echo "Stopping coolerdash service..." 2>/dev/null - systemctl stop coolerdash.service 2>/dev/null - echo "Disabling coolerdash service (CoolerControl plugin mode preferred)..." 2>/dev/null - systemctl disable coolerdash.service 2>/dev/null - fi - - # Remove old systemd service file if it exists (migration from standalone to plugin mode) - if [ -f /etc/systemd/system/coolerdash.service ]; then - echo "Removing deprecated systemd service file..." 2>/dev/null - rm -f /etc/systemd/system/coolerdash.service 2>/dev/null - fi - - # Remove legacy installation directories if they exist - if [ -d /opt/coolerdash ]; then - echo "Removing legacy installation: /opt/coolerdash/" 2>/dev/null - rm -rf /opt/coolerdash 2>/dev/null - fi - - # Remove legacy config directory if it exists - if [ -d /etc/coolerdash ]; then - echo "Removing legacy config: /etc/coolerdash/" 2>/dev/null - rm -rf /etc/coolerdash 2>/dev/null + # Stop legacy standalone service + if systemctl list-unit-files coolerdash.service >/dev/null 2>&1; then + systemctl stop coolerdash.service + systemctl disable coolerdash.service fi - # Remove legacy config.ini and ui.html if they exist in plugin directory - if [ -f /etc/coolercontrol/plugins/coolerdash/config.ini ]; then - echo "Removing legacy config.ini..." 2>/dev/null - rm -f /etc/coolercontrol/plugins/coolerdash/config.ini 2>/dev/null - fi - if [ -f /etc/coolercontrol/plugins/coolerdash/ui.html ]; then - echo "Removing legacy ui.html..." 2>/dev/null - rm -f /etc/coolercontrol/plugins/coolerdash/ui.html 2>/dev/null - fi - if [ -f /usr/share/applications/coolerdash-settings.desktop ]; then - echo "Removing legacy coolerdash-settings.desktop..." 2>/dev/null - rm -f /usr/share/applications/coolerdash-settings.desktop 2>/dev/null - fi + # Remove legacy files + rm -f /etc/systemd/system/coolerdash.service + rm -rf /opt/coolerdash + rm -rf /etc/coolerdash + rm -f /etc/coolercontrol/plugins/coolerdash/config.ini + rm -f /etc/coolercontrol/plugins/coolerdash/ui.html + rm -f /usr/share/applications/coolerdash-settings.desktop + rm -f /bin/coolerdash + rm -f /usr/bin/coolerdash - # Remove legacy user if it exists + # Remove legacy user if id -u coolerdash &>/dev/null; then - echo "Removing legacy coolerdash user..." 2>/dev/null - userdel -rf coolerdash 2>/dev/null || true - fi - - # Remove legacy symlinks in /bin/ and /usr/bin/ if they exist (migration from standalone) - if [ -L /bin/coolerdash ] || [ -f /bin/coolerdash ]; then - echo "Removing legacy symlink: /bin/coolerdash" - rm -f /bin/coolerdash - fi - if [ -L /usr/bin/coolerdash ] || [ -f /usr/bin/coolerdash ]; then - echo "Removing legacy symlink: /usr/bin/coolerdash" - rm -f /usr/bin/coolerdash + userdel -rf coolerdash fi } post_install() { - # Ensure plugin directory files have correct permissions - if [ -d /etc/coolercontrol/plugins/coolerdash ]; then - echo "Plugin directory permissions configured" - chmod 755 /etc/coolercontrol/plugins/coolerdash 2>/dev/null || true - chmod 755 /etc/coolercontrol/plugins/coolerdash/coolerdash 2>/dev/null || true - chmod 644 /etc/coolercontrol/plugins/coolerdash/*.md 2>/dev/null || true - chmod 644 /etc/coolercontrol/plugins/coolerdash/VERSION 2>/dev/null || true - chmod 644 /etc/coolercontrol/plugins/coolerdash/LICENSE 2>/dev/null || true - chmod 644 /etc/coolercontrol/plugins/coolerdash/*.toml 2>/dev/null || true - chmod 644 /etc/coolercontrol/plugins/coolerdash/*.png 2>/dev/null || true - chmod 666 /etc/coolercontrol/plugins/coolerdash/config.json 2>/dev/null || true - chmod 755 /etc/coolercontrol/plugins/coolerdash/ui 2>/dev/null || true - chmod 644 /etc/coolercontrol/plugins/coolerdash/ui/* 2>/dev/null || true - fi - - # Reload udev rules for USB power management + # Reload udev rules if [ -f /usr/lib/udev/rules.d/99-coolerdash.rules ]; then - echo "Reloading udev rules..." udevadm control --reload-rules 2>/dev/null || true udevadm trigger --subsystem-match=usb 2>/dev/null || true fi - # Create systemd drop-in for startup delay (allow shutdown.png to display) - mkdir -p /etc/systemd/system/cc-plugin-coolerdash.service.d - printf "[Service]\nExecStartPre=/bin/sleep 10\n" > /etc/systemd/system/cc-plugin-coolerdash.service.d/startup-delay.conf - chmod 644 /etc/systemd/system/cc-plugin-coolerdash.service.d/startup-delay.conf - echo "Systemd drop-in created: 10s startup delay" - - # Create/ensure shutdown notifier unit (uses printf to avoid cat heredocs) - printf "[Unit]\nDescription=CoolerDash helper daemon\nBindsTo=coolercontrold.service\nPartOf=coolercontrold.service\nAfter=coolercontrold.service\n\n[Service]\nType=simple\nExecStart=/bin/sleep infinity\nExecStop=/etc/coolercontrol/plugins/coolerdash/coolerdash --shutdown\nTimeoutStopSec=3\nRestart=no\n\n[Install]\nWantedBy=multi-user.target\n" > /etc/systemd/system/coolerdash-helperd.service - chmod 644 /etc/systemd/system/coolerdash-helperd.service || true - echo "Helper unit created: coolerdash-helperd.service" + # Migration: remove old helperd from /etc (now in /usr/lib) + rm -f /etc/systemd/system/coolerdash-helperd.service - # Reload systemd manager configuration systemctl daemon-reload - # Create shutdown notifier unit + # Enable helperd if systemctl list-unit-files coolerdash-helperd.service >/dev/null 2>&1; then - echo "Enabling and starting coolerdash-helperd.service..." - systemctl enable --now coolerdash-helperd.service || echo "Note: coolerdash-helperd.service enable/start failed. Please enable/start manually." + systemctl enable --now coolerdash-helperd.service || echo "Note: coolerdash-helperd.service failed. Enable manually." fi - # Restart CoolerControl to pick up the new plugin + # Restart CoolerControl if systemctl list-unit-files coolercontrold.service >/dev/null 2>&1; then - echo "Restarting CoolerControl service to load new plugin..." - systemctl restart coolercontrold.service || echo "Note: CoolerControl service restart failed. Please restart manually." + systemctl restart coolercontrold.service || echo "Note: CoolerControl restart failed." fi echo "================================================================" - echo "CoolerDash has been installed successfully!" + echo "CoolerDash installed successfully." echo "================================================================" } post_upgrade() { - # Ensure plugin directory files have correct permissions after upgrade - if [ -d /etc/coolercontrol/plugins/coolerdash ]; then - echo "Plugin directory permissions configured" - chmod 755 /etc/coolercontrol/plugins/coolerdash 2>/dev/null || true - chmod 755 /etc/coolercontrol/plugins/coolerdash/coolerdash 2>/dev/null || true - chmod 644 /etc/coolercontrol/plugins/coolerdash/*.md 2>/dev/null || true - chmod 644 /etc/coolercontrol/plugins/coolerdash/VERSION 2>/dev/null || true - chmod 644 /etc/coolercontrol/plugins/coolerdash/LICENSE 2>/dev/null || true - chmod 644 /etc/coolercontrol/plugins/coolerdash/*.toml 2>/dev/null || true - chmod 644 /etc/coolercontrol/plugins/coolerdash/*.png 2>/dev/null || true - chmod 666 /etc/coolercontrol/plugins/coolerdash/config.json 2>/dev/null || true - chmod 755 /etc/coolercontrol/plugins/coolerdash/ui 2>/dev/null || true - chmod 644 /etc/coolercontrol/plugins/coolerdash/ui/* 2>/dev/null || true - fi - - # Create systemd drop-in for startup delay (allow shutdown.png to display) - mkdir -p /etc/systemd/system/cc-plugin-coolerdash.service.d - printf "[Service]\nExecStartPre=/bin/sleep 10\n" > /etc/systemd/system/cc-plugin-coolerdash.service.d/startup-delay.conf - chmod 644 /etc/systemd/system/cc-plugin-coolerdash.service.d/startup-delay.conf - echo "Systemd drop-in updated: 10s startup delay" + # Migration: remove old helperd from /etc (now in /usr/lib) + rm -f /etc/systemd/system/coolerdash-helperd.service - # Create/ensure shutdown notifier unit (uses printf to avoid cat heredocs) - printf "[Unit]\nDescription=CoolerDash helper daemon\nBindsTo=coolercontrold.service\nPartOf=coolercontrold.service\nAfter=coolercontrold.service\n\n[Service]\nType=simple\nExecStart=/bin/sleep infinity\nExecStop=/etc/coolercontrol/plugins/coolerdash/coolerdash --shutdown\nTimeoutStopSec=3\nRestart=no\n\n[Install]\nWantedBy=multi-user.target\n" > /etc/systemd/system/coolerdash-helperd.service - chmod 644 /etc/systemd/system/coolerdash-helperd.service || true - echo "Helper unit updated: coolerdash-helperd.service" - - # Reload systemd manager configuration systemctl daemon-reload - # Create shutdown notifier unit + # Enable helperd if systemctl list-unit-files coolerdash-helperd.service >/dev/null 2>&1; then - echo "Enabling and starting coolerdash-helperd.service..." - systemctl enable --now coolerdash-helperd.service || echo "Note: coolerdash-helperd.service enable/start failed. Please enable/start manually." + systemctl enable --now coolerdash-helperd.service || echo "Note: coolerdash-helperd.service failed. Enable manually." fi - # Restart CoolerDash to pick up the updated plugin + # Restart plugin service if systemctl list-unit-files cc-plugin-coolerdash.service >/dev/null 2>&1; then - echo "Restarting CoolerDash service to load updated plugin..." - systemctl restart cc-plugin-coolerdash.service || echo "Note: CoolerDash service restart failed. Please restart manually." + systemctl restart cc-plugin-coolerdash.service || echo "Note: Plugin restart failed." fi echo "================================================================" - echo "CoolerDash has been upgraded successfully!" + echo "CoolerDash upgraded successfully." echo "================================================================" } pre_remove() { - # Stop and disable service before uninstallation + # Stop legacy standalone service if systemctl is-active --quiet coolerdash.service || systemctl is-enabled --quiet coolerdash.service; then - echo "Stopping coolerdash service..." systemctl stop coolerdash.service - echo "Disabling coolerdash service" systemctl disable coolerdash.service fi - # Stop and disable service before uninstallation + # Stop plugin service if systemctl is-active --quiet cc-plugin-coolerdash.service || systemctl is-enabled --quiet cc-plugin-coolerdash.service; then - echo "Stopping cc-plugin-coolerdash service..." systemctl stop cc-plugin-coolerdash.service - echo "Disabling cc-plugin-coolerdash service" systemctl disable cc-plugin-coolerdash.service fi - # Remove systemd drop-in directory - if [ -d /etc/systemd/system/cc-plugin-coolerdash.service.d ]; then - echo "Removing systemd drop-in directory..." - rm -rf /etc/systemd/system/cc-plugin-coolerdash.service.d || echo "Note: Failed to remove systemd drop-in directory. Please remove manually." - fi - - # Remove notify unit (stop, disable and remove) - if systemctl list-unit-files coolerdash-helperd.service >/dev/null 2>&1; then - echo "Stopping, disabling and removing coolerdash-helperd.service..." - systemctl stop --no-block coolerdash-helperd.service 2>/dev/null || true - systemctl disable --now coolerdash-helperd.service 2>/dev/null || true - rm -f /etc/systemd/system/coolerdash-helperd.service || echo "Note: Failed to remove coolerdash-helperd.service file. Please remove manually." - fi + # Stop and disable helperd (unit file removed by pacman) + systemctl stop --no-block coolerdash-helperd.service 2>/dev/null || true + systemctl disable coolerdash-helperd.service 2>/dev/null || true - # Remove all installed users, files and directories - if id -u coolerdash &>/dev/null; then - echo "Removing legacy coolerdash user..." 2>/dev/null - userdel -rf coolerdash || true - fi - - # Remove old systemd service file if it exists (migration from standalone to plugin mode) - if [ -f /etc/systemd/system/coolerdash.service ]; then - echo "Removing deprecated systemd service file..." - rm -f /etc/systemd/system/coolerdash.service || echo "Note: Failed to remove coolerdash.service file. Please remove manually." - fi - - # Remove legacy installation directories if they exist + # Remove legacy files + rm -f /etc/systemd/system/coolerdash-helperd.service + rm -f /etc/systemd/system/coolerdash.service rm -f /usr/share/applications/coolerdash-settings.desktop rm -f /bin/coolerdash rm -f /usr/bin/coolerdash rm -rf /opt/coolerdash rm -rf /etc/coolerdash + # Remove legacy user + if id -u coolerdash &>/dev/null; then + userdel -rf coolerdash + fi + systemctl daemon-reload - # Restart CoolerControl to remove the plugin + # Restart CoolerControl if systemctl list-unit-files coolercontrold.service >/dev/null 2>&1; then - echo "Restarting CoolerControl service to unload plugin..." - systemctl restart coolercontrold.service || echo "Note: CoolerControl service restart failed. Please restart manually." + systemctl restart coolercontrold.service || echo "Note: CoolerControl restart failed." fi + echo "================================================================" - echo "CoolerDash and all related files have been removed." + echo "CoolerDash removed." echo "================================================================" } diff --git a/etc/coolercontrol/plugins/coolerdash/manifest.toml b/etc/coolercontrol/plugins/coolerdash/manifest.toml index eb26821..d50e6fe 100644 --- a/etc/coolercontrol/plugins/coolerdash/manifest.toml +++ b/etc/coolercontrol/plugins/coolerdash/manifest.toml @@ -2,7 +2,7 @@ id = "coolerdash" type = "integration" version = "{{VERSION}}" description = "Monitor telemetry data on an AIO liquid cooler with an integrated LCD display" -executable = "/etc/coolercontrol/plugins/coolerdash/coolerdash" +executable = "/usr/libexec/coolerdash/coolerdash" #args = "--verbose" privileged = true url = "https://github.com/damachine/coolerdash" diff --git a/etc/systemd/coolerdash-helperd.service b/etc/systemd/coolerdash-helperd.service index 480b6cc..bd8fe81 100644 --- a/etc/systemd/coolerdash-helperd.service +++ b/etc/systemd/coolerdash-helperd.service @@ -7,7 +7,7 @@ After=coolercontrold.service [Service] Type=simple ExecStart=/bin/sleep infinity -ExecStop=/etc/coolercontrol/plugins/coolerdash/coolerdash --shutdown +ExecStop=/usr/libexec/coolerdash/coolerdash --shutdown TimeoutStopSec=3 Restart=no diff --git a/man/coolerdash.1 b/man/coolerdash.1 index 2bdc44d..9ba53ae 100644 --- a/man/coolerdash.1 +++ b/man/coolerdash.1 @@ -132,7 +132,7 @@ Checked against internal device database. Rectangular (safer fallback for unknown devices). .SS Manual Override You can manually override automatic detection in -.IR /etc/coolercontrol/plugins/coolerdash/config.ini : +.IR /etc/coolercontrol/plugins/coolerdash/config.json : .PP .RS .nf @@ -228,21 +228,21 @@ The plugin is managed by CoolerControl: .PP .RS .nf -.B /etc/coolercontrol/plugins/coolerdash/coolerdash --verbose +.B /usr/libexec/coolerdash/coolerdash --verbose .fi .RE .SS Force dual mode temporarily .PP .RS .nf -.B /etc/coolercontrol/plugins/coolerdash/coolerdash --dual --verbose +.B /usr/libexec/coolerdash/coolerdash --dual --verbose .fi .RE .SS Force circle mode temporarily .PP .RS .nf -.B /etc/coolercontrol/plugins/coolerdash/coolerdash --circle --verbose +.B /usr/libexec/coolerdash/coolerdash --circle --verbose .fi .RE .SS Check CoolerControl device information @@ -285,7 +285,7 @@ The content appears cut off at the edges. Override display shape detection: .PP .RS .nf -Edit /etc/coolercontrol/plugins/coolerdash/config.ini: +Edit /etc/coolercontrol/plugins/coolerdash/config.json: [display] shape = circular .fi @@ -297,7 +297,7 @@ Content appears too small with large margins. Override display shape: .PP .RS .nf -Edit /etc/coolercontrol/plugins/coolerdash/config.ini: +Edit /etc/coolercontrol/plugins/coolerdash/config.json: [display] shape = rectangular .fi @@ -308,16 +308,16 @@ shape = rectangular .nf .B cd /path/to/coolerdash .B make debug -.B /etc/coolercontrol/plugins/coolerdash/coolerdash --verbose +.B /usr/libexec/coolerdash/coolerdash --verbose .fi .RE .SH FILES .TP -.I /etc/coolercontrol/plugins/coolerdash/config.ini +.I /etc/coolercontrol/plugins/coolerdash/config.json Main configuration file. Contains all settings for daemon connection, display properties, layout, colors, fonts, and temperature thresholds. .TP -.I /etc/coolercontrol/plugins/coolerdash/coolerdash +.I /usr/libexec/coolerdash/coolerdash Installed plugin binary executable. .TP .I /etc/coolercontrol/plugins/coolerdash/manifest.toml @@ -360,7 +360,7 @@ Documentation directory containing detailed guides: .SH ENVIRONMENT .B coolerdash does not use environment variables. All configuration is managed through -.IR /etc/coolercontrol/plugins/coolerdash/config.ini . +.IR /etc/coolercontrol/plugins/coolerdash/config.json . .SH EXIT STATUS .TP .B 0 @@ -379,7 +379,7 @@ stops (during shutdown or reboot), it automatically displays the shutdown.png image because sensor data is no longer available. .IP \(bu 3 The CoolerControl service must be restarted after modifying -.I /etc/coolercontrol/plugins/coolerdash/config.ini +.I /etc/coolercontrol/plugins/coolerdash/config.json for changes to take effect. .IP \(bu 3 Verbose logging ( @@ -450,10 +450,10 @@ Report bugs and feature requests at: When reporting bugs, please include: .IP \(bu 3 Output of -.B /etc/coolercontrol/plugins/coolerdash/coolerdash \-\-verbose +.B /usr/libexec/coolerdash/coolerdash \-\-verbose .IP \(bu 3 Content of -.I /etc/coolercontrol/plugins/coolerdash/config.ini +.I /etc/coolercontrol/plugins/coolerdash/config.json .IP \(bu 3 Output of .B "systemctl status coolercontrold" diff --git a/packaging/coolerdash.spec b/packaging/coolerdash.spec index 81e53c2..048a24f 100644 --- a/packaging/coolerdash.spec +++ b/packaging/coolerdash.spec @@ -9,14 +9,17 @@ License: MIT URL: https://github.com/damachine/coolerdash Source0: %{name}-%{version}.tar.gz -# Build dependencies installed via CI workflow -# to support multiple distributions with different package names +# pkgconfig() resolves to correct -devel packages on Fedora and openSUSE +BuildRequires: gcc +BuildRequires: make +BuildRequires: pkgconfig +BuildRequires: pkgconfig(cairo) +BuildRequires: pkgconfig(jansson) +BuildRequires: pkgconfig(libcurl) -Requires: cairo -Requires: libcurl -Requires: jansson +# Shared lib deps (libcairo, libjansson, libcurl) are auto-detected by rpmbuild Requires: google-roboto-fonts -Requires: coolercontrol +Recommends: coolercontrol %description CoolerDash is a high-performance C99 daemon that displays CPU and GPU @@ -38,47 +41,61 @@ make SUDO="" REALOS=no %{?_smp_mflags} %install make install DESTDIR=%{buildroot} SUDO="" REALOS=no -# Compress manpage for RPM standards gzip -9 %{buildroot}/usr/share/man/man1/coolerdash.1 %post -# Set correct permissions for config file if [ -f /etc/coolercontrol/plugins/coolerdash/config.json ]; then chmod 666 /etc/coolercontrol/plugins/coolerdash/config.json fi - -# Restart CoolerControl to register new plugin +# Migration: remove old helperd from /etc (now shipped in /usr/lib) +rm -f /etc/systemd/system/coolerdash-helperd.service if command -v systemctl >/dev/null 2>&1; then + systemctl daemon-reload + systemctl enable --now coolerdash-helperd.service 2>/dev/null || true if systemctl is-active --quiet coolercontrold.service 2>/dev/null; then systemctl restart coolercontrold.service || true fi fi %preun -# Stop CoolerControl to ensure clean plugin removal if command -v systemctl >/dev/null 2>&1; then + systemctl stop --no-block coolerdash-helperd.service 2>/dev/null || true + systemctl disable coolerdash-helperd.service 2>/dev/null || true + systemctl stop cc-plugin-coolerdash.service 2>/dev/null || true if systemctl is-active --quiet coolercontrold.service 2>/dev/null; then systemctl stop coolercontrold.service || true fi fi +%postun +if command -v systemctl >/dev/null 2>&1; then + systemctl daemon-reload + systemctl restart coolercontrold.service 2>/dev/null || true +fi + %files -%license LICENSE %doc README.md CHANGELOG.md -/etc/coolercontrol/plugins/coolerdash/coolerdash -/etc/coolercontrol/plugins/coolerdash/config.json +%dir /usr/share/licenses/%{name} +%license /usr/share/licenses/%{name}/LICENSE +%dir /usr/libexec/coolerdash +/usr/libexec/coolerdash/coolerdash +%dir /etc/coolercontrol/plugins/coolerdash +%config(noreplace) /etc/coolercontrol/plugins/coolerdash/config.json /etc/coolercontrol/plugins/coolerdash/manifest.toml +%dir /etc/coolercontrol/plugins/coolerdash/ui /etc/coolercontrol/plugins/coolerdash/ui/index.html /etc/coolercontrol/plugins/coolerdash/ui/cc-plugin-lib.js /etc/coolercontrol/plugins/coolerdash/shutdown.png /etc/coolercontrol/plugins/coolerdash/README.md -/etc/coolercontrol/plugins/coolerdash/LICENSE /etc/coolercontrol/plugins/coolerdash/CHANGELOG.md /etc/coolercontrol/plugins/coolerdash/VERSION /usr/share/man/man1/coolerdash.1.gz /usr/share/applications/coolerdash.desktop /usr/share/icons/hicolor/scalable/apps/coolerdash.svg /usr/lib/udev/rules.d/99-coolerdash.rules +/usr/lib/systemd/system/coolerdash-helperd.service +%dir /etc/systemd/system/cc-plugin-coolerdash.service.d +/etc/systemd/system/cc-plugin-coolerdash.service.d/startup-delay.conf %changelog * %(date "+%a %b %d %Y") damachine - %{version}-1 diff --git a/packaging/debian/control b/packaging/debian/control index 37820f0..8f65cc1 100644 --- a/packaging/debian/control +++ b/packaging/debian/control @@ -19,11 +19,8 @@ Package: coolerdash Architecture: amd64 Depends: ${shlibs:Depends}, ${misc:Depends}, - libcairo2, - libcurl4, - libjansson4, - fonts-roboto, - coolercontrol + fonts-roboto +Recommends: coolercontrol Description: LCD temperature display daemon for AIO liquid coolers CoolerDash is a high-performance C99 daemon that displays CPU and GPU temperatures on LCD displays of AIO liquid coolers (NZXT Kraken, etc.) diff --git a/packaging/debian/copyright b/packaging/debian/copyright new file mode 100644 index 0000000..6ad3057 --- /dev/null +++ b/packaging/debian/copyright @@ -0,0 +1,27 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: coolerdash +Upstream-Contact: damachine +Source: https://github.com/damachine/coolerdash + +Files: * +Copyright: 2025 damachine +License: MIT + +License: MIT + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + . + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + . + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. diff --git a/packaging/debian/install b/packaging/debian/install index 25ab8c9..e0b4112 100644 --- a/packaging/debian/install +++ b/packaging/debian/install @@ -1,9 +1,9 @@ -etc/coolercontrol/plugins/coolerdash/coolerdash +usr/libexec/coolerdash/coolerdash +usr/share/licenses/coolerdash/LICENSE etc/coolercontrol/plugins/coolerdash/config.json etc/coolercontrol/plugins/coolerdash/manifest.toml etc/coolercontrol/plugins/coolerdash/shutdown.png etc/coolercontrol/plugins/coolerdash/README.md -etc/coolercontrol/plugins/coolerdash/LICENSE etc/coolercontrol/plugins/coolerdash/VERSION etc/coolercontrol/plugins/coolerdash/CHANGELOG.md etc/coolercontrol/plugins/coolerdash/ui/index.html @@ -12,3 +12,5 @@ usr/share/man/man1/coolerdash.1 usr/share/applications/coolerdash.desktop usr/share/icons/hicolor/scalable/apps/coolerdash.svg usr/lib/udev/rules.d/99-coolerdash.rules +usr/lib/systemd/system/coolerdash-helperd.service +etc/systemd/system/cc-plugin-coolerdash.service.d/startup-delay.conf diff --git a/packaging/debian/postinst b/packaging/debian/postinst index 28c67a0..8dd32f5 100755 --- a/packaging/debian/postinst +++ b/packaging/debian/postinst @@ -3,13 +3,18 @@ set -e case "$1" in configure) - # Set correct permissions for config file + # Set config permissions if [ -f /etc/coolercontrol/plugins/coolerdash/config.json ]; then chmod 666 /etc/coolercontrol/plugins/coolerdash/config.json fi - - # Restart CoolerControl to register new plugin + + # Migration: remove old helperd from /etc (now shipped in /usr/lib) + rm -f /etc/systemd/system/coolerdash-helperd.service + + # Reload and enable services if command -v systemctl >/dev/null 2>&1; then + systemctl daemon-reload + systemctl enable --now coolerdash-helperd.service 2>/dev/null || true if systemctl is-active --quiet coolercontrold.service; then systemctl restart coolercontrold.service || true fi diff --git a/packaging/debian/prerm b/packaging/debian/prerm index 52860b1..75e1b8d 100755 --- a/packaging/debian/prerm +++ b/packaging/debian/prerm @@ -3,12 +3,18 @@ set -e case "$1" in remove|upgrade|deconfigure) - # Stop CoolerControl to ensure clean plugin removal + # Stop and disable services (files removed by dpkg) if command -v systemctl >/dev/null 2>&1; then + systemctl stop --no-block coolerdash-helperd.service 2>/dev/null || true + systemctl disable coolerdash-helperd.service 2>/dev/null || true + systemctl stop cc-plugin-coolerdash.service 2>/dev/null || true if systemctl is-active --quiet coolercontrold.service; then systemctl stop coolercontrold.service || true fi + systemctl daemon-reload fi + # Migration: remove old helperd from /etc + rm -f /etc/systemd/system/coolerdash-helperd.service ;; esac diff --git a/src/device/config.c b/src/device/config.c index f77da3c..e0a3015 100644 --- a/src/device/config.c +++ b/src/device/config.c @@ -8,9 +8,8 @@ */ /** - * @brief CoolerControl Plugin Configuration System - * @details Complete JSON-based configuration with hardcoded defaults. - * Replaces config.ini + sys.c + usr.c with unified plugin.c/h + * @brief JSON configuration loader with hardcoded defaults. + * @details Parses config.json, applies defaults for missing values. */ #define _POSIX_C_SOURCE 200112L diff --git a/src/device/config.h b/src/device/config.h index e54241e..e7cddf6 100644 --- a/src/device/config.h +++ b/src/device/config.h @@ -8,9 +8,8 @@ */ /** - * @brief CoolerControl Plugin Configuration System - * @details Loads all configuration from config.json with hardcoded defaults as fallback. - * Replaces the old config.ini + sys.c system with a unified JSON-based approach. + * @brief JSON configuration loader with hardcoded defaults. + * @details Config struct, load/save functions, default values. */ #ifndef PLUGIN_H diff --git a/src/main.c b/src/main.c index b10ddca..fcf8c49 100644 --- a/src/main.c +++ b/src/main.c @@ -8,11 +8,8 @@ */ /** - * @brief Enhanced main entry point for CoolerDash daemon with security and - * performance optimizations. - * @details Implements the main daemon logic with improved error handling, - * secure PID management, and optimized signal processing. Enhanced with input - * validation, dynamic version loading, and modern C practices. + * @brief Main entry point and daemon lifecycle. + * @details Signal handling, PID management, version loading, main loop. */ // Define POSIX constants @@ -245,8 +242,8 @@ static void show_help(const char *program_name) "configuration\n\n", program_name); printf("FILES:\n"); - printf(" /etc/coolercontrol/plugins/coolerdash/ # Installation directory\n"); - printf(" /etc/coolercontrol/plugins/coolerdash/coolerdash # Main executable\n"); + printf(" /usr/libexec/coolerdash/coolerdash # Main executable\n"); + printf(" /etc/coolercontrol/plugins/coolerdash/ # Plugin data directory\n"); printf(" /etc/coolercontrol/plugins/coolerdash/config.json # Configuration " "file\n"); printf(" /etc/coolercontrol/plugins/coolerdash/index.html # Web UI settings\n"); diff --git a/src/mods/circle.c b/src/mods/circle.c index b59104d..4482f88 100644 --- a/src/mods/circle.c +++ b/src/mods/circle.c @@ -8,10 +8,8 @@ */ /** - * @brief Circle mode LCD rendering - Single sensor alternating display - * implementation. - * @details Provides functions for rendering single CPU or GPU sensor with - * automatic 2.5s switching. + * @brief Circle mode rendering (alternating CPU/GPU). + * @details Single sensor display with automatic 2.5s switching. */ // Include necessary headers diff --git a/src/mods/circle.h b/src/mods/circle.h index 0fd6e1b..2468732 100644 --- a/src/mods/circle.h +++ b/src/mods/circle.h @@ -8,9 +8,8 @@ */ /** - * @brief Circle mode LCD rendering - Single sensor alternating display. - * @details Provides functions for rendering single CPU or GPU sensor with - * automatic switching every 2.5 seconds. + * @brief Circle mode rendering (alternating CPU/GPU). + * @details Single sensor display with automatic 2.5s switching. */ #ifndef CIRCLE_H diff --git a/src/mods/display.c b/src/mods/display.c index 4ce208d..d08fc38 100644 --- a/src/mods/display.c +++ b/src/mods/display.c @@ -8,9 +8,8 @@ */ /** - * @brief Display mode dispatcher implementation. - * @details Routes rendering requests to appropriate mode-specific modules based - * on configuration. Also provides shared helper functions for sensor slot handling. + * @brief Display mode dispatcher. + * @details Routes to dual or circle rendering module, shared sensor helpers. */ // Define POSIX constants diff --git a/src/mods/display.h b/src/mods/display.h index 8e06050..8832091 100644 --- a/src/mods/display.h +++ b/src/mods/display.h @@ -8,9 +8,8 @@ */ /** - * @brief Display mode dispatcher for CoolerDash. - * @details Provides mode-agnostic dispatcher that routes to appropriate - * rendering modules (dual or circle mode). + * @brief Display mode dispatcher. + * @details Routes to dual or circle rendering module. */ #ifndef DISPLAY_DISPATCHER_H diff --git a/src/mods/dual.c b/src/mods/dual.c index 0004fe4..bdf6237 100644 --- a/src/mods/dual.c +++ b/src/mods/dual.c @@ -8,9 +8,8 @@ */ /** - * @brief LCD rendering and image upload implementation for CoolerDash. - * @details Provides functions for rendering the LCD display based on sensor - * data and configuration. + * @brief Dual mode rendering (CPU+GPU side by side). + * @details Cairo-based LCD image generation for dual sensor display. */ // Include necessary headers diff --git a/src/mods/dual.h b/src/mods/dual.h index d9369ab..f079f4e 100644 --- a/src/mods/dual.h +++ b/src/mods/dual.h @@ -8,9 +8,8 @@ */ /** - * @brief LCD rendering and image upload interface for CoolerDash. - * @details Provides functions for rendering temperature data to LCD displays, - * including Cairo-based image generation and upload to CoolerControl devices. + * @brief Dual mode rendering (CPU+GPU side by side). + * @details Cairo-based LCD image generation for dual sensor display. */ // Include necessary headers diff --git a/src/srv/cc_conf.c b/src/srv/cc_conf.c index 601ccfb..a6211c1 100644 --- a/src/srv/cc_conf.c +++ b/src/srv/cc_conf.c @@ -8,9 +8,8 @@ */ /** - * @brief CoolerControl configuration - Device cache and display detection. - * @details Provides functions for device information caching and circular - * display detection. + * @brief Device cache and display detection. + * @details Caches device UID, detects LCD type (circular vs rectangular). */ // Define POSIX constants diff --git a/src/srv/cc_conf.h b/src/srv/cc_conf.h index 90cd1f6..d040370 100644 --- a/src/srv/cc_conf.h +++ b/src/srv/cc_conf.h @@ -8,9 +8,8 @@ */ /** - * @brief CoolerControl configuration - Device cache and display detection. - * @details Provides functions for device information caching and circular - * display detection. + * @brief Device cache and display detection. + * @details Caches device UID, detects LCD type (circular vs rectangular). */ #ifndef CC_CONF_H diff --git a/src/srv/cc_main.c b/src/srv/cc_main.c index ad3bc4c..c39930e 100644 --- a/src/srv/cc_main.c +++ b/src/srv/cc_main.c @@ -8,9 +8,8 @@ */ /** - * @brief CoolerControl main API - Session management and HTTP communication. - * @details Provides functions for session initialization, authentication, and - * LCD image upload. + * @brief Session management, authentication, LCD image upload. + * @details HTTP client for CoolerControl REST API. */ // Define POSIX constants diff --git a/src/srv/cc_main.h b/src/srv/cc_main.h index 4ee868b..bf86801 100644 --- a/src/srv/cc_main.h +++ b/src/srv/cc_main.h @@ -8,9 +8,8 @@ */ /** - * @brief CoolerControl main API - Session management and HTTP communication. - * @details Provides functions for session initialization, authentication, and - * LCD image upload. + * @brief Session management, authentication, LCD image upload. + * @details HTTP client for CoolerControl REST API. */ #ifndef CC_MAIN_H diff --git a/src/srv/cc_sensor.c b/src/srv/cc_sensor.c index 33e572a..8da0782 100644 --- a/src/srv/cc_sensor.c +++ b/src/srv/cc_sensor.c @@ -8,11 +8,8 @@ */ /** - * @brief Monitor API for reading CPU and GPU temperatures via CoolerControl - * OpenAPI. - * @details Provides functions to initialize the monitor subsystem and read - * CPU/GPU temperature values from the API. Liquidctl device handling is in - * coolercontrol.c. + * @brief CPU/GPU temperature monitoring via CoolerControl API. + * @details Reads sensor data from /status endpoint. */ // Include necessary headers diff --git a/src/srv/cc_sensor.h b/src/srv/cc_sensor.h index fdd2dba..0c3163b 100644 --- a/src/srv/cc_sensor.h +++ b/src/srv/cc_sensor.h @@ -8,10 +8,8 @@ */ /** - * @brief Monitor API for reading CPU and GPU temperatures via CoolerControl - * OpenAPI. - * @details Provides functions for initializing the monitor subsystem and - * retrieving temperature sensor data from CoolerControl REST API endpoints. + * @brief CPU/GPU temperature monitoring via CoolerControl API. + * @details Reads sensor data from /status endpoint. */ // Include necessary headers From f77f09f0629469831927bf243da0f1648e5137d1 Mon Sep 17 00:00:00 2001 From: damachine Date: Mon, 9 Feb 2026 01:18:07 +0100 Subject: [PATCH 3/5] chore: legacy files cleanup, more linux-compliance --- Makefile | 50 ++++++++++++++++++++++++++++-------------- aur/coolerdash.install | 6 +++++ coolerdash.install | 6 +++++ 3 files changed, 45 insertions(+), 17 deletions(-) diff --git a/Makefile b/Makefile index bf83d6a..700f267 100644 --- a/Makefile +++ b/Makefile @@ -233,6 +233,14 @@ install: check-deps $(TARGET) $(SUDO) rm -f /etc/coolercontrol/plugins/coolerdash/ui.html; \ LEGACY_FOUND=1; \ fi; \ + if [ -f /etc/coolercontrol/plugins/coolerdash/LICENSE ]; then \ + $(SUDO) rm -f /etc/coolercontrol/plugins/coolerdash/LICENSE; \ + LEGACY_FOUND=1; \ + fi; \ + if [ -f /etc/coolercontrol/plugins/coolerdash/coolerdash ]; then \ + $(SUDO) rm -f /etc/coolercontrol/plugins/coolerdash/coolerdash; \ + LEGACY_FOUND=1; \ + fi; \ if [ -f /usr/share/applications/coolerdash-settings.desktop ]; then \ $(SUDO) rm -f /usr/share/applications/coolerdash-settings.desktop; \ LEGACY_FOUND=1; \ @@ -250,26 +258,26 @@ install: check-deps $(TARGET) LEGACY_FOUND=1; \ fi; \ if [ "$$LEGACY_FOUND" -eq 1 ]; then \ - printf " $(GREEN)βœ“$(RESET) Legacy cleanup complete\n" >/dev/null 2>&1; \ + printf " $(GREEN)βœ“$(RESET) Legacy cleanup complete\n"; \ else \ - printf " $(BLUE)β†’$(RESET) No legacy files found (clean install)\n" >/dev/null 2>&1; \ + printf " $(BLUE)β†’$(RESET) No legacy files found (clean install)\n"; \ fi; \ - printf "\n" >/dev/null 2>&1; \ + printf "\n"; \ COOLERDASH_COUNT=$$(pgrep -x coolerdash 2>/dev/null | wc -l); \ if [ "$$COOLERDASH_COUNT" -gt 0 ]; then \ - printf "$(ICON_SERVICE) $(CYAN)Terminating running coolerdash process(es)...$(RESET)\n" >/dev/null 2>&1; \ + printf "$(ICON_SERVICE) $(CYAN)Terminating running coolerdash process(es)...$(RESET)\n"; \ $(SUDO) killall -TERM coolerdash 2>/dev/null || true; \ sleep 2; \ REMAINING_COUNT=$$(pgrep -x coolerdash 2>/dev/null | wc -l); \ if [ "$$REMAINING_COUNT" -gt 0 ]; then \ - printf " $(YELLOW)β†’$(RESET) Force killing $$REMAINING_COUNT remaining process(es)...\n" >/dev/null 2>&1; \ + printf " $(YELLOW)β†’$(RESET) Force killing $$REMAINING_COUNT remaining process(es)...\n"; \ $(SUDO) killall -KILL coolerdash 2>/dev/null || true; \ fi; \ - printf " $(GREEN)β†’$(RESET) Processes terminated\n" >/dev/null 2>&1; \ - printf "\n" >/dev/null 2>&1; \ + printf " $(GREEN)β†’$(RESET) Processes terminated\n"; \ + printf "\n"; \ fi; \ else \ - printf "$(ICON_INFO) $(YELLOW)Migration skipped (CI environment).$(RESET)\n" >/dev/null 2>&1; \ + printf "$(ICON_INFO) $(YELLOW)Migration skipped (CI environment).$(RESET)\n"; \ fi @printf "\n" @printf "$(ICON_INFO) $(CYAN)Installing plugin files...$(RESET)\n" @@ -374,6 +382,14 @@ uninstall: $(SUDO) rm -f /etc/coolercontrol/plugins/coolerdash/ui.html; \ LEGACY_FOUND=1; \ fi; \ + if [ -f /etc/coolercontrol/plugins/coolerdash/LICENSE ]; then \ + $(SUDO) rm -f /etc/coolercontrol/plugins/coolerdash/LICENSE; \ + LEGACY_FOUND=1; \ + fi; \ + if [ -f /etc/coolercontrol/plugins/coolerdash/coolerdash ]; then \ + $(SUDO) rm -f /etc/coolercontrol/plugins/coolerdash/coolerdash; \ + LEGACY_FOUND=1; \ + fi; \ if [ -f /usr/share/applications/coolerdash-settings.desktop ]; then \ $(SUDO) rm -f /usr/share/applications/coolerdash-settings.desktop; \ LEGACY_FOUND=1; \ @@ -394,21 +410,21 @@ uninstall: @if [ "$(REALOS)" = "yes" ]; then \ $(SUDO) rm -f /etc/systemd/system/coolerdash-helperd.service; \ fi - @$(SUDO) rm -f "$(DESTDIR)/usr/lib/systemd/system/coolerdash-helperd.service" || true - @$(SUDO) rm -rf "$(DESTDIR)/etc/systemd/system/cc-plugin-coolerdash.service.d" || true - @$(SUDO) rm -rf "$(DESTDIR)/etc/coolercontrol/plugins/coolerdash" || true - @$(SUDO) rm -rf "$(DESTDIR)/usr/libexec/coolerdash" || true - @$(SUDO) rm -rf "$(DESTDIR)/usr/share/licenses/coolerdash" || true - @$(SUDO) rm -f "$(DESTDIR)/usr/share/man/man1/coolerdash.1" || true - @$(SUDO) rm -f "$(DESTDIR)/usr/share/applications/coolerdash.desktop" || true + @$(SUDO) rm -f "$(DESTDIR)/usr/lib/systemd/system/coolerdash-helperd.service" + @$(SUDO) rm -rf "$(DESTDIR)/etc/systemd/system/cc-plugin-coolerdash.service.d" + @$(SUDO) rm -rf "$(DESTDIR)/etc/coolercontrol/plugins/coolerdash" + @$(SUDO) rm -rf "$(DESTDIR)/usr/libexec/coolerdash" + @$(SUDO) rm -rf "$(DESTDIR)/usr/share/licenses/coolerdash" + @$(SUDO) rm -f "$(DESTDIR)/usr/share/man/man1/coolerdash.1" + @$(SUDO) rm -f "$(DESTDIR)/usr/share/applications/coolerdash.desktop" @printf "$(ICON_CLEAN) $(CYAN)Removing udev rule...$(RESET)\n" - @$(SUDO) rm -f "$(DESTDIR)/usr/lib/udev/rules.d/99-coolerdash.rules" || true + @$(SUDO) rm -f "$(DESTDIR)/usr/lib/udev/rules.d/99-coolerdash.rules" @if [ "$(REALOS)" = "yes" ]; then \ $(SUDO) udevadm control --reload-rules 2>/dev/null || true; \ $(SUDO) udevadm trigger --subsystem-match=usb 2>/dev/null || true; \ printf " $(GREEN)βœ“$(RESET) udev rules reloaded\n"; \ fi - @$(SUDO) rm -f "$(DESTDIR)/usr/share/icons/hicolor/scalable/apps/coolerdash.svg" || true + @$(SUDO) rm -f "$(DESTDIR)/usr/share/icons/hicolor/scalable/apps/coolerdash.svg" @if [ "$(REALOS)" = "yes" ]; then \ if id -u coolerdash >/dev/null 2>&1; then \ $(SUDO) userdel -rf coolerdash; \ diff --git a/aur/coolerdash.install b/aur/coolerdash.install index 248a68c..a08b8c5 100644 --- a/aur/coolerdash.install +++ b/aur/coolerdash.install @@ -16,6 +16,8 @@ pre_install() { rm -rf /etc/coolerdash rm -f /etc/coolercontrol/plugins/coolerdash/config.ini rm -f /etc/coolercontrol/plugins/coolerdash/ui.html + rm -f /etc/coolercontrol/plugins/coolerdash/LICENSE + rm -f /etc/coolercontrol/plugins/coolerdash/coolerdash rm -f /usr/share/applications/coolerdash-settings.desktop rm -f /bin/coolerdash rm -f /usr/bin/coolerdash @@ -94,6 +96,10 @@ pre_remove() { # Remove legacy files rm -f /etc/systemd/system/coolerdash-helperd.service rm -f /etc/systemd/system/coolerdash.service + rm -f /etc/coolercontrol/plugins/coolerdash/config.ini + rm -f /etc/coolercontrol/plugins/coolerdash/ui.html + rm -f /etc/coolercontrol/plugins/coolerdash/LICENSE + rm -f /etc/coolercontrol/plugins/coolerdash/coolerdash rm -f /usr/share/applications/coolerdash-settings.desktop rm -f /bin/coolerdash rm -f /usr/bin/coolerdash diff --git a/coolerdash.install b/coolerdash.install index 248a68c..a08b8c5 100644 --- a/coolerdash.install +++ b/coolerdash.install @@ -16,6 +16,8 @@ pre_install() { rm -rf /etc/coolerdash rm -f /etc/coolercontrol/plugins/coolerdash/config.ini rm -f /etc/coolercontrol/plugins/coolerdash/ui.html + rm -f /etc/coolercontrol/plugins/coolerdash/LICENSE + rm -f /etc/coolercontrol/plugins/coolerdash/coolerdash rm -f /usr/share/applications/coolerdash-settings.desktop rm -f /bin/coolerdash rm -f /usr/bin/coolerdash @@ -94,6 +96,10 @@ pre_remove() { # Remove legacy files rm -f /etc/systemd/system/coolerdash-helperd.service rm -f /etc/systemd/system/coolerdash.service + rm -f /etc/coolercontrol/plugins/coolerdash/config.ini + rm -f /etc/coolercontrol/plugins/coolerdash/ui.html + rm -f /etc/coolercontrol/plugins/coolerdash/LICENSE + rm -f /etc/coolercontrol/plugins/coolerdash/coolerdash rm -f /usr/share/applications/coolerdash-settings.desktop rm -f /bin/coolerdash rm -f /usr/bin/coolerdash From a1fe9376d9a9586267c0aa72d2c1bfc5c797d167 Mon Sep 17 00:00:00 2001 From: damachine Date: Mon, 9 Feb 2026 01:51:25 +0100 Subject: [PATCH 4/5] refactor: pre-builted packages and aur --- aur/coolerdash.install | 44 ++++++++++++----------- coolerdash.install | 44 ++++++++++++----------- packaging/coolerdash.spec | 74 +++++++++++++++++++++++++++++++++------ packaging/debian/postinst | 10 +++--- packaging/debian/preinst | 35 ++++++++++++++++++ packaging/debian/prerm | 34 ++++++++++++++---- 6 files changed, 179 insertions(+), 62 deletions(-) create mode 100755 packaging/debian/preinst diff --git a/aur/coolerdash.install b/aur/coolerdash.install index a08b8c5..9c05a1e 100644 --- a/aur/coolerdash.install +++ b/aur/coolerdash.install @@ -1,11 +1,11 @@ # Created by: damachin3 (damachine3 at proton dot me) # Website: https://github.com/damachine/coolerdash -# Pacman install hooks for local PKGBUILD +# Pacman install hooks pre_install() { - # Stop legacy standalone service - if systemctl list-unit-files coolerdash.service >/dev/null 2>&1; then + # Stop legacy service + if systemctl list-unit-files coolerdash.service | grep -q coolerdash; then systemctl stop coolerdash.service systemctl disable coolerdash.service fi @@ -30,23 +30,23 @@ pre_install() { post_install() { # Reload udev rules - if [ -f /usr/lib/udev/rules.d/99-coolerdash.rules ]; then - udevadm control --reload-rules 2>/dev/null || true - udevadm trigger --subsystem-match=usb 2>/dev/null || true + if command -v udevadm >/dev/null 2>&1; then + udevadm control --reload-rules + udevadm trigger --subsystem-match=usb fi - # Migration: remove old helperd from /etc (now in /usr/lib) + # Remove old helperd from /etc rm -f /etc/systemd/system/coolerdash-helperd.service systemctl daemon-reload # Enable helperd - if systemctl list-unit-files coolerdash-helperd.service >/dev/null 2>&1; then + if systemctl list-unit-files coolerdash-helperd.service | grep -q coolerdash-helperd; then systemctl enable --now coolerdash-helperd.service || echo "Note: coolerdash-helperd.service failed. Enable manually." fi # Restart CoolerControl - if systemctl list-unit-files coolercontrold.service >/dev/null 2>&1; then + if systemctl list-unit-files coolercontrold.service | grep -q coolercontrold; then systemctl restart coolercontrold.service || echo "Note: CoolerControl restart failed." fi @@ -56,18 +56,18 @@ post_install() { } post_upgrade() { - # Migration: remove old helperd from /etc (now in /usr/lib) + # Remove old helperd from /etc rm -f /etc/systemd/system/coolerdash-helperd.service systemctl daemon-reload # Enable helperd - if systemctl list-unit-files coolerdash-helperd.service >/dev/null 2>&1; then + if systemctl list-unit-files coolerdash-helperd.service | grep -q coolerdash-helperd; then systemctl enable --now coolerdash-helperd.service || echo "Note: coolerdash-helperd.service failed. Enable manually." fi - # Restart plugin service - if systemctl list-unit-files cc-plugin-coolerdash.service >/dev/null 2>&1; then + # Restart plugin + if systemctl list-unit-files cc-plugin-coolerdash.service | grep -q cc-plugin-coolerdash; then systemctl restart cc-plugin-coolerdash.service || echo "Note: Plugin restart failed." fi @@ -77,21 +77,23 @@ post_upgrade() { } pre_remove() { - # Stop legacy standalone service - if systemctl is-active --quiet coolerdash.service || systemctl is-enabled --quiet coolerdash.service; then + # Stop legacy service + if systemctl list-unit-files coolerdash.service | grep -q coolerdash; then systemctl stop coolerdash.service systemctl disable coolerdash.service fi - # Stop plugin service - if systemctl is-active --quiet cc-plugin-coolerdash.service || systemctl is-enabled --quiet cc-plugin-coolerdash.service; then + # Stop plugin + if systemctl list-unit-files cc-plugin-coolerdash.service | grep -q cc-plugin-coolerdash; then systemctl stop cc-plugin-coolerdash.service systemctl disable cc-plugin-coolerdash.service fi - # Stop and disable helperd (unit file removed by pacman) - systemctl stop --no-block coolerdash-helperd.service 2>/dev/null || true - systemctl disable coolerdash-helperd.service 2>/dev/null || true + # Stop helperd + if systemctl list-unit-files coolerdash-helperd.service | grep -q coolerdash-helperd; then + systemctl stop --no-block coolerdash-helperd.service + systemctl disable coolerdash-helperd.service + fi # Remove legacy files rm -f /etc/systemd/system/coolerdash-helperd.service @@ -114,7 +116,7 @@ pre_remove() { systemctl daemon-reload # Restart CoolerControl - if systemctl list-unit-files coolercontrold.service >/dev/null 2>&1; then + if systemctl list-unit-files coolercontrold.service | grep -q coolercontrold; then systemctl restart coolercontrold.service || echo "Note: CoolerControl restart failed." fi diff --git a/coolerdash.install b/coolerdash.install index a08b8c5..9c05a1e 100644 --- a/coolerdash.install +++ b/coolerdash.install @@ -1,11 +1,11 @@ # Created by: damachin3 (damachine3 at proton dot me) # Website: https://github.com/damachine/coolerdash -# Pacman install hooks for local PKGBUILD +# Pacman install hooks pre_install() { - # Stop legacy standalone service - if systemctl list-unit-files coolerdash.service >/dev/null 2>&1; then + # Stop legacy service + if systemctl list-unit-files coolerdash.service | grep -q coolerdash; then systemctl stop coolerdash.service systemctl disable coolerdash.service fi @@ -30,23 +30,23 @@ pre_install() { post_install() { # Reload udev rules - if [ -f /usr/lib/udev/rules.d/99-coolerdash.rules ]; then - udevadm control --reload-rules 2>/dev/null || true - udevadm trigger --subsystem-match=usb 2>/dev/null || true + if command -v udevadm >/dev/null 2>&1; then + udevadm control --reload-rules + udevadm trigger --subsystem-match=usb fi - # Migration: remove old helperd from /etc (now in /usr/lib) + # Remove old helperd from /etc rm -f /etc/systemd/system/coolerdash-helperd.service systemctl daemon-reload # Enable helperd - if systemctl list-unit-files coolerdash-helperd.service >/dev/null 2>&1; then + if systemctl list-unit-files coolerdash-helperd.service | grep -q coolerdash-helperd; then systemctl enable --now coolerdash-helperd.service || echo "Note: coolerdash-helperd.service failed. Enable manually." fi # Restart CoolerControl - if systemctl list-unit-files coolercontrold.service >/dev/null 2>&1; then + if systemctl list-unit-files coolercontrold.service | grep -q coolercontrold; then systemctl restart coolercontrold.service || echo "Note: CoolerControl restart failed." fi @@ -56,18 +56,18 @@ post_install() { } post_upgrade() { - # Migration: remove old helperd from /etc (now in /usr/lib) + # Remove old helperd from /etc rm -f /etc/systemd/system/coolerdash-helperd.service systemctl daemon-reload # Enable helperd - if systemctl list-unit-files coolerdash-helperd.service >/dev/null 2>&1; then + if systemctl list-unit-files coolerdash-helperd.service | grep -q coolerdash-helperd; then systemctl enable --now coolerdash-helperd.service || echo "Note: coolerdash-helperd.service failed. Enable manually." fi - # Restart plugin service - if systemctl list-unit-files cc-plugin-coolerdash.service >/dev/null 2>&1; then + # Restart plugin + if systemctl list-unit-files cc-plugin-coolerdash.service | grep -q cc-plugin-coolerdash; then systemctl restart cc-plugin-coolerdash.service || echo "Note: Plugin restart failed." fi @@ -77,21 +77,23 @@ post_upgrade() { } pre_remove() { - # Stop legacy standalone service - if systemctl is-active --quiet coolerdash.service || systemctl is-enabled --quiet coolerdash.service; then + # Stop legacy service + if systemctl list-unit-files coolerdash.service | grep -q coolerdash; then systemctl stop coolerdash.service systemctl disable coolerdash.service fi - # Stop plugin service - if systemctl is-active --quiet cc-plugin-coolerdash.service || systemctl is-enabled --quiet cc-plugin-coolerdash.service; then + # Stop plugin + if systemctl list-unit-files cc-plugin-coolerdash.service | grep -q cc-plugin-coolerdash; then systemctl stop cc-plugin-coolerdash.service systemctl disable cc-plugin-coolerdash.service fi - # Stop and disable helperd (unit file removed by pacman) - systemctl stop --no-block coolerdash-helperd.service 2>/dev/null || true - systemctl disable coolerdash-helperd.service 2>/dev/null || true + # Stop helperd + if systemctl list-unit-files coolerdash-helperd.service | grep -q coolerdash-helperd; then + systemctl stop --no-block coolerdash-helperd.service + systemctl disable coolerdash-helperd.service + fi # Remove legacy files rm -f /etc/systemd/system/coolerdash-helperd.service @@ -114,7 +116,7 @@ pre_remove() { systemctl daemon-reload # Restart CoolerControl - if systemctl list-unit-files coolercontrold.service >/dev/null 2>&1; then + if systemctl list-unit-files coolercontrold.service | grep -q coolercontrold; then systemctl restart coolercontrold.service || echo "Note: CoolerControl restart failed." fi diff --git a/packaging/coolerdash.spec b/packaging/coolerdash.spec index 048a24f..bbd8a11 100644 --- a/packaging/coolerdash.spec +++ b/packaging/coolerdash.spec @@ -43,34 +43,88 @@ make SUDO="" REALOS=no %{?_smp_mflags} make install DESTDIR=%{buildroot} SUDO="" REALOS=no gzip -9 %{buildroot}/usr/share/man/man1/coolerdash.1 +%pre +# Stop legacy service +if command -v systemctl >/dev/null 2>&1; then + if systemctl list-unit-files coolerdash.service | grep -q coolerdash; then + systemctl stop coolerdash.service + systemctl disable coolerdash.service + fi +fi + +# Remove legacy files +rm -f /etc/systemd/system/coolerdash.service +rm -rf /opt/coolerdash +rm -rf /etc/coolerdash +rm -f /etc/coolercontrol/plugins/coolerdash/config.ini +rm -f /etc/coolercontrol/plugins/coolerdash/ui.html +rm -f /etc/coolercontrol/plugins/coolerdash/LICENSE +rm -f /etc/coolercontrol/plugins/coolerdash/coolerdash +rm -f /usr/share/applications/coolerdash-settings.desktop +rm -f /bin/coolerdash +rm -f /usr/bin/coolerdash + +# Remove legacy user +if id -u coolerdash >/dev/null 2>&1; then + userdel -rf coolerdash +fi + %post if [ -f /etc/coolercontrol/plugins/coolerdash/config.json ]; then chmod 666 /etc/coolercontrol/plugins/coolerdash/config.json fi -# Migration: remove old helperd from /etc (now shipped in /usr/lib) +# Remove old helperd from /etc rm -f /etc/systemd/system/coolerdash-helperd.service if command -v systemctl >/dev/null 2>&1; then systemctl daemon-reload - systemctl enable --now coolerdash-helperd.service 2>/dev/null || true - if systemctl is-active --quiet coolercontrold.service 2>/dev/null; then - systemctl restart coolercontrold.service || true + if systemctl list-unit-files coolerdash-helperd.service | grep -q coolerdash-helperd; then + systemctl enable --now coolerdash-helperd.service || echo "Note: coolerdash-helperd.service failed. Enable manually." + fi + if systemctl is-active --quiet coolercontrold.service; then + systemctl restart coolercontrold.service || echo "Note: CoolerControl restart failed." fi fi %preun if command -v systemctl >/dev/null 2>&1; then - systemctl stop --no-block coolerdash-helperd.service 2>/dev/null || true - systemctl disable coolerdash-helperd.service 2>/dev/null || true - systemctl stop cc-plugin-coolerdash.service 2>/dev/null || true - if systemctl is-active --quiet coolercontrold.service 2>/dev/null; then - systemctl stop coolercontrold.service || true + if systemctl list-unit-files coolerdash-helperd.service | grep -q coolerdash-helperd; then + systemctl stop --no-block coolerdash-helperd.service + systemctl disable coolerdash-helperd.service + fi + if systemctl list-unit-files cc-plugin-coolerdash.service | grep -q cc-plugin-coolerdash; then + systemctl stop cc-plugin-coolerdash.service + systemctl disable cc-plugin-coolerdash.service + fi + if systemctl is-active --quiet coolercontrold.service; then + systemctl stop coolercontrold.service + fi +fi + +# Remove legacy files +if [ "$1" = "0" ]; then + rm -f /etc/systemd/system/coolerdash-helperd.service + rm -f /etc/systemd/system/coolerdash.service + rm -f /etc/coolercontrol/plugins/coolerdash/config.ini + rm -f /etc/coolercontrol/plugins/coolerdash/ui.html + rm -f /etc/coolercontrol/plugins/coolerdash/LICENSE + rm -f /etc/coolercontrol/plugins/coolerdash/coolerdash + rm -f /usr/share/applications/coolerdash-settings.desktop + rm -f /bin/coolerdash + rm -f /usr/bin/coolerdash + rm -rf /opt/coolerdash + rm -rf /etc/coolerdash + # Remove legacy user + if id -u coolerdash >/dev/null 2>&1; then + userdel -rf coolerdash fi fi %postun if command -v systemctl >/dev/null 2>&1; then systemctl daemon-reload - systemctl restart coolercontrold.service 2>/dev/null || true + if systemctl is-active --quiet coolercontrold.service; then + systemctl restart coolercontrold.service || echo "Note: CoolerControl restart failed." + fi fi %files diff --git a/packaging/debian/postinst b/packaging/debian/postinst index 8dd32f5..110d352 100755 --- a/packaging/debian/postinst +++ b/packaging/debian/postinst @@ -8,15 +8,17 @@ case "$1" in chmod 666 /etc/coolercontrol/plugins/coolerdash/config.json fi - # Migration: remove old helperd from /etc (now shipped in /usr/lib) + # Remove old helperd from /etc rm -f /etc/systemd/system/coolerdash-helperd.service - # Reload and enable services + # Enable services if command -v systemctl >/dev/null 2>&1; then systemctl daemon-reload - systemctl enable --now coolerdash-helperd.service 2>/dev/null || true + if systemctl list-unit-files coolerdash-helperd.service | grep -q coolerdash-helperd; then + systemctl enable --now coolerdash-helperd.service || echo "Note: coolerdash-helperd.service failed. Enable manually." + fi if systemctl is-active --quiet coolercontrold.service; then - systemctl restart coolercontrold.service || true + systemctl restart coolercontrold.service || echo "Note: CoolerControl restart failed." fi fi ;; diff --git a/packaging/debian/preinst b/packaging/debian/preinst new file mode 100755 index 0000000..b25be70 --- /dev/null +++ b/packaging/debian/preinst @@ -0,0 +1,35 @@ +#!/bin/sh +set -e + +case "$1" in + install|upgrade) + # Stop legacy service + if command -v systemctl >/dev/null 2>&1; then + if systemctl list-unit-files coolerdash.service | grep -q coolerdash; then + systemctl stop coolerdash.service + systemctl disable coolerdash.service + fi + fi + + # Remove legacy files + rm -f /etc/systemd/system/coolerdash.service + rm -rf /opt/coolerdash + rm -rf /etc/coolerdash + rm -f /etc/coolercontrol/plugins/coolerdash/config.ini + rm -f /etc/coolercontrol/plugins/coolerdash/ui.html + rm -f /etc/coolercontrol/plugins/coolerdash/LICENSE + rm -f /etc/coolercontrol/plugins/coolerdash/coolerdash + rm -f /usr/share/applications/coolerdash-settings.desktop + rm -f /bin/coolerdash + rm -f /usr/bin/coolerdash + + # Remove legacy user + if id -u coolerdash >/dev/null 2>&1; then + userdel -rf coolerdash + fi + ;; +esac + +#DEBHELPER# + +exit 0 diff --git a/packaging/debian/prerm b/packaging/debian/prerm index 75e1b8d..c1bec9b 100755 --- a/packaging/debian/prerm +++ b/packaging/debian/prerm @@ -3,18 +3,40 @@ set -e case "$1" in remove|upgrade|deconfigure) - # Stop and disable services (files removed by dpkg) + # Stop services if command -v systemctl >/dev/null 2>&1; then - systemctl stop --no-block coolerdash-helperd.service 2>/dev/null || true - systemctl disable coolerdash-helperd.service 2>/dev/null || true - systemctl stop cc-plugin-coolerdash.service 2>/dev/null || true + if systemctl list-unit-files coolerdash-helperd.service | grep -q coolerdash-helperd; then + systemctl stop --no-block coolerdash-helperd.service + systemctl disable coolerdash-helperd.service + fi + if systemctl list-unit-files cc-plugin-coolerdash.service | grep -q cc-plugin-coolerdash; then + systemctl stop cc-plugin-coolerdash.service + systemctl disable cc-plugin-coolerdash.service + fi if systemctl is-active --quiet coolercontrold.service; then - systemctl stop coolercontrold.service || true + systemctl stop coolercontrold.service fi systemctl daemon-reload fi - # Migration: remove old helperd from /etc + # Remove old helperd from /etc rm -f /etc/systemd/system/coolerdash-helperd.service + + # Remove legacy files + rm -f /etc/systemd/system/coolerdash.service + rm -f /etc/coolercontrol/plugins/coolerdash/config.ini + rm -f /etc/coolercontrol/plugins/coolerdash/ui.html + rm -f /etc/coolercontrol/plugins/coolerdash/LICENSE + rm -f /etc/coolercontrol/plugins/coolerdash/coolerdash + rm -f /usr/share/applications/coolerdash-settings.desktop + rm -f /bin/coolerdash + rm -f /usr/bin/coolerdash + rm -rf /opt/coolerdash + rm -rf /etc/coolerdash + + # Remove legacy user + if id -u coolerdash >/dev/null 2>&1; then + userdel -rf coolerdash + fi ;; esac From 937a38d973989fad0fefcdf56f65f8c86a775031 Mon Sep 17 00:00:00 2001 From: damachine Date: Mon, 9 Feb 2026 02:05:38 +0100 Subject: [PATCH 5/5] clean installation scripts and fix systemd migration --- aur/coolerdash.install | 6 ++++-- coolerdash.install | 6 ++++-- packaging/coolerdash.spec | 3 ++- packaging/debian/postinst | 3 ++- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/aur/coolerdash.install b/aur/coolerdash.install index 9c05a1e..f4c263b 100644 --- a/aur/coolerdash.install +++ b/aur/coolerdash.install @@ -35,7 +35,8 @@ post_install() { udevadm trigger --subsystem-match=usb fi - # Remove old helperd from /etc + # Migrate helperd from /etc to /usr/lib + rm -f /etc/systemd/system/multi-user.target.wants/coolerdash-helperd.service rm -f /etc/systemd/system/coolerdash-helperd.service systemctl daemon-reload @@ -56,7 +57,8 @@ post_install() { } post_upgrade() { - # Remove old helperd from /etc + # Migrate helperd from /etc to /usr/lib + rm -f /etc/systemd/system/multi-user.target.wants/coolerdash-helperd.service rm -f /etc/systemd/system/coolerdash-helperd.service systemctl daemon-reload diff --git a/coolerdash.install b/coolerdash.install index 9c05a1e..f4c263b 100644 --- a/coolerdash.install +++ b/coolerdash.install @@ -35,7 +35,8 @@ post_install() { udevadm trigger --subsystem-match=usb fi - # Remove old helperd from /etc + # Migrate helperd from /etc to /usr/lib + rm -f /etc/systemd/system/multi-user.target.wants/coolerdash-helperd.service rm -f /etc/systemd/system/coolerdash-helperd.service systemctl daemon-reload @@ -56,7 +57,8 @@ post_install() { } post_upgrade() { - # Remove old helperd from /etc + # Migrate helperd from /etc to /usr/lib + rm -f /etc/systemd/system/multi-user.target.wants/coolerdash-helperd.service rm -f /etc/systemd/system/coolerdash-helperd.service systemctl daemon-reload diff --git a/packaging/coolerdash.spec b/packaging/coolerdash.spec index bbd8a11..6eec7a5 100644 --- a/packaging/coolerdash.spec +++ b/packaging/coolerdash.spec @@ -73,7 +73,8 @@ fi if [ -f /etc/coolercontrol/plugins/coolerdash/config.json ]; then chmod 666 /etc/coolercontrol/plugins/coolerdash/config.json fi -# Remove old helperd from /etc +# Migrate helperd from /etc to /usr/lib +rm -f /etc/systemd/system/multi-user.target.wants/coolerdash-helperd.service rm -f /etc/systemd/system/coolerdash-helperd.service if command -v systemctl >/dev/null 2>&1; then systemctl daemon-reload diff --git a/packaging/debian/postinst b/packaging/debian/postinst index 110d352..f95df70 100755 --- a/packaging/debian/postinst +++ b/packaging/debian/postinst @@ -8,7 +8,8 @@ case "$1" in chmod 666 /etc/coolercontrol/plugins/coolerdash/config.json fi - # Remove old helperd from /etc + # Migrate helperd from /etc to /usr/lib + rm -f /etc/systemd/system/multi-user.target.wants/coolerdash-helperd.service rm -f /etc/systemd/system/coolerdash-helperd.service # Enable services