Add initd service manager as Software Hub preset - #39
Conversation
|
This looks great, however i'm part way through a massive refactor to support multiple containers and multi different distros so wont merge this yet. Once my changes are done ill let you know here so you can refactor to work across distros |
Sure, I'll keep it open until then and won't remove the branch. |
|
Great thanks for the hard work! |
Haha, nothing compared to yours 😆 |
|
@sleepy-snowflake with 1.5 out im not ready to start accepting new PRs again, feel free to rebase and update this. Thank you! |
d55b787 to
1b5c4a8
Compare
Addresses devwithzachary#20: installs EdwardLab/initd v0.0.2 as an opt-in preset to provide working systemctl in proot where systemd cannot run. - New preset 'initd_service_manager' (arm64/x86_64 only) - SHA256-pinned download from GitHub releases - POSIX shim replaces fake systemctl stub with real client - Shim intercepts reboot/poweroff/halt, fakes offline enable/disable - Autostart hook via /etc/profile.d/ for session-level daemon lifecycle - New tests for version pinning, shim POSIX compliance, and install command structure
$INITD_VERSION produced literal shell ${INITD_VERSION} which the
test assertion couldn't match against '0.0.2'. Use Kotlin interpolation
to embed the pinned version directly into the curl URL and echo.
a58ae79 to
db34ac5
Compare
Addresses #20. Systemd can't run in proot so anything that calls systemctl hits a fake exit 0 stub and fails silently. Users have no way to manage services.
This adds an opt-in Software Hub preset that installs EdwardLab/initd, a lightweight systemd-compatible init system. It gives users a real systemctl with automatic daemon management inside proot.
What changed:
New preset initd_service_manager in SoftwarePackage.kt. The install script detects the device architecture, downloads a SHA256-pinned initd binary from GitHub releases, and installs it to /usr/local/lib/initd/. A POSIX shim at /usr/local/bin/systemctl replaces the fake stub. The shim starts the daemon automatically on the first systemctl call, and it blocks reboot/poweroff/halt since those are not safe in proot. An autostart hook in /etc/profile.d/ brings up the daemon with each terminal session without touching any app-side lifecycle code.
Icon mapping added in SoftwareCard.kt for the preset card. Four new unit tests covering version pinning, shim POSIX compliance, and install command structure. Existing preset count test bumped from 6 to 7.
Scope is arm64 and x86_64 only. The install script detects architecture and fails with a clear message on armv7. All changes are additive, nothing existing is touched. The original systemctl stub is backed up to .loa-stub and can be restored by removing the shim symlink if needed.
Testing: unit tests pass, APK builds through CI (cleaned up). Manually verified by installing redis-server, enabling and starting it with systemctl, then running redis-cli ping which returned PONG.