Skip to content

Commit

Permalink
machined install should create systemd user unit directory
Browse files Browse the repository at this point in the history
On server installs (Ubuntu Server at least) the user's .config path
to systemd user units may not be present.  Ensure this path exists for
attempting to render the unit template file.

Signed-off-by: Ryan Harper <[email protected]>
  • Loading branch information
raharper authored and hallyn committed Jul 3, 2023
1 parent a7b1081 commit c7af020
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cmd/machined/cmd/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ func doInstall(cmd *cobra.Command, args []string) error {
if err != nil {
return fmt.Errorf("Failed to get Systemd Unit Path: %s", err)
}
if !api.PathExists(unitPath) {
if err := api.EnsureDir(unitPath); err != nil {
return fmt.Errorf("Failed to create Systemd Unit path %q: %s", unitPath, err)
}
}
serviceUnit := filepath.Join(unitPath, MachinedServiceUnit)
socketUnit := filepath.Join(unitPath, MachinedSocketUnit)
customService := cmd.Flag("service-template").Value.String()
Expand Down

0 comments on commit c7af020

Please sign in to comment.