Add a systemd for embedded systems with one user#326
Conversation
This is a dead simple systemd unit file, that assumes cpud is in root's $PATH, and a key in /key.pub. It's really for basic use with small boards that have one user. Signed-off-by: Ronald G Minnich <rminnich@gmail.com>
There was a problem hiding this comment.
Pull request overview
Adds a minimal systemd unit + install helper intended for simple embedded deployments where cpud runs as root and authenticates via a single shared public key.
Changes:
- Added
systemd/cpud.serviceunit to runcpudat boot with a fixed public key path. - Added a
systemd/Makefileto install the unit and enable/reload it. - Added a short
systemd/README.mddescribing the intent and assumptions.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
systemd/README.md |
Documents the intended “primitive” embedded usage and key location assumption. |
systemd/Makefile |
Provides targets to install the unit and enable/reload systemd. |
systemd/cpud.service |
Defines the systemd service for running cpud on boot. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| For now, it is for small embedded systems, with a shared key: /key.pub. | ||
|
|
||
| We welcome improvements. |
| all: | ||
| cp cpud.service /etc/systemd/system/cpud.service | ||
|
|
||
| reload: | ||
| systemctl daemon-reload | ||
| systemctl enable --now cpud | ||
|
|
| ExecStart=/usr/bin/cpud -pk /key.pub | ||
| Restart=on-failure |
There was a problem hiding this comment.
It is likely just pkg-ed in initramfs per PR description ("small embedded system"), so the bot seems to have hallucinated that this is a regular go cmd to be go install-ed (?)
There was a problem hiding this comment.
yeah, the env part seems like it's assuming a regular distro that has /usr/bin/env, which u-root might not have. btw, i think this might not be for u-root either. from talking with ron on the side, i thought this was just some random distribution.
that said, it's not wrong about the discrepancy between saying "cpud just needs to be in $PATH" and hardcoding /usr/bin/cpud.
systemd requires absolute paths (i think), so you have to make some assumption: either about the existence of /usr/bin/env or the location of cpud. either way is fine with me.
This is a dead simple systemd unit file, that assumes cpud is in root's $PATH, and a key in /key.pub.
It's really for basic use with small boards that have one user.