Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3a4cb1c327 |
@@ -73,6 +73,26 @@ func run() error {
|
||||
|
||||
switch {
|
||||
case actions.Help:
|
||||
// Compatibility shim for one release.
|
||||
//
|
||||
// Serving became an explicit verb, but self-update is run by the *old* binary — so the
|
||||
// repair added to the updater cannot fix the very update that installs the new one. A
|
||||
// unit written before this change starts us with no arguments, and without this branch
|
||||
// the service would simply stop working, unattended, on a host nobody is watching.
|
||||
//
|
||||
// Only when systemd started us: INVOCATION_ID is set by systemd for every service
|
||||
// invocation and by nothing else, so a person at a terminal still gets usage. Remove
|
||||
// this once no deployment predates --serve.
|
||||
if os.Getenv("INVOCATION_ID") != "" {
|
||||
slog.Warn("started by systemd with no verb — this unit predates --serve; " +
|
||||
"repairing it and serving anyway")
|
||||
if repaired, err := system.RepairExecStart(); err != nil {
|
||||
slog.Error("could not repair the unit; fix ExecStart by hand", "err", err)
|
||||
} else if repaired {
|
||||
slog.Info("systemd unit updated to pass --serve")
|
||||
}
|
||||
return serve(cfg)
|
||||
}
|
||||
config.Usage(os.Stderr)
|
||||
os.Exit(2)
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user