Skip to content

Commit

Permalink
Added support for systemd user units #175
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholasdille committed Jan 16, 2024
1 parent 4cc50c8 commit f33241a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cmd/uniget/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,10 @@ func installTools(requestedTools tool.Tools, check bool, plan bool, reinstall bo
if err != nil {
return fmt.Errorf("unable to install completion shim: %s", err)
}
err = installSystemDUnit()
if err != nil {
return fmt.Errorf("unable to install systemd unit: %s", err)
}

return nil
}
10 changes: 10 additions & 0 deletions cmd/uniget/postinstall.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,3 +155,13 @@ func installCompletionShim() error {

return nil
}

func installSystemDUnit() error {
// add flag --systemd whether to install systemd units
// check if tool ships with systemd unit (check file list for etc/systemd/system/*)
// if no user context create symlink from TARGET/etc/systemd/system/* to /etc/systemd/system/
// if user context create symlink from TARGET/etc/systemd/user/* to ~/.local/share/systemd/user/ or ~/.config/systemd/user/
// reload systemd honoring context

return nil
}

0 comments on commit f33241a

Please sign in to comment.