docs: exe-setup.service runs on every boot, so setup scripts must be idempotent - #17
Merged
Merged
Conversation
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.
Why
The README described
exe-setup.serviceas first-boot-only in two places. That holds for the first boot and not afterwards: exe.dev writes/exe.dev/setupback into the VM on every boot,ConditionPathExistspasses again, and the script runs again. TheExecStartPostrmstill deletes the file each time; it just comes back.Reproduced on a stock
boldsoftware/exeuntuVM with a four-line script containing a bareuseradd --system: first boot succeeded, second boot exited 9 (user already exists), the unit stayedfailed, andsystemctl --failedwent from 0 to 1. Surfaced for real while migrating html-share to exeslim, where the setup script creates thecaddyuser.What changes
id -u caddy || useradd …).Description=no longer says "on first boot".No behaviour change. The section also records that the script cannot be amended after
new(no CLI command, and on-box edits are overwritten from the stored copy at every boot), so the guard must be right at creation time, and thatssh exe.dev doc customizationclaims first-boot-only. The unit is identical to exeuntu's apart from the description string.Not done: a stamp-file guard
The unit could be made genuinely first-boot-only:
Left out because it diverges from exeuntu (a script that relies on re-running would stop) and because it changes retry semantics:
ExecStartPostonly runs on success, so a script that fails on boot one would still retry on boot two, which may or may not be wanted. Reporting the re-injection upstream to boldsoftware is a separate call.