diff --git a/cli.go b/cli.go index 24b7393..850fd02 100644 --- a/cli.go +++ b/cli.go @@ -237,6 +237,12 @@ func PromptForConfiguration() Config { // ConfigCLI prompts the user for configuration and writes to a config file func ConfigCLI(path string) { + // Check if path exists + if _, err := os.Stat(path); !os.IsNotExist(err) { + fmt.Printf("File exists, or some other error trying to open file %s\n", path) + os.Exit(1) + } + config := PromptForConfiguration() SaveConfig(path, config) diff --git a/install.sh b/install.sh index 767fb4b..3bde91e 100644 --- a/install.sh +++ b/install.sh @@ -16,7 +16,7 @@ sudo chmod +x $INSTALLBIN sudo chown -R $INSTALLUSER: $INSTALLDIR # Generate a configuration file -sudo -u $INSTALLUSER $INSTALLBIN -c $CONFIGFILE config +sudo -u $INSTALLUSER $INSTALLBIN -c $CONFIGFILE config || true # Create unit file sudo sh -c "cat > /etc/systemd/system/tempgopher.service" << EOM