Skip to content

Add initd service manager as Software Hub preset - #39

Draft
sleepy-snowflake wants to merge 3 commits into
devwithzachary:mainfrom
sleepy-snowflake:initd-service-manager
Draft

Add initd service manager as Software Hub preset#39
sleepy-snowflake wants to merge 3 commits into
devwithzachary:mainfrom
sleepy-snowflake:initd-service-manager

Conversation

@sleepy-snowflake

@sleepy-snowflake sleepy-snowflake commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

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.

@devwithzachary

Copy link
Copy Markdown
Owner

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

@sleepy-snowflake

Copy link
Copy Markdown
Contributor Author

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.
Converting this into a draft, cuz distros like alpine don't need this so I can later edit without causing any misunderstandings >_<

@sleepy-snowflake
sleepy-snowflake marked this pull request as draft September 1, 2026 13:55
@devwithzachary

Copy link
Copy Markdown
Owner

Great thanks for the hard work!

@sleepy-snowflake

Copy link
Copy Markdown
Contributor Author

Great thanks for the hard work!

Haha, nothing compared to yours 😆

@devwithzachary

Copy link
Copy Markdown
Owner

@sleepy-snowflake with 1.5 out im not ready to start accepting new PRs again, feel free to rebase and update this. Thank you!

@sleepy-snowflake
sleepy-snowflake changed the base branch from 1.5.0 to main September 12, 2026 11:34
@sleepy-snowflake
sleepy-snowflake marked this pull request as ready for review September 12, 2026 11:35
@sleepy-snowflake
sleepy-snowflake marked this pull request as draft September 12, 2026 11:51
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants