Skip to content

Commit

Permalink
Fix setup when systmd user dir does not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
quexten committed Dec 16, 2023
1 parent ccddd00 commit f920b23
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions cmd/setup_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,20 @@ func setupSystemd() {
file.Close()

userDirectory := os.Getenv("HOME")
//ensure user systemd dir exists
command0 := exec.Command("mkdir", "-p", userDirectory+"/.config/systemd/user/")
err = command0.Run()
if err != nil {
fmt.Println("failed creating systemd user dir")
fmt.Println(err.Error())
panic(err)
}

command := exec.Command("mv", "/tmp/goldwarden.service", userDirectory+"/.config/systemd/user/goldwarden.service")
err = command.Run()
if err != nil {
fmt.Println("failed moving goldwarden service file to systemd dir")
fmt.Println(err.Error())
panic(err)
}

Expand All @@ -92,6 +103,7 @@ func setupSystemd() {
command2.Stderr = os.Stderr
err = command2.Run()
if err != nil {
fmt.Println("failed enabling systemd service")
panic(err)
}

Expand Down

0 comments on commit f920b23

Please sign in to comment.