fix(systemd): include service user in service file generation
* Add ServiceUser field to Config struct for user specification. * Update Generate and Install functions to accept service user. * Modify tests to reflect changes in service user handling.
This commit is contained in:
@@ -31,7 +31,7 @@ func runInstall(cmd *cobra.Command, args []string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
prefix, suffix := cfg.Prefix, cfg.Suffix
|
||||
prefix, suffix, serviceUser := cfg.Prefix, cfg.Suffix, cfg.EffectiveServiceUser()
|
||||
installed := 0
|
||||
skipped := 0
|
||||
removed := 0
|
||||
@@ -57,7 +57,7 @@ func runInstall(cmd *cobra.Command, args []string) error {
|
||||
}
|
||||
|
||||
if dryRun {
|
||||
content, err := systemd.Generate(u, prefix, suffix)
|
||||
content, err := systemd.Generate(u, prefix, suffix, serviceUser)
|
||||
if err != nil {
|
||||
fmt.Printf(" ✗ %s: %v\n", u.Name, err)
|
||||
continue
|
||||
@@ -68,7 +68,7 @@ func runInstall(cmd *cobra.Command, args []string) error {
|
||||
continue
|
||||
}
|
||||
|
||||
if err := systemd.Install(u, prefix, suffix); err != nil {
|
||||
if err := systemd.Install(u, prefix, suffix, serviceUser); err != nil {
|
||||
fmt.Printf(" ✗ failed: %s: %v\n", u.Name, err)
|
||||
} else {
|
||||
path, _ := systemd.UnitPath(u, prefix, suffix)
|
||||
|
||||
Reference in New Issue
Block a user