feat(helper): make install-helper.sh systemd-optional (OpenRC/Artix, runit) - #57
Merged
Conversation
…runit) The helper is Type=dbus, so D-Bus can activate it on demand without a systemd unit. install-helper.sh now detects systemd (has_systemd: /run/systemd/system + systemctl) and branches: - systemd: unchanged - installs the unit, daemon-reload, enable, restart. - non-systemd: skips the unit + all systemctl calls; strips SystemdService= from the installed D-Bus service file so dbus activates via Exec= directly; reloads dbus via the existing SIGHUP fallback; warns that polkitd must be running. status() reports 'D-Bus activated on demand' without systemctl on non-systemd; uninstall() guards daemon-reload. reload_dbus() now gates its systemctl call on has_systemd to avoid command-not-found noise. Closes #55.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #55 (tracks #54 — the Artix user who couldn't install).
Change
The helper is
Type=dbuswithBusName=io.github.hikaps.CouchPlayHelper, so "running" just means owning that name on the system bus — D-Bus can activate it on demand without a systemd unit.install-helper.shnow detects systemd (has_systemd:/run/systemd/system+systemctl) and branches:daemon-reload,enable,restart.systemctlcalls; stripsSystemdService=from the installed D-Bus service file (source untouched) so dbus activates viaExec=directly; reloads dbus via the existing SIGHUP fallback inreload_dbus(); warns thatpolkitdmust be running (rc-service polkitd start/sv start polkitd).status()reportsD-Bus activated on demand (no systemd)without callingsystemctlon non-systemd;uninstall()guardsdaemon-reload;reload_dbus()gates itssystemctl reload dbusonhas_systemd(the SIGHUP fallback already covered non-systemd).Tradeoff
Without the systemd unit the helper loses the sandboxing directives (
ProtectSystem, etc.) — acceptable, since the helper runs as root and needs broad access (/etc,/home,/dev/input), and most are already relaxed (ProtectSystem=false,ProtectHome=false).Acceptance (#55)
install-helper.sh installsucceeds on OpenRC/Artix with nosystemctlpresent. ✓ (logic; non-systemd path skips all systemctl calls)statusreports correctly withoutsystemctl. ✓ (verified via simulation:D-Bus activated on demand, exit 0)Verification
bash -nclean;shellcheckzero findings.has_systemd=true,status→Running+ D-Bus Available (unchanged behavior).has_systemd=false):status→D-Bus activated on demand (no systemd), nosystemctlerror..servicekeeps[D-BUS Service]/Name/Exec/User, drops onlySystemdService=.