From f920b23607cafac3cffb65d3810c160eeac71715 Mon Sep 17 00:00:00 2001 From: Bernd Schoolmann Date: Sat, 16 Dec 2023 06:40:00 +0100 Subject: [PATCH] Fix setup when systmd user dir does not exist --- cmd/setup_linux.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/cmd/setup_linux.go b/cmd/setup_linux.go index c575c6b..ed7f3cb 100644 --- a/cmd/setup_linux.go +++ b/cmd/setup_linux.go @@ -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) } @@ -92,6 +103,7 @@ func setupSystemd() { command2.Stderr = os.Stderr err = command2.Run() if err != nil { + fmt.Println("failed enabling systemd service") panic(err) }