From 20d460c70eb550e13b190021f835895aba07e6a9 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Tue, 2 Jul 2019 00:02:09 -0600 Subject: [PATCH] ready for more testing --- .../Library/LaunchDaemons/_rdns_.plist.tmpl | 8 +-- .../etc/systemd/system/_name_.service.tmpl | 18 ++--- installer/install.go | 30 ++++----- installer/install_darwin.go | 2 +- installer/static/ab0x.go | 8 +-- serviceman.go | 67 +++++++++++++++++-- 6 files changed, 95 insertions(+), 38 deletions(-) diff --git a/installer/dist/Library/LaunchDaemons/_rdns_.plist.tmpl b/installer/dist/Library/LaunchDaemons/_rdns_.plist.tmpl index c75eed4..cf16b8d 100644 --- a/installer/dist/Library/LaunchDaemons/_rdns_.plist.tmpl +++ b/installer/dist/Library/LaunchDaemons/_rdns_.plist.tmpl @@ -9,11 +9,9 @@ {{- if .Interpreter }} {{ .Interpreter }} {{- end }} - {{ .Local }}/opt/{{ .Name }}/{{ .Exec }} - {{- if .Argv }} + {{ .Exec }} {{- range $arg := .Argv }} {{ $arg }} - {{- end }} {{- end }} {{- if .Envs }} @@ -60,9 +58,11 @@ {{ end -}} + {{ if .Workdir -}} WorkingDirectory - {{ .Local }}/opt/{{ .Name }} + {{ .Workdir }} + {{ end -}} StandardErrorPath {{ .LogDir }}/{{ .Name }}.log StandardOutPath diff --git a/installer/dist/etc/systemd/system/_name_.service.tmpl b/installer/dist/etc/systemd/system/_name_.service.tmpl index e7cd86e..79bd48f 100644 --- a/installer/dist/etc/systemd/system/_name_.service.tmpl +++ b/installer/dist/etc/systemd/system/_name_.service.tmpl @@ -1,20 +1,20 @@ # Pre-req # sudo mkdir -p {{ .Local }}/opt/{{ .Name }}/ {{ .Local }}/var/log/{{ .Name }} -{{ if not .Local -}} +{{ if .System -}} {{- if and .User ( ne "root" .User ) -}} # sudo adduser {{ .User }} --home /opt/{{ .Name }} # sudo chown -R {{ .User }}:{{ .Group }} /opt/{{ .Name }}/ /var/log/{{ .Name }} {{- end }} {{ end -}} # Post-install -# sudo systemctl {{ if .Local -}} --user {{ end -}} daemon-reload -# sudo systemctl {{ if .Local -}} --user {{ end -}} restart {{ .Name }}.service -# sudo journalctl {{ if .Local -}} --user {{ end -}} -xefu {{ .Name }} +# sudo systemctl {{ if not .System -}} --user {{ end -}} daemon-reload +# sudo systemctl {{ if not .System -}} --user {{ end -}} restart {{ .Name }}.service +# sudo journalctl {{ if not .System -}} --user {{ end -}} -xefu {{ .Name }} [Unit] Description={{ .Title }} - {{ .Desc }} Documentation={{ .URL }} -{{ if not .Local -}} +{{ if .System -}} After=network-online.target Wants=network-online.target systemd-networkd-wait-online.service {{- end }} @@ -33,8 +33,10 @@ User={{ .User }} Group={{ .Group }} {{ end -}} -WorkingDirectory={{ .Local }}/opt/{{ .Name }} -ExecStart={{if .Interpreter }}{{ .Interpreter }} {{ end }}{{ .Local }}/opt/{{ .Name }}/{{ .Name }} {{ .Args }} +{{ if .Workdir -}} +WorkingDirectory={{ .Workdir }} +{{ end -}} +ExecStart={{if .Interpreter }}{{ .Interpreter }} {{ end }}{{ .Exec }} {{- range $arg := .Argv }}{{ $arg }} {{- end }} ExecReload=/bin/kill -USR1 $MAINPID {{if .Production -}} @@ -80,7 +82,7 @@ NoNewPrivileges=true {{ end -}} [Install] -{{ if not .Local -}} +{{ if .System -}} WantedBy=multi-user.target {{- else -}} WantedBy=default.target diff --git a/installer/install.go b/installer/install.go index 01ab1fc..6d5f0b0 100644 --- a/installer/install.go +++ b/installer/install.go @@ -3,6 +3,7 @@ package installer import ( + "fmt" "os" "path/filepath" "strings" @@ -58,7 +59,7 @@ type Config struct { Interpreter string `json:"interpreter"` // i.e. node, python Exec string `json:"exec"` Argv []string `json:"argv"` - Args string `json:"-"` + Workdir string `json:"workdir"` Envs map[string]string `json:"envs"` User string `json:"user"` Group string `json:"group"` @@ -78,22 +79,16 @@ func Install(c *Config) error { if "" == c.Exec { c.Exec = c.Name } - c.Args = strings.Join(c.Argv, " ") - // TODO handle non-system installs - // * ~/.local/opt/watchdog/watchdog - // * ~/.local/share/watchdog/var/log/ - // * ~/.config/watchdog/watchdog.json if !c.System { home, err := os.UserHomeDir() if nil != err { + fmt.Fprintf(os.Stderr, "Unrecoverable Error: %s", err) + os.Exit(4) return err + } else { + c.home = home } - c.home = home - c.Local = filepath.Join(c.home, ".local") - c.LogDir = filepath.Join(c.home, ".local", "share", c.Name, "var", "log") - } else { - c.LogDir = "/var/log/" + c.Name } err := install(c) @@ -119,10 +114,15 @@ func IsPrivileged() bool { func WhereIs(exec string) (string, error) { exec = filepath.ToSlash(exec) if strings.Contains(exec, "/") { - // filepath.Clean(exec) - // it's a path (don't allow filenames with slashes) - // TODO stat - return exec, nil + // it's a path (so we don't allow filenames with slashes) + stat, err := os.Stat(exec) + if nil != err { + return "", err + } + if stat.IsDir() { + return "", fmt.Errorf("'%s' is not an executable file", exec) + } + return filepath.Abs(exec) } return whereIs(exec) } diff --git a/installer/install_darwin.go b/installer/install_darwin.go index bad5feb..386e963 100644 --- a/installer/install_darwin.go +++ b/installer/install_darwin.go @@ -49,7 +49,7 @@ func install(c *Config) error { // Write the file out // TODO rdns - plistName := c.Name + ".plist" + plistName := c.ReverseDNS + ".plist" plistPath := filepath.Join(plistDir, plistName) if err := ioutil.WriteFile(plistPath, rw.Bytes(), 0644); err != nil { fmt.Println("Use 'sudo' to install as a privileged system service.") diff --git a/installer/static/ab0x.go b/installer/static/ab0x.go index 344cd5d..27009b2 100644 --- a/installer/static/ab0x.go +++ b/installer/static/ab0x.go @@ -1,5 +1,5 @@ -// Code generated by fileb0x at "2019-07-01 02:25:06.914859 -0600 MDT m=+0.005210050" from config file "b0x.toml" DO NOT EDIT. -// modification hash(23db194c43de8cc25ab29e0b867004fa.acdb557394f98d3c09c0bb4d4b9142f8) +// Code generated by fileb0x at "2019-07-02 00:00:44.483683 -0600 MDT m=+0.004513036" from config file "b0x.toml" DO NOT EDIT. +// modification hash(9e1b78f0c3896774c01132e8ab006403.acdb557394f98d3c09c0bb4d4b9142f8) package static @@ -36,10 +36,10 @@ type HTTPFS struct { } // FileDistLibraryLaunchDaemonsRdnsPlistTmpl is "dist/Library/LaunchDaemons/_rdns_.plist.tmpl" -var FileDistLibraryLaunchDaemonsRdnsPlistTmpl = []byte("\x3c\x3f\x78\x6d\x6c\x20\x76\x65\x72\x73\x69\x6f\x6e\x3d\x22\x31\x2e\x30\x22\x20\x65\x6e\x63\x6f\x64\x69\x6e\x67\x3d\x22\x55\x54\x46\x2d\x38\x22\x3f\x3e\x0a\x3c\x21\x44\x4f\x43\x54\x59\x50\x45\x20\x70\x6c\x69\x73\x74\x20\x50\x55\x42\x4c\x49\x43\x20\x22\x2d\x2f\x2f\x41\x70\x70\x6c\x65\x2f\x2f\x44\x54\x44\x20\x50\x4c\x49\x53\x54\x20\x31\x2e\x30\x2f\x2f\x45\x4e\x22\x20\x22\x68\x74\x74\x70\x3a\x2f\x2f\x77\x77\x77\x2e\x61\x70\x70\x6c\x65\x2e\x63\x6f\x6d\x2f\x44\x54\x44\x73\x2f\x50\x72\x6f\x70\x65\x72\x74\x79\x4c\x69\x73\x74\x2d\x31\x2e\x30\x2e\x64\x74\x64\x22\x3e\x0a\x3c\x70\x6c\x69\x73\x74\x20\x76\x65\x72\x73\x69\x6f\x6e\x3d\x22\x31\x2e\x30\x22\x3e\x0a\x3c\x64\x69\x63\x74\x3e\x0a\x09\x3c\x6b\x65\x79\x3e\x4c\x61\x62\x65\x6c\x3c\x2f\x6b\x65\x79\x3e\x0a\x09\x3c\x73\x74\x72\x69\x6e\x67\x3e\x7b\x7b\x20\x2e\x52\x65\x76\x65\x72\x73\x65\x44\x4e\x53\x20\x7d\x7d\x3c\x2f\x73\x74\x72\x69\x6e\x67\x3e\x0a\x09\x3c\x6b\x65\x79\x3e\x50\x72\x6f\x67\x72\x61\x6d\x41\x72\x67\x75\x6d\x65\x6e\x74\x73\x3c\x2f\x6b\x65\x79\x3e\x0a\x09\x3c\x61\x72\x72\x61\x79\x3e\x0a\x09\x09\x7b\x7b\x2d\x20\x69\x66\x20\x2e\x49\x6e\x74\x65\x72\x70\x72\x65\x74\x65\x72\x20\x7d\x7d\x0a\x09\x09\x3c\x73\x74\x72\x69\x6e\x67\x3e\x7b\x7b\x20\x2e\x49\x6e\x74\x65\x72\x70\x72\x65\x74\x65\x72\x20\x7d\x7d\x3c\x2f\x73\x74\x72\x69\x6e\x67\x3e\x0a\x09\x09\x7b\x7b\x2d\x20\x65\x6e\x64\x20\x7d\x7d\x0a\x09\x09\x3c\x73\x74\x72\x69\x6e\x67\x3e\x7b\x7b\x20\x2e\x4c\x6f\x63\x61\x6c\x20\x7d\x7d\x2f\x6f\x70\x74\x2f\x7b\x7b\x20\x2e\x4e\x61\x6d\x65\x20\x7d\x7d\x2f\x7b\x7b\x20\x2e\x45\x78\x65\x63\x20\x7d\x7d\x3c\x2f\x73\x74\x72\x69\x6e\x67\x3e\x0a\x09\x20\x20\x7b\x7b\x2d\x20\x69\x66\x20\x2e\x41\x72\x67\x76\x20\x7d\x7d\x0a\x09\x09\x7b\x7b\x2d\x20\x72\x61\x6e\x67\x65\x20\x24\x61\x72\x67\x20\x3a\x3d\x20\x2e\x41\x72\x67\x76\x20\x7d\x7d\x0a\x09\x09\x3c\x73\x74\x72\x69\x6e\x67\x3e\x7b\x7b\x20\x24\x61\x72\x67\x20\x7d\x7d\x3c\x2f\x73\x74\x72\x69\x6e\x67\x3e\x0a\x09\x09\x7b\x7b\x2d\x20\x65\x6e\x64\x20\x7d\x7d\x0a\x09\x20\x20\x7b\x7b\x2d\x20\x65\x6e\x64\x20\x7d\x7d\x0a\x09\x3c\x2f\x61\x72\x72\x61\x79\x3e\x0a\x09\x7b\x7b\x2d\x20\x69\x66\x20\x2e\x45\x6e\x76\x73\x20\x7d\x7d\x0a\x09\x3c\x6b\x65\x79\x3e\x45\x6e\x76\x69\x72\x6f\x6e\x6d\x65\x6e\x74\x56\x61\x72\x69\x61\x62\x6c\x65\x73\x3c\x2f\x6b\x65\x79\x3e\x0a\x09\x3c\x64\x69\x63\x74\x3e\x0a\x09\x09\x7b\x7b\x2d\x20\x72\x61\x6e\x67\x65\x20\x24\x6b\x65\x79\x2c\x20\x24\x76\x61\x6c\x75\x65\x20\x3a\x3d\x20\x2e\x45\x6e\x76\x73\x20\x7d\x7d\x0a\x09\x09\x3c\x6b\x65\x79\x3e\x7b\x7b\x20\x24\x6b\x65\x79\x20\x7d\x7d\x3c\x2f\x6b\x65\x79\x3e\x0a\x09\x09\x3c\x73\x74\x72\x69\x6e\x67\x3e\x7b\x7b\x20\x24\x76\x61\x6c\x75\x65\x20\x7d\x7d\x3c\x2f\x73\x74\x72\x69\x6e\x67\x3e\x0a\x09\x09\x7b\x7b\x2d\x20\x65\x6e\x64\x20\x7d\x7d\x0a\x09\x3c\x2f\x64\x69\x63\x74\x3e\x0a\x09\x7b\x7b\x2d\x20\x65\x6e\x64\x20\x7d\x7d\x0a\x0a\x09\x7b\x7b\x69\x66\x20\x2e\x55\x73\x65\x72\x20\x2d\x7d\x7d\x0a\x09\x3c\x6b\x65\x79\x3e\x55\x73\x65\x72\x4e\x61\x6d\x65\x3c\x2f\x6b\x65\x79\x3e\x0a\x09\x3c\x73\x74\x72\x69\x6e\x67\x3e\x7b\x7b\x20\x2e\x55\x73\x65\x72\x20\x7d\x7d\x3c\x2f\x73\x74\x72\x69\x6e\x67\x3e\x0a\x09\x3c\x6b\x65\x79\x3e\x47\x72\x6f\x75\x70\x4e\x61\x6d\x65\x3c\x2f\x6b\x65\x79\x3e\x0a\x09\x3c\x73\x74\x72\x69\x6e\x67\x3e\x7b\x7b\x20\x2e\x47\x72\x6f\x75\x70\x20\x7d\x7d\x3c\x2f\x73\x74\x72\x69\x6e\x67\x3e\x0a\x09\x3c\x6b\x65\x79\x3e\x49\x6e\x69\x74\x47\x72\x6f\x75\x70\x73\x3c\x2f\x6b\x65\x79\x3e\x0a\x09\x3c\x74\x72\x75\x65\x2f\x3e\x0a\x0a\x09\x7b\x7b\x65\x6e\x64\x20\x2d\x7d\x7d\x0a\x09\x3c\x6b\x65\x79\x3e\x52\x75\x6e\x41\x74\x4c\x6f\x61\x64\x3c\x2f\x6b\x65\x79\x3e\x0a\x09\x3c\x74\x72\x75\x65\x2f\x3e\x0a\x09\x7b\x7b\x20\x69\x66\x20\x2e\x52\x65\x73\x74\x61\x72\x74\x20\x2d\x7d\x7d\x0a\x09\x3c\x6b\x65\x79\x3e\x4b\x65\x65\x70\x41\x6c\x69\x76\x65\x3c\x2f\x6b\x65\x79\x3e\x0a\x09\x3c\x74\x72\x75\x65\x2f\x3e\x0a\x09\x3c\x21\x2d\x2d\x64\x69\x63\x74\x3e\x0a\x09\x09\x3c\x6b\x65\x79\x3e\x43\x72\x61\x73\x68\x65\x64\x3c\x2f\x6b\x65\x79\x3e\x0a\x09\x09\x3c\x74\x72\x75\x65\x2f\x3e\x0a\x09\x09\x3c\x6b\x65\x79\x3e\x4e\x65\x74\x77\x6f\x72\x6b\x53\x74\x61\x74\x65\x3c\x2f\x6b\x65\x79\x3e\x0a\x09\x09\x3c\x74\x72\x75\x65\x2f\x3e\x0a\x09\x09\x3c\x6b\x65\x79\x3e\x53\x75\x63\x63\x65\x73\x73\x66\x75\x6c\x45\x78\x69\x74\x3c\x2f\x6b\x65\x79\x3e\x0a\x09\x09\x3c\x66\x61\x6c\x73\x65\x2f\x3e\x0a\x09\x3c\x2f\x64\x69\x63\x74\x2d\x2d\x3e\x0a\x0a\x09\x7b\x7b\x20\x65\x6e\x64\x20\x2d\x7d\x7d\x0a\x09\x7b\x7b\x20\x69\x66\x20\x2e\x50\x72\x6f\x64\x75\x63\x74\x69\x6f\x6e\x20\x2d\x7d\x7d\x0a\x09\x3c\x6b\x65\x79\x3e\x53\x6f\x66\x74\x52\x65\x73\x6f\x75\x72\x63\x65\x4c\x69\x6d\x69\x74\x73\x3c\x2f\x6b\x65\x79\x3e\x0a\x09\x3c\x64\x69\x63\x74\x3e\x0a\x09\x09\x3c\x6b\x65\x79\x3e\x4e\x75\x6d\x62\x65\x72\x4f\x66\x46\x69\x6c\x65\x73\x3c\x2f\x6b\x65\x79\x3e\x0a\x09\x09\x3c\x69\x6e\x74\x65\x67\x65\x72\x3e\x38\x31\x39\x32\x3c\x2f\x69\x6e\x74\x65\x67\x65\x72\x3e\x0a\x09\x3c\x2f\x64\x69\x63\x74\x3e\x0a\x09\x3c\x6b\x65\x79\x3e\x48\x61\x72\x64\x52\x65\x73\x6f\x75\x72\x63\x65\x4c\x69\x6d\x69\x74\x73\x3c\x2f\x6b\x65\x79\x3e\x0a\x09\x3c\x64\x69\x63\x74\x2f\x3e\x0a\x0a\x09\x7b\x7b\x20\x65\x6e\x64\x20\x2d\x7d\x7d\x0a\x09\x3c\x6b\x65\x79\x3e\x57\x6f\x72\x6b\x69\x6e\x67\x44\x69\x72\x65\x63\x74\x6f\x72\x79\x3c\x2f\x6b\x65\x79\x3e\x0a\x09\x3c\x73\x74\x72\x69\x6e\x67\x3e\x7b\x7b\x20\x2e\x4c\x6f\x63\x61\x6c\x20\x7d\x7d\x2f\x6f\x70\x74\x2f\x7b\x7b\x20\x2e\x4e\x61\x6d\x65\x20\x7d\x7d\x3c\x2f\x73\x74\x72\x69\x6e\x67\x3e\x0a\x0a\x09\x3c\x6b\x65\x79\x3e\x53\x74\x61\x6e\x64\x61\x72\x64\x45\x72\x72\x6f\x72\x50\x61\x74\x68\x3c\x2f\x6b\x65\x79\x3e\x0a\x09\x3c\x73\x74\x72\x69\x6e\x67\x3e\x7b\x7b\x20\x2e\x4c\x6f\x67\x44\x69\x72\x20\x7d\x7d\x2f\x7b\x7b\x20\x2e\x4e\x61\x6d\x65\x20\x7d\x7d\x2e\x6c\x6f\x67\x3c\x2f\x73\x74\x72\x69\x6e\x67\x3e\x0a\x09\x3c\x6b\x65\x79\x3e\x53\x74\x61\x6e\x64\x61\x72\x64\x4f\x75\x74\x50\x61\x74\x68\x3c\x2f\x6b\x65\x79\x3e\x0a\x09\x3c\x73\x74\x72\x69\x6e\x67\x3e\x7b\x7b\x20\x2e\x4c\x6f\x67\x44\x69\x72\x20\x7d\x7d\x2f\x7b\x7b\x20\x2e\x4e\x61\x6d\x65\x20\x7d\x7d\x2e\x6c\x6f\x67\x3c\x2f\x73\x74\x72\x69\x6e\x67\x3e\x0a\x3c\x2f\x64\x69\x63\x74\x3e\x0a\x3c\x2f\x70\x6c\x69\x73\x74\x3e\x0a") +var FileDistLibraryLaunchDaemonsRdnsPlistTmpl = []byte("\x3c\x3f\x78\x6d\x6c\x20\x76\x65\x72\x73\x69\x6f\x6e\x3d\x22\x31\x2e\x30\x22\x20\x65\x6e\x63\x6f\x64\x69\x6e\x67\x3d\x22\x55\x54\x46\x2d\x38\x22\x3f\x3e\x0a\x3c\x21\x44\x4f\x43\x54\x59\x50\x45\x20\x70\x6c\x69\x73\x74\x20\x50\x55\x42\x4c\x49\x43\x20\x22\x2d\x2f\x2f\x41\x70\x70\x6c\x65\x2f\x2f\x44\x54\x44\x20\x50\x4c\x49\x53\x54\x20\x31\x2e\x30\x2f\x2f\x45\x4e\x22\x20\x22\x68\x74\x74\x70\x3a\x2f\x2f\x77\x77\x77\x2e\x61\x70\x70\x6c\x65\x2e\x63\x6f\x6d\x2f\x44\x54\x44\x73\x2f\x50\x72\x6f\x70\x65\x72\x74\x79\x4c\x69\x73\x74\x2d\x31\x2e\x30\x2e\x64\x74\x64\x22\x3e\x0a\x3c\x70\x6c\x69\x73\x74\x20\x76\x65\x72\x73\x69\x6f\x6e\x3d\x22\x31\x2e\x30\x22\x3e\x0a\x3c\x64\x69\x63\x74\x3e\x0a\x09\x3c\x6b\x65\x79\x3e\x4c\x61\x62\x65\x6c\x3c\x2f\x6b\x65\x79\x3e\x0a\x09\x3c\x73\x74\x72\x69\x6e\x67\x3e\x7b\x7b\x20\x2e\x52\x65\x76\x65\x72\x73\x65\x44\x4e\x53\x20\x7d\x7d\x3c\x2f\x73\x74\x72\x69\x6e\x67\x3e\x0a\x09\x3c\x6b\x65\x79\x3e\x50\x72\x6f\x67\x72\x61\x6d\x41\x72\x67\x75\x6d\x65\x6e\x74\x73\x3c\x2f\x6b\x65\x79\x3e\x0a\x09\x3c\x61\x72\x72\x61\x79\x3e\x0a\x09\x09\x7b\x7b\x2d\x20\x69\x66\x20\x2e\x49\x6e\x74\x65\x72\x70\x72\x65\x74\x65\x72\x20\x7d\x7d\x0a\x09\x09\x3c\x73\x74\x72\x69\x6e\x67\x3e\x7b\x7b\x20\x2e\x49\x6e\x74\x65\x72\x70\x72\x65\x74\x65\x72\x20\x7d\x7d\x3c\x2f\x73\x74\x72\x69\x6e\x67\x3e\x0a\x09\x09\x7b\x7b\x2d\x20\x65\x6e\x64\x20\x7d\x7d\x0a\x09\x09\x3c\x73\x74\x72\x69\x6e\x67\x3e\x7b\x7b\x20\x2e\x45\x78\x65\x63\x20\x7d\x7d\x3c\x2f\x73\x74\x72\x69\x6e\x67\x3e\x0a\x09\x09\x7b\x7b\x2d\x20\x72\x61\x6e\x67\x65\x20\x24\x61\x72\x67\x20\x3a\x3d\x20\x2e\x41\x72\x67\x76\x20\x7d\x7d\x0a\x09\x09\x3c\x73\x74\x72\x69\x6e\x67\x3e\x7b\x7b\x20\x24\x61\x72\x67\x20\x7d\x7d\x3c\x2f\x73\x74\x72\x69\x6e\x67\x3e\x0a\x09\x20\x20\x7b\x7b\x2d\x20\x65\x6e\x64\x20\x7d\x7d\x0a\x09\x3c\x2f\x61\x72\x72\x61\x79\x3e\x0a\x09\x7b\x7b\x2d\x20\x69\x66\x20\x2e\x45\x6e\x76\x73\x20\x7d\x7d\x0a\x09\x3c\x6b\x65\x79\x3e\x45\x6e\x76\x69\x72\x6f\x6e\x6d\x65\x6e\x74\x56\x61\x72\x69\x61\x62\x6c\x65\x73\x3c\x2f\x6b\x65\x79\x3e\x0a\x09\x3c\x64\x69\x63\x74\x3e\x0a\x09\x09\x7b\x7b\x2d\x20\x72\x61\x6e\x67\x65\x20\x24\x6b\x65\x79\x2c\x20\x24\x76\x61\x6c\x75\x65\x20\x3a\x3d\x20\x2e\x45\x6e\x76\x73\x20\x7d\x7d\x0a\x09\x09\x3c\x6b\x65\x79\x3e\x7b\x7b\x20\x24\x6b\x65\x79\x20\x7d\x7d\x3c\x2f\x6b\x65\x79\x3e\x0a\x09\x09\x3c\x73\x74\x72\x69\x6e\x67\x3e\x7b\x7b\x20\x24\x76\x61\x6c\x75\x65\x20\x7d\x7d\x3c\x2f\x73\x74\x72\x69\x6e\x67\x3e\x0a\x09\x09\x7b\x7b\x2d\x20\x65\x6e\x64\x20\x7d\x7d\x0a\x09\x3c\x2f\x64\x69\x63\x74\x3e\x0a\x09\x7b\x7b\x2d\x20\x65\x6e\x64\x20\x7d\x7d\x0a\x0a\x09\x7b\x7b\x69\x66\x20\x2e\x55\x73\x65\x72\x20\x2d\x7d\x7d\x0a\x09\x3c\x6b\x65\x79\x3e\x55\x73\x65\x72\x4e\x61\x6d\x65\x3c\x2f\x6b\x65\x79\x3e\x0a\x09\x3c\x73\x74\x72\x69\x6e\x67\x3e\x7b\x7b\x20\x2e\x55\x73\x65\x72\x20\x7d\x7d\x3c\x2f\x73\x74\x72\x69\x6e\x67\x3e\x0a\x09\x3c\x6b\x65\x79\x3e\x47\x72\x6f\x75\x70\x4e\x61\x6d\x65\x3c\x2f\x6b\x65\x79\x3e\x0a\x09\x3c\x73\x74\x72\x69\x6e\x67\x3e\x7b\x7b\x20\x2e\x47\x72\x6f\x75\x70\x20\x7d\x7d\x3c\x2f\x73\x74\x72\x69\x6e\x67\x3e\x0a\x09\x3c\x6b\x65\x79\x3e\x49\x6e\x69\x74\x47\x72\x6f\x75\x70\x73\x3c\x2f\x6b\x65\x79\x3e\x0a\x09\x3c\x74\x72\x75\x65\x2f\x3e\x0a\x0a\x09\x7b\x7b\x65\x6e\x64\x20\x2d\x7d\x7d\x0a\x09\x3c\x6b\x65\x79\x3e\x52\x75\x6e\x41\x74\x4c\x6f\x61\x64\x3c\x2f\x6b\x65\x79\x3e\x0a\x09\x3c\x74\x72\x75\x65\x2f\x3e\x0a\x09\x7b\x7b\x20\x69\x66\x20\x2e\x52\x65\x73\x74\x61\x72\x74\x20\x2d\x7d\x7d\x0a\x09\x3c\x6b\x65\x79\x3e\x4b\x65\x65\x70\x41\x6c\x69\x76\x65\x3c\x2f\x6b\x65\x79\x3e\x0a\x09\x3c\x74\x72\x75\x65\x2f\x3e\x0a\x09\x3c\x21\x2d\x2d\x64\x69\x63\x74\x3e\x0a\x09\x09\x3c\x6b\x65\x79\x3e\x43\x72\x61\x73\x68\x65\x64\x3c\x2f\x6b\x65\x79\x3e\x0a\x09\x09\x3c\x74\x72\x75\x65\x2f\x3e\x0a\x09\x09\x3c\x6b\x65\x79\x3e\x4e\x65\x74\x77\x6f\x72\x6b\x53\x74\x61\x74\x65\x3c\x2f\x6b\x65\x79\x3e\x0a\x09\x09\x3c\x74\x72\x75\x65\x2f\x3e\x0a\x09\x09\x3c\x6b\x65\x79\x3e\x53\x75\x63\x63\x65\x73\x73\x66\x75\x6c\x45\x78\x69\x74\x3c\x2f\x6b\x65\x79\x3e\x0a\x09\x09\x3c\x66\x61\x6c\x73\x65\x2f\x3e\x0a\x09\x3c\x2f\x64\x69\x63\x74\x2d\x2d\x3e\x0a\x0a\x09\x7b\x7b\x20\x65\x6e\x64\x20\x2d\x7d\x7d\x0a\x09\x7b\x7b\x20\x69\x66\x20\x2e\x50\x72\x6f\x64\x75\x63\x74\x69\x6f\x6e\x20\x2d\x7d\x7d\x0a\x09\x3c\x6b\x65\x79\x3e\x53\x6f\x66\x74\x52\x65\x73\x6f\x75\x72\x63\x65\x4c\x69\x6d\x69\x74\x73\x3c\x2f\x6b\x65\x79\x3e\x0a\x09\x3c\x64\x69\x63\x74\x3e\x0a\x09\x09\x3c\x6b\x65\x79\x3e\x4e\x75\x6d\x62\x65\x72\x4f\x66\x46\x69\x6c\x65\x73\x3c\x2f\x6b\x65\x79\x3e\x0a\x09\x09\x3c\x69\x6e\x74\x65\x67\x65\x72\x3e\x38\x31\x39\x32\x3c\x2f\x69\x6e\x74\x65\x67\x65\x72\x3e\x0a\x09\x3c\x2f\x64\x69\x63\x74\x3e\x0a\x09\x3c\x6b\x65\x79\x3e\x48\x61\x72\x64\x52\x65\x73\x6f\x75\x72\x63\x65\x4c\x69\x6d\x69\x74\x73\x3c\x2f\x6b\x65\x79\x3e\x0a\x09\x3c\x64\x69\x63\x74\x2f\x3e\x0a\x0a\x09\x7b\x7b\x20\x65\x6e\x64\x20\x2d\x7d\x7d\x0a\x09\x7b\x7b\x20\x69\x66\x20\x2e\x57\x6f\x72\x6b\x64\x69\x72\x20\x2d\x7d\x7d\x0a\x09\x3c\x6b\x65\x79\x3e\x57\x6f\x72\x6b\x69\x6e\x67\x44\x69\x72\x65\x63\x74\x6f\x72\x79\x3c\x2f\x6b\x65\x79\x3e\x0a\x09\x3c\x73\x74\x72\x69\x6e\x67\x3e\x7b\x7b\x20\x2e\x57\x6f\x72\x6b\x64\x69\x72\x20\x7d\x7d\x3c\x2f\x73\x74\x72\x69\x6e\x67\x3e\x0a\x0a\x09\x7b\x7b\x20\x65\x6e\x64\x20\x2d\x7d\x7d\x0a\x09\x3c\x6b\x65\x79\x3e\x53\x74\x61\x6e\x64\x61\x72\x64\x45\x72\x72\x6f\x72\x50\x61\x74\x68\x3c\x2f\x6b\x65\x79\x3e\x0a\x09\x3c\x73\x74\x72\x69\x6e\x67\x3e\x7b\x7b\x20\x2e\x4c\x6f\x67\x44\x69\x72\x20\x7d\x7d\x2f\x7b\x7b\x20\x2e\x4e\x61\x6d\x65\x20\x7d\x7d\x2e\x6c\x6f\x67\x3c\x2f\x73\x74\x72\x69\x6e\x67\x3e\x0a\x09\x3c\x6b\x65\x79\x3e\x53\x74\x61\x6e\x64\x61\x72\x64\x4f\x75\x74\x50\x61\x74\x68\x3c\x2f\x6b\x65\x79\x3e\x0a\x09\x3c\x73\x74\x72\x69\x6e\x67\x3e\x7b\x7b\x20\x2e\x4c\x6f\x67\x44\x69\x72\x20\x7d\x7d\x2f\x7b\x7b\x20\x2e\x4e\x61\x6d\x65\x20\x7d\x7d\x2e\x6c\x6f\x67\x3c\x2f\x73\x74\x72\x69\x6e\x67\x3e\x0a\x3c\x2f\x64\x69\x63\x74\x3e\x0a\x3c\x2f\x70\x6c\x69\x73\x74\x3e\x0a") // FileDistEtcSystemdSystemNameServiceTmpl is "dist/etc/systemd/system/_name_.service.tmpl" -var FileDistEtcSystemdSystemNameServiceTmpl = []byte("\x23\x20\x50\x72\x65\x2d\x72\x65\x71\x0a\x23\x20\x73\x75\x64\x6f\x20\x6d\x6b\x64\x69\x72\x20\x2d\x70\x20\x7b\x7b\x20\x2e\x4c\x6f\x63\x61\x6c\x20\x7d\x7d\x2f\x6f\x70\x74\x2f\x7b\x7b\x20\x2e\x4e\x61\x6d\x65\x20\x7d\x7d\x2f\x20\x7b\x7b\x20\x2e\x4c\x6f\x63\x61\x6c\x20\x7d\x7d\x2f\x76\x61\x72\x2f\x6c\x6f\x67\x2f\x7b\x7b\x20\x2e\x4e\x61\x6d\x65\x20\x7d\x7d\x0a\x7b\x7b\x20\x69\x66\x20\x6e\x6f\x74\x20\x2e\x4c\x6f\x63\x61\x6c\x20\x2d\x7d\x7d\x0a\x7b\x7b\x2d\x20\x69\x66\x20\x61\x6e\x64\x20\x2e\x55\x73\x65\x72\x20\x28\x20\x6e\x65\x20\x22\x72\x6f\x6f\x74\x22\x20\x2e\x55\x73\x65\x72\x20\x29\x20\x2d\x7d\x7d\x0a\x23\x20\x73\x75\x64\x6f\x20\x61\x64\x64\x75\x73\x65\x72\x20\x7b\x7b\x20\x2e\x55\x73\x65\x72\x20\x7d\x7d\x20\x2d\x2d\x68\x6f\x6d\x65\x20\x2f\x6f\x70\x74\x2f\x7b\x7b\x20\x2e\x4e\x61\x6d\x65\x20\x7d\x7d\x0a\x23\x20\x73\x75\x64\x6f\x20\x63\x68\x6f\x77\x6e\x20\x2d\x52\x20\x7b\x7b\x20\x2e\x55\x73\x65\x72\x20\x7d\x7d\x3a\x7b\x7b\x20\x2e\x47\x72\x6f\x75\x70\x20\x7d\x7d\x20\x2f\x6f\x70\x74\x2f\x7b\x7b\x20\x2e\x4e\x61\x6d\x65\x20\x7d\x7d\x2f\x20\x2f\x76\x61\x72\x2f\x6c\x6f\x67\x2f\x7b\x7b\x20\x2e\x4e\x61\x6d\x65\x20\x7d\x7d\x0a\x7b\x7b\x2d\x20\x65\x6e\x64\x20\x7d\x7d\x0a\x7b\x7b\x20\x65\x6e\x64\x20\x2d\x7d\x7d\x0a\x23\x20\x50\x6f\x73\x74\x2d\x69\x6e\x73\x74\x61\x6c\x6c\x0a\x23\x20\x73\x75\x64\x6f\x20\x73\x79\x73\x74\x65\x6d\x63\x74\x6c\x20\x7b\x7b\x20\x69\x66\x20\x2e\x4c\x6f\x63\x61\x6c\x20\x2d\x7d\x7d\x20\x2d\x2d\x75\x73\x65\x72\x20\x7b\x7b\x20\x65\x6e\x64\x20\x2d\x7d\x7d\x20\x64\x61\x65\x6d\x6f\x6e\x2d\x72\x65\x6c\x6f\x61\x64\x0a\x23\x20\x73\x75\x64\x6f\x20\x73\x79\x73\x74\x65\x6d\x63\x74\x6c\x20\x7b\x7b\x20\x69\x66\x20\x2e\x4c\x6f\x63\x61\x6c\x20\x2d\x7d\x7d\x20\x2d\x2d\x75\x73\x65\x72\x20\x7b\x7b\x20\x65\x6e\x64\x20\x2d\x7d\x7d\x20\x72\x65\x73\x74\x61\x72\x74\x20\x7b\x7b\x20\x2e\x4e\x61\x6d\x65\x20\x7d\x7d\x2e\x73\x65\x72\x76\x69\x63\x65\x0a\x23\x20\x73\x75\x64\x6f\x20\x6a\x6f\x75\x72\x6e\x61\x6c\x63\x74\x6c\x20\x7b\x7b\x20\x69\x66\x20\x2e\x4c\x6f\x63\x61\x6c\x20\x2d\x7d\x7d\x20\x2d\x2d\x75\x73\x65\x72\x20\x7b\x7b\x20\x65\x6e\x64\x20\x2d\x7d\x7d\x20\x2d\x78\x65\x66\x75\x20\x7b\x7b\x20\x2e\x4e\x61\x6d\x65\x20\x7d\x7d\x0a\x0a\x5b\x55\x6e\x69\x74\x5d\x0a\x44\x65\x73\x63\x72\x69\x70\x74\x69\x6f\x6e\x3d\x7b\x7b\x20\x2e\x54\x69\x74\x6c\x65\x20\x7d\x7d\x20\x2d\x20\x7b\x7b\x20\x2e\x44\x65\x73\x63\x20\x7d\x7d\x0a\x44\x6f\x63\x75\x6d\x65\x6e\x74\x61\x74\x69\x6f\x6e\x3d\x7b\x7b\x20\x2e\x55\x52\x4c\x20\x7d\x7d\x0a\x7b\x7b\x20\x69\x66\x20\x6e\x6f\x74\x20\x2e\x4c\x6f\x63\x61\x6c\x20\x2d\x7d\x7d\x0a\x41\x66\x74\x65\x72\x3d\x6e\x65\x74\x77\x6f\x72\x6b\x2d\x6f\x6e\x6c\x69\x6e\x65\x2e\x74\x61\x72\x67\x65\x74\x0a\x57\x61\x6e\x74\x73\x3d\x6e\x65\x74\x77\x6f\x72\x6b\x2d\x6f\x6e\x6c\x69\x6e\x65\x2e\x74\x61\x72\x67\x65\x74\x20\x73\x79\x73\x74\x65\x6d\x64\x2d\x6e\x65\x74\x77\x6f\x72\x6b\x64\x2d\x77\x61\x69\x74\x2d\x6f\x6e\x6c\x69\x6e\x65\x2e\x73\x65\x72\x76\x69\x63\x65\x0a\x7b\x7b\x2d\x20\x65\x6e\x64\x20\x7d\x7d\x0a\x0a\x5b\x53\x65\x72\x76\x69\x63\x65\x5d\x0a\x23\x20\x52\x65\x73\x74\x61\x72\x74\x20\x6f\x6e\x20\x63\x72\x61\x73\x68\x20\x28\x62\x61\x64\x20\x73\x69\x67\x6e\x61\x6c\x29\x2c\x20\x62\x75\x74\x20\x6e\x6f\x74\x20\x6f\x6e\x20\x27\x63\x6c\x65\x61\x6e\x27\x20\x66\x61\x69\x6c\x75\x72\x65\x20\x28\x65\x72\x72\x6f\x72\x20\x65\x78\x69\x74\x20\x63\x6f\x64\x65\x29\x0a\x23\x20\x41\x6c\x6c\x6f\x77\x20\x75\x70\x20\x74\x6f\x20\x33\x20\x72\x65\x73\x74\x61\x72\x74\x73\x20\x77\x69\x74\x68\x69\x6e\x20\x31\x30\x20\x73\x65\x63\x6f\x6e\x64\x73\x0a\x23\x20\x28\x69\x74\x27\x73\x20\x75\x6e\x6c\x69\x6b\x65\x6c\x79\x20\x74\x68\x61\x74\x20\x61\x20\x75\x73\x65\x72\x20\x6f\x72\x20\x70\x72\x6f\x70\x65\x72\x6c\x79\x2d\x72\x75\x6e\x6e\x69\x6e\x67\x20\x73\x63\x72\x69\x70\x74\x20\x77\x69\x6c\x6c\x20\x64\x6f\x20\x74\x68\x69\x73\x29\x0a\x52\x65\x73\x74\x61\x72\x74\x3d\x6f\x6e\x2d\x61\x62\x6e\x6f\x72\x6d\x61\x6c\x0a\x53\x74\x61\x72\x74\x4c\x69\x6d\x69\x74\x49\x6e\x74\x65\x72\x76\x61\x6c\x3d\x31\x30\x0a\x53\x74\x61\x72\x74\x4c\x69\x6d\x69\x74\x42\x75\x72\x73\x74\x3d\x33\x0a\x0a\x7b\x7b\x20\x69\x66\x20\x2e\x55\x73\x65\x72\x20\x2d\x7d\x7d\x0a\x23\x20\x55\x73\x65\x72\x20\x61\x6e\x64\x20\x67\x72\x6f\x75\x70\x20\x74\x68\x65\x20\x70\x72\x6f\x63\x65\x73\x73\x20\x77\x69\x6c\x6c\x20\x72\x75\x6e\x20\x61\x73\x0a\x55\x73\x65\x72\x3d\x7b\x7b\x20\x2e\x55\x73\x65\x72\x20\x7d\x7d\x0a\x47\x72\x6f\x75\x70\x3d\x7b\x7b\x20\x2e\x47\x72\x6f\x75\x70\x20\x7d\x7d\x0a\x0a\x7b\x7b\x20\x65\x6e\x64\x20\x2d\x7d\x7d\x0a\x57\x6f\x72\x6b\x69\x6e\x67\x44\x69\x72\x65\x63\x74\x6f\x72\x79\x3d\x7b\x7b\x20\x2e\x4c\x6f\x63\x61\x6c\x20\x7d\x7d\x2f\x6f\x70\x74\x2f\x7b\x7b\x20\x2e\x4e\x61\x6d\x65\x20\x7d\x7d\x0a\x45\x78\x65\x63\x53\x74\x61\x72\x74\x3d\x7b\x7b\x69\x66\x20\x2e\x49\x6e\x74\x65\x72\x70\x72\x65\x74\x65\x72\x20\x7d\x7d\x7b\x7b\x20\x2e\x49\x6e\x74\x65\x72\x70\x72\x65\x74\x65\x72\x20\x7d\x7d\x20\x7b\x7b\x20\x65\x6e\x64\x20\x7d\x7d\x7b\x7b\x20\x2e\x4c\x6f\x63\x61\x6c\x20\x7d\x7d\x2f\x6f\x70\x74\x2f\x7b\x7b\x20\x2e\x4e\x61\x6d\x65\x20\x7d\x7d\x2f\x7b\x7b\x20\x2e\x4e\x61\x6d\x65\x20\x7d\x7d\x20\x7b\x7b\x20\x2e\x41\x72\x67\x73\x20\x7d\x7d\x0a\x45\x78\x65\x63\x52\x65\x6c\x6f\x61\x64\x3d\x2f\x62\x69\x6e\x2f\x6b\x69\x6c\x6c\x20\x2d\x55\x53\x52\x31\x20\x24\x4d\x41\x49\x4e\x50\x49\x44\x0a\x0a\x7b\x7b\x69\x66\x20\x2e\x50\x72\x6f\x64\x75\x63\x74\x69\x6f\x6e\x20\x2d\x7d\x7d\x0a\x23\x20\x4c\x69\x6d\x69\x74\x20\x74\x68\x65\x20\x6e\x75\x6d\x62\x65\x72\x20\x6f\x66\x20\x66\x69\x6c\x65\x20\x64\x65\x73\x63\x72\x69\x70\x74\x6f\x72\x73\x20\x61\x6e\x64\x20\x70\x72\x6f\x63\x65\x73\x73\x65\x73\x3b\x20\x73\x65\x65\x20\x60\x6d\x61\x6e\x20\x73\x79\x73\x74\x65\x6d\x64\x2e\x65\x78\x65\x63\x60\x20\x66\x6f\x72\x20\x6d\x6f\x72\x65\x20\x6c\x69\x6d\x69\x74\x20\x73\x65\x74\x74\x69\x6e\x67\x73\x2e\x0a\x23\x20\x54\x68\x65\x73\x65\x20\x61\x72\x65\x20\x72\x65\x61\x73\x6f\x6e\x61\x62\x6c\x65\x20\x64\x65\x66\x61\x75\x6c\x74\x73\x20\x66\x6f\x72\x20\x61\x20\x70\x72\x6f\x64\x75\x63\x74\x69\x6f\x6e\x20\x73\x79\x73\x74\x65\x6d\x2e\x0a\x23\x20\x4e\x6f\x74\x65\x3a\x20\x73\x79\x73\x74\x65\x6d\x64\x20\x22\x75\x73\x65\x72\x20\x75\x6e\x69\x74\x73\x22\x20\x64\x6f\x20\x6e\x6f\x74\x20\x73\x75\x70\x70\x6f\x72\x74\x20\x74\x68\x69\x73\x0a\x4c\x69\x6d\x69\x74\x4e\x4f\x46\x49\x4c\x45\x3d\x31\x30\x34\x38\x35\x37\x36\x0a\x4c\x69\x6d\x69\x74\x4e\x50\x52\x4f\x43\x3d\x36\x34\x0a\x0a\x7b\x7b\x20\x65\x6e\x64\x20\x2d\x7d\x7d\x0a\x7b\x7b\x69\x66\x20\x2e\x4d\x75\x6c\x74\x69\x75\x73\x65\x72\x50\x72\x6f\x74\x65\x63\x74\x69\x6f\x6e\x20\x2d\x7d\x7d\x0a\x23\x20\x55\x73\x65\x20\x70\x72\x69\x76\x61\x74\x65\x20\x2f\x74\x6d\x70\x20\x61\x6e\x64\x20\x2f\x76\x61\x72\x2f\x74\x6d\x70\x2c\x20\x77\x68\x69\x63\x68\x20\x61\x72\x65\x20\x64\x69\x73\x63\x61\x72\x64\x65\x64\x20\x61\x66\x74\x65\x72\x20\x74\x68\x65\x20\x73\x65\x72\x76\x69\x63\x65\x20\x73\x74\x6f\x70\x73\x2e\x0a\x50\x72\x69\x76\x61\x74\x65\x54\x6d\x70\x3d\x74\x72\x75\x65\x0a\x23\x20\x55\x73\x65\x20\x61\x20\x6d\x69\x6e\x69\x6d\x61\x6c\x20\x2f\x64\x65\x76\x0a\x50\x72\x69\x76\x61\x74\x65\x44\x65\x76\x69\x63\x65\x73\x3d\x74\x72\x75\x65\x0a\x23\x20\x48\x69\x64\x65\x20\x2f\x68\x6f\x6d\x65\x2c\x20\x2f\x72\x6f\x6f\x74\x2c\x20\x61\x6e\x64\x20\x2f\x72\x75\x6e\x2f\x75\x73\x65\x72\x2e\x20\x4e\x6f\x62\x6f\x64\x79\x20\x77\x69\x6c\x6c\x20\x73\x74\x65\x61\x6c\x20\x79\x6f\x75\x72\x20\x53\x53\x48\x2d\x6b\x65\x79\x73\x2e\x0a\x50\x72\x6f\x74\x65\x63\x74\x48\x6f\x6d\x65\x3d\x74\x72\x75\x65\x0a\x23\x20\x4d\x61\x6b\x65\x20\x2f\x75\x73\x72\x2c\x20\x2f\x62\x6f\x6f\x74\x2c\x20\x2f\x65\x74\x63\x20\x61\x6e\x64\x20\x70\x6f\x73\x73\x69\x62\x6c\x79\x20\x73\x6f\x6d\x65\x20\x6d\x6f\x72\x65\x20\x66\x6f\x6c\x64\x65\x72\x73\x20\x72\x65\x61\x64\x2d\x6f\x6e\x6c\x79\x2e\x0a\x50\x72\x6f\x74\x65\x63\x74\x53\x79\x73\x74\x65\x6d\x3d\x66\x75\x6c\x6c\x0a\x23\x20\x2e\x2e\x2e\x20\x65\x78\x63\x65\x70\x74\x20\x2f\x6f\x70\x74\x2f\x7b\x7b\x20\x2e\x4e\x61\x6d\x65\x20\x7d\x7d\x20\x62\x65\x63\x61\x75\x73\x65\x20\x77\x65\x20\x77\x61\x6e\x74\x20\x61\x20\x70\x6c\x61\x63\x65\x20\x66\x6f\x72\x20\x74\x68\x65\x20\x64\x61\x74\x61\x62\x61\x73\x65\x0a\x23\x20\x61\x6e\x64\x20\x2f\x76\x61\x72\x2f\x6c\x6f\x67\x2f\x7b\x7b\x20\x2e\x4e\x61\x6d\x65\x20\x7d\x7d\x20\x62\x65\x63\x61\x75\x73\x65\x20\x77\x65\x20\x77\x61\x6e\x74\x20\x61\x20\x70\x6c\x61\x63\x65\x20\x77\x68\x65\x72\x65\x20\x6c\x6f\x67\x73\x20\x63\x61\x6e\x20\x67\x6f\x2e\x0a\x23\x20\x54\x68\x69\x73\x20\x6d\x65\x72\x65\x6c\x79\x20\x72\x65\x74\x61\x69\x6e\x73\x20\x72\x2f\x77\x20\x61\x63\x63\x65\x73\x73\x20\x72\x69\x67\x68\x74\x73\x2c\x20\x69\x74\x20\x64\x6f\x65\x73\x20\x6e\x6f\x74\x20\x61\x64\x64\x20\x61\x6e\x79\x20\x6e\x65\x77\x2e\x0a\x23\x20\x4d\x75\x73\x74\x20\x73\x74\x69\x6c\x6c\x20\x62\x65\x20\x77\x72\x69\x74\x61\x62\x6c\x65\x20\x6f\x6e\x20\x74\x68\x65\x20\x68\x6f\x73\x74\x21\x0a\x52\x65\x61\x64\x57\x72\x69\x74\x65\x44\x69\x72\x65\x63\x74\x6f\x72\x69\x65\x73\x3d\x2f\x6f\x70\x74\x2f\x7b\x7b\x20\x2e\x4e\x61\x6d\x65\x20\x7d\x7d\x20\x2f\x76\x61\x72\x2f\x6c\x6f\x67\x2f\x7b\x7b\x20\x2e\x4e\x61\x6d\x65\x20\x7d\x7d\x0a\x0a\x23\x20\x4e\x6f\x74\x65\x3a\x20\x69\x6e\x20\x76\x32\x33\x31\x20\x61\x6e\x64\x20\x61\x62\x6f\x76\x65\x20\x52\x65\x61\x64\x57\x72\x69\x74\x65\x50\x61\x74\x68\x73\x20\x68\x61\x73\x20\x62\x65\x65\x6e\x20\x72\x65\x6e\x61\x6d\x65\x64\x20\x74\x6f\x20\x52\x65\x61\x64\x57\x72\x69\x74\x65\x44\x69\x72\x65\x63\x74\x6f\x72\x69\x65\x73\x0a\x3b\x20\x52\x65\x61\x64\x57\x72\x69\x74\x65\x50\x61\x74\x68\x73\x3d\x2f\x6f\x70\x74\x2f\x7b\x7b\x20\x2e\x4e\x61\x6d\x65\x20\x7d\x7d\x20\x2f\x76\x61\x72\x2f\x6c\x6f\x67\x2f\x7b\x7b\x20\x2e\x4e\x61\x6d\x65\x20\x7d\x7d\x0a\x0a\x7b\x7b\x20\x65\x6e\x64\x20\x2d\x7d\x7d\x0a\x7b\x7b\x69\x66\x20\x2e\x50\x72\x69\x76\x69\x6c\x65\x67\x65\x64\x50\x6f\x72\x74\x73\x20\x2d\x7d\x7d\x0a\x23\x20\x54\x68\x65\x20\x66\x6f\x6c\x6c\x6f\x77\x69\x6e\x67\x20\x61\x64\x64\x69\x74\x69\x6f\x6e\x61\x6c\x20\x73\x65\x63\x75\x72\x69\x74\x79\x20\x64\x69\x72\x65\x63\x74\x69\x76\x65\x73\x20\x6f\x6e\x6c\x79\x20\x77\x6f\x72\x6b\x20\x77\x69\x74\x68\x20\x73\x79\x73\x74\x65\x6d\x64\x20\x76\x32\x32\x39\x20\x6f\x72\x20\x6c\x61\x74\x65\x72\x2e\x0a\x23\x20\x54\x68\x65\x79\x20\x66\x75\x72\x74\x68\x65\x72\x20\x72\x65\x74\x72\x69\x63\x74\x20\x70\x72\x69\x76\x69\x6c\x65\x67\x65\x73\x20\x74\x68\x61\x74\x20\x63\x61\x6e\x20\x62\x65\x20\x67\x61\x69\x6e\x65\x64\x20\x62\x79\x20\x74\x68\x65\x20\x73\x65\x72\x76\x69\x63\x65\x2e\x0a\x23\x20\x4e\x6f\x74\x65\x20\x74\x68\x61\x74\x20\x79\x6f\x75\x20\x6d\x61\x79\x20\x68\x61\x76\x65\x20\x74\x6f\x20\x61\x64\x64\x20\x63\x61\x70\x61\x62\x69\x6c\x69\x74\x69\x65\x73\x20\x72\x65\x71\x75\x69\x72\x65\x64\x20\x62\x79\x20\x61\x6e\x79\x20\x70\x6c\x75\x67\x69\x6e\x73\x20\x69\x6e\x20\x75\x73\x65\x2e\x0a\x43\x61\x70\x61\x62\x69\x6c\x69\x74\x79\x42\x6f\x75\x6e\x64\x69\x6e\x67\x53\x65\x74\x3d\x43\x41\x50\x5f\x4e\x45\x54\x5f\x42\x49\x4e\x44\x5f\x53\x45\x52\x56\x49\x43\x45\x0a\x41\x6d\x62\x69\x65\x6e\x74\x43\x61\x70\x61\x62\x69\x6c\x69\x74\x69\x65\x73\x3d\x43\x41\x50\x5f\x4e\x45\x54\x5f\x42\x49\x4e\x44\x5f\x53\x45\x52\x56\x49\x43\x45\x0a\x4e\x6f\x4e\x65\x77\x50\x72\x69\x76\x69\x6c\x65\x67\x65\x73\x3d\x74\x72\x75\x65\x0a\x0a\x23\x20\x43\x61\x76\x65\x61\x74\x3a\x20\x53\x6f\x6d\x65\x20\x66\x65\x61\x74\x75\x72\x65\x73\x20\x6d\x61\x79\x20\x6e\x65\x65\x64\x20\x61\x64\x64\x69\x74\x69\x6f\x6e\x61\x6c\x20\x63\x61\x70\x61\x62\x69\x6c\x69\x74\x69\x65\x73\x2e\x0a\x23\x20\x46\x6f\x72\x20\x65\x78\x61\x6d\x70\x6c\x65\x20\x61\x6e\x20\x22\x75\x70\x6c\x6f\x61\x64\x22\x20\x6d\x61\x79\x20\x6e\x65\x65\x64\x20\x43\x41\x50\x5f\x4c\x45\x41\x53\x45\x0a\x3b\x20\x43\x61\x70\x61\x62\x69\x6c\x69\x74\x79\x42\x6f\x75\x6e\x64\x69\x6e\x67\x53\x65\x74\x3d\x43\x41\x50\x5f\x4e\x45\x54\x5f\x42\x49\x4e\x44\x5f\x53\x45\x52\x56\x49\x43\x45\x20\x43\x41\x50\x5f\x4c\x45\x41\x53\x45\x0a\x3b\x20\x41\x6d\x62\x69\x65\x6e\x74\x43\x61\x70\x61\x62\x69\x6c\x69\x74\x69\x65\x73\x3d\x43\x41\x50\x5f\x4e\x45\x54\x5f\x42\x49\x4e\x44\x5f\x53\x45\x52\x56\x49\x43\x45\x20\x43\x41\x50\x5f\x4c\x45\x41\x53\x45\x0a\x3b\x20\x4e\x6f\x4e\x65\x77\x50\x72\x69\x76\x69\x6c\x65\x67\x65\x73\x3d\x74\x72\x75\x65\x0a\x0a\x7b\x7b\x20\x65\x6e\x64\x20\x2d\x7d\x7d\x0a\x5b\x49\x6e\x73\x74\x61\x6c\x6c\x5d\x0a\x7b\x7b\x20\x69\x66\x20\x6e\x6f\x74\x20\x2e\x4c\x6f\x63\x61\x6c\x20\x2d\x7d\x7d\x0a\x57\x61\x6e\x74\x65\x64\x42\x79\x3d\x6d\x75\x6c\x74\x69\x2d\x75\x73\x65\x72\x2e\x74\x61\x72\x67\x65\x74\x0a\x7b\x7b\x2d\x20\x65\x6c\x73\x65\x20\x2d\x7d\x7d\x0a\x57\x61\x6e\x74\x65\x64\x42\x79\x3d\x64\x65\x66\x61\x75\x6c\x74\x2e\x74\x61\x72\x67\x65\x74\x0a\x7b\x7b\x2d\x20\x65\x6e\x64\x20\x7d\x7d\x0a") +var FileDistEtcSystemdSystemNameServiceTmpl = []byte("\x23\x20\x50\x72\x65\x2d\x72\x65\x71\x0a\x23\x20\x73\x75\x64\x6f\x20\x6d\x6b\x64\x69\x72\x20\x2d\x70\x20\x7b\x7b\x20\x2e\x4c\x6f\x63\x61\x6c\x20\x7d\x7d\x2f\x6f\x70\x74\x2f\x7b\x7b\x20\x2e\x4e\x61\x6d\x65\x20\x7d\x7d\x2f\x20\x7b\x7b\x20\x2e\x4c\x6f\x63\x61\x6c\x20\x7d\x7d\x2f\x76\x61\x72\x2f\x6c\x6f\x67\x2f\x7b\x7b\x20\x2e\x4e\x61\x6d\x65\x20\x7d\x7d\x0a\x7b\x7b\x20\x69\x66\x20\x2e\x53\x79\x73\x74\x65\x6d\x20\x2d\x7d\x7d\x0a\x7b\x7b\x2d\x20\x69\x66\x20\x61\x6e\x64\x20\x2e\x55\x73\x65\x72\x20\x28\x20\x6e\x65\x20\x22\x72\x6f\x6f\x74\x22\x20\x2e\x55\x73\x65\x72\x20\x29\x20\x2d\x7d\x7d\x0a\x23\x20\x73\x75\x64\x6f\x20\x61\x64\x64\x75\x73\x65\x72\x20\x7b\x7b\x20\x2e\x55\x73\x65\x72\x20\x7d\x7d\x20\x2d\x2d\x68\x6f\x6d\x65\x20\x2f\x6f\x70\x74\x2f\x7b\x7b\x20\x2e\x4e\x61\x6d\x65\x20\x7d\x7d\x0a\x23\x20\x73\x75\x64\x6f\x20\x63\x68\x6f\x77\x6e\x20\x2d\x52\x20\x7b\x7b\x20\x2e\x55\x73\x65\x72\x20\x7d\x7d\x3a\x7b\x7b\x20\x2e\x47\x72\x6f\x75\x70\x20\x7d\x7d\x20\x2f\x6f\x70\x74\x2f\x7b\x7b\x20\x2e\x4e\x61\x6d\x65\x20\x7d\x7d\x2f\x20\x2f\x76\x61\x72\x2f\x6c\x6f\x67\x2f\x7b\x7b\x20\x2e\x4e\x61\x6d\x65\x20\x7d\x7d\x0a\x7b\x7b\x2d\x20\x65\x6e\x64\x20\x7d\x7d\x0a\x7b\x7b\x20\x65\x6e\x64\x20\x2d\x7d\x7d\x0a\x23\x20\x50\x6f\x73\x74\x2d\x69\x6e\x73\x74\x61\x6c\x6c\x0a\x23\x20\x73\x75\x64\x6f\x20\x73\x79\x73\x74\x65\x6d\x63\x74\x6c\x20\x7b\x7b\x20\x69\x66\x20\x6e\x6f\x74\x20\x2e\x53\x79\x73\x74\x65\x6d\x20\x2d\x7d\x7d\x20\x2d\x2d\x75\x73\x65\x72\x20\x7b\x7b\x20\x65\x6e\x64\x20\x2d\x7d\x7d\x20\x64\x61\x65\x6d\x6f\x6e\x2d\x72\x65\x6c\x6f\x61\x64\x0a\x23\x20\x73\x75\x64\x6f\x20\x73\x79\x73\x74\x65\x6d\x63\x74\x6c\x20\x7b\x7b\x20\x69\x66\x20\x6e\x6f\x74\x20\x2e\x53\x79\x73\x74\x65\x6d\x20\x2d\x7d\x7d\x20\x2d\x2d\x75\x73\x65\x72\x20\x7b\x7b\x20\x65\x6e\x64\x20\x2d\x7d\x7d\x20\x72\x65\x73\x74\x61\x72\x74\x20\x7b\x7b\x20\x2e\x4e\x61\x6d\x65\x20\x7d\x7d\x2e\x73\x65\x72\x76\x69\x63\x65\x0a\x23\x20\x73\x75\x64\x6f\x20\x6a\x6f\x75\x72\x6e\x61\x6c\x63\x74\x6c\x20\x7b\x7b\x20\x69\x66\x20\x6e\x6f\x74\x20\x2e\x53\x79\x73\x74\x65\x6d\x20\x2d\x7d\x7d\x20\x2d\x2d\x75\x73\x65\x72\x20\x7b\x7b\x20\x65\x6e\x64\x20\x2d\x7d\x7d\x20\x2d\x78\x65\x66\x75\x20\x7b\x7b\x20\x2e\x4e\x61\x6d\x65\x20\x7d\x7d\x0a\x0a\x5b\x55\x6e\x69\x74\x5d\x0a\x44\x65\x73\x63\x72\x69\x70\x74\x69\x6f\x6e\x3d\x7b\x7b\x20\x2e\x54\x69\x74\x6c\x65\x20\x7d\x7d\x20\x2d\x20\x7b\x7b\x20\x2e\x44\x65\x73\x63\x20\x7d\x7d\x0a\x44\x6f\x63\x75\x6d\x65\x6e\x74\x61\x74\x69\x6f\x6e\x3d\x7b\x7b\x20\x2e\x55\x52\x4c\x20\x7d\x7d\x0a\x7b\x7b\x20\x69\x66\x20\x2e\x53\x79\x73\x74\x65\x6d\x20\x2d\x7d\x7d\x0a\x41\x66\x74\x65\x72\x3d\x6e\x65\x74\x77\x6f\x72\x6b\x2d\x6f\x6e\x6c\x69\x6e\x65\x2e\x74\x61\x72\x67\x65\x74\x0a\x57\x61\x6e\x74\x73\x3d\x6e\x65\x74\x77\x6f\x72\x6b\x2d\x6f\x6e\x6c\x69\x6e\x65\x2e\x74\x61\x72\x67\x65\x74\x20\x73\x79\x73\x74\x65\x6d\x64\x2d\x6e\x65\x74\x77\x6f\x72\x6b\x64\x2d\x77\x61\x69\x74\x2d\x6f\x6e\x6c\x69\x6e\x65\x2e\x73\x65\x72\x76\x69\x63\x65\x0a\x7b\x7b\x2d\x20\x65\x6e\x64\x20\x7d\x7d\x0a\x0a\x5b\x53\x65\x72\x76\x69\x63\x65\x5d\x0a\x23\x20\x52\x65\x73\x74\x61\x72\x74\x20\x6f\x6e\x20\x63\x72\x61\x73\x68\x20\x28\x62\x61\x64\x20\x73\x69\x67\x6e\x61\x6c\x29\x2c\x20\x62\x75\x74\x20\x6e\x6f\x74\x20\x6f\x6e\x20\x27\x63\x6c\x65\x61\x6e\x27\x20\x66\x61\x69\x6c\x75\x72\x65\x20\x28\x65\x72\x72\x6f\x72\x20\x65\x78\x69\x74\x20\x63\x6f\x64\x65\x29\x0a\x23\x20\x41\x6c\x6c\x6f\x77\x20\x75\x70\x20\x74\x6f\x20\x33\x20\x72\x65\x73\x74\x61\x72\x74\x73\x20\x77\x69\x74\x68\x69\x6e\x20\x31\x30\x20\x73\x65\x63\x6f\x6e\x64\x73\x0a\x23\x20\x28\x69\x74\x27\x73\x20\x75\x6e\x6c\x69\x6b\x65\x6c\x79\x20\x74\x68\x61\x74\x20\x61\x20\x75\x73\x65\x72\x20\x6f\x72\x20\x70\x72\x6f\x70\x65\x72\x6c\x79\x2d\x72\x75\x6e\x6e\x69\x6e\x67\x20\x73\x63\x72\x69\x70\x74\x20\x77\x69\x6c\x6c\x20\x64\x6f\x20\x74\x68\x69\x73\x29\x0a\x52\x65\x73\x74\x61\x72\x74\x3d\x6f\x6e\x2d\x61\x62\x6e\x6f\x72\x6d\x61\x6c\x0a\x53\x74\x61\x72\x74\x4c\x69\x6d\x69\x74\x49\x6e\x74\x65\x72\x76\x61\x6c\x3d\x31\x30\x0a\x53\x74\x61\x72\x74\x4c\x69\x6d\x69\x74\x42\x75\x72\x73\x74\x3d\x33\x0a\x0a\x7b\x7b\x20\x69\x66\x20\x2e\x55\x73\x65\x72\x20\x2d\x7d\x7d\x0a\x23\x20\x55\x73\x65\x72\x20\x61\x6e\x64\x20\x67\x72\x6f\x75\x70\x20\x74\x68\x65\x20\x70\x72\x6f\x63\x65\x73\x73\x20\x77\x69\x6c\x6c\x20\x72\x75\x6e\x20\x61\x73\x0a\x55\x73\x65\x72\x3d\x7b\x7b\x20\x2e\x55\x73\x65\x72\x20\x7d\x7d\x0a\x47\x72\x6f\x75\x70\x3d\x7b\x7b\x20\x2e\x47\x72\x6f\x75\x70\x20\x7d\x7d\x0a\x0a\x7b\x7b\x20\x65\x6e\x64\x20\x2d\x7d\x7d\x0a\x7b\x7b\x20\x69\x66\x20\x2e\x57\x6f\x72\x6b\x64\x69\x72\x20\x2d\x7d\x7d\x0a\x57\x6f\x72\x6b\x69\x6e\x67\x44\x69\x72\x65\x63\x74\x6f\x72\x79\x3d\x7b\x7b\x20\x2e\x57\x6f\x72\x6b\x64\x69\x72\x20\x7d\x7d\x0a\x7b\x7b\x20\x65\x6e\x64\x20\x2d\x7d\x7d\x0a\x45\x78\x65\x63\x53\x74\x61\x72\x74\x3d\x7b\x7b\x69\x66\x20\x2e\x49\x6e\x74\x65\x72\x70\x72\x65\x74\x65\x72\x20\x7d\x7d\x7b\x7b\x20\x2e\x49\x6e\x74\x65\x72\x70\x72\x65\x74\x65\x72\x20\x7d\x7d\x20\x7b\x7b\x20\x65\x6e\x64\x20\x7d\x7d\x7b\x7b\x20\x2e\x45\x78\x65\x63\x20\x7d\x7d\x20\x7b\x7b\x2d\x20\x72\x61\x6e\x67\x65\x20\x24\x61\x72\x67\x20\x3a\x3d\x20\x2e\x41\x72\x67\x76\x20\x7d\x7d\x7b\x7b\x20\x24\x61\x72\x67\x20\x7d\x7d\x20\x7b\x7b\x2d\x20\x65\x6e\x64\x20\x7d\x7d\x0a\x45\x78\x65\x63\x52\x65\x6c\x6f\x61\x64\x3d\x2f\x62\x69\x6e\x2f\x6b\x69\x6c\x6c\x20\x2d\x55\x53\x52\x31\x20\x24\x4d\x41\x49\x4e\x50\x49\x44\x0a\x0a\x7b\x7b\x69\x66\x20\x2e\x50\x72\x6f\x64\x75\x63\x74\x69\x6f\x6e\x20\x2d\x7d\x7d\x0a\x23\x20\x4c\x69\x6d\x69\x74\x20\x74\x68\x65\x20\x6e\x75\x6d\x62\x65\x72\x20\x6f\x66\x20\x66\x69\x6c\x65\x20\x64\x65\x73\x63\x72\x69\x70\x74\x6f\x72\x73\x20\x61\x6e\x64\x20\x70\x72\x6f\x63\x65\x73\x73\x65\x73\x3b\x20\x73\x65\x65\x20\x60\x6d\x61\x6e\x20\x73\x79\x73\x74\x65\x6d\x64\x2e\x65\x78\x65\x63\x60\x20\x66\x6f\x72\x20\x6d\x6f\x72\x65\x20\x6c\x69\x6d\x69\x74\x20\x73\x65\x74\x74\x69\x6e\x67\x73\x2e\x0a\x23\x20\x54\x68\x65\x73\x65\x20\x61\x72\x65\x20\x72\x65\x61\x73\x6f\x6e\x61\x62\x6c\x65\x20\x64\x65\x66\x61\x75\x6c\x74\x73\x20\x66\x6f\x72\x20\x61\x20\x70\x72\x6f\x64\x75\x63\x74\x69\x6f\x6e\x20\x73\x79\x73\x74\x65\x6d\x2e\x0a\x23\x20\x4e\x6f\x74\x65\x3a\x20\x73\x79\x73\x74\x65\x6d\x64\x20\x22\x75\x73\x65\x72\x20\x75\x6e\x69\x74\x73\x22\x20\x64\x6f\x20\x6e\x6f\x74\x20\x73\x75\x70\x70\x6f\x72\x74\x20\x74\x68\x69\x73\x0a\x4c\x69\x6d\x69\x74\x4e\x4f\x46\x49\x4c\x45\x3d\x31\x30\x34\x38\x35\x37\x36\x0a\x4c\x69\x6d\x69\x74\x4e\x50\x52\x4f\x43\x3d\x36\x34\x0a\x0a\x7b\x7b\x20\x65\x6e\x64\x20\x2d\x7d\x7d\x0a\x7b\x7b\x69\x66\x20\x2e\x4d\x75\x6c\x74\x69\x75\x73\x65\x72\x50\x72\x6f\x74\x65\x63\x74\x69\x6f\x6e\x20\x2d\x7d\x7d\x0a\x23\x20\x55\x73\x65\x20\x70\x72\x69\x76\x61\x74\x65\x20\x2f\x74\x6d\x70\x20\x61\x6e\x64\x20\x2f\x76\x61\x72\x2f\x74\x6d\x70\x2c\x20\x77\x68\x69\x63\x68\x20\x61\x72\x65\x20\x64\x69\x73\x63\x61\x72\x64\x65\x64\x20\x61\x66\x74\x65\x72\x20\x74\x68\x65\x20\x73\x65\x72\x76\x69\x63\x65\x20\x73\x74\x6f\x70\x73\x2e\x0a\x50\x72\x69\x76\x61\x74\x65\x54\x6d\x70\x3d\x74\x72\x75\x65\x0a\x23\x20\x55\x73\x65\x20\x61\x20\x6d\x69\x6e\x69\x6d\x61\x6c\x20\x2f\x64\x65\x76\x0a\x50\x72\x69\x76\x61\x74\x65\x44\x65\x76\x69\x63\x65\x73\x3d\x74\x72\x75\x65\x0a\x23\x20\x48\x69\x64\x65\x20\x2f\x68\x6f\x6d\x65\x2c\x20\x2f\x72\x6f\x6f\x74\x2c\x20\x61\x6e\x64\x20\x2f\x72\x75\x6e\x2f\x75\x73\x65\x72\x2e\x20\x4e\x6f\x62\x6f\x64\x79\x20\x77\x69\x6c\x6c\x20\x73\x74\x65\x61\x6c\x20\x79\x6f\x75\x72\x20\x53\x53\x48\x2d\x6b\x65\x79\x73\x2e\x0a\x50\x72\x6f\x74\x65\x63\x74\x48\x6f\x6d\x65\x3d\x74\x72\x75\x65\x0a\x23\x20\x4d\x61\x6b\x65\x20\x2f\x75\x73\x72\x2c\x20\x2f\x62\x6f\x6f\x74\x2c\x20\x2f\x65\x74\x63\x20\x61\x6e\x64\x20\x70\x6f\x73\x73\x69\x62\x6c\x79\x20\x73\x6f\x6d\x65\x20\x6d\x6f\x72\x65\x20\x66\x6f\x6c\x64\x65\x72\x73\x20\x72\x65\x61\x64\x2d\x6f\x6e\x6c\x79\x2e\x0a\x50\x72\x6f\x74\x65\x63\x74\x53\x79\x73\x74\x65\x6d\x3d\x66\x75\x6c\x6c\x0a\x23\x20\x2e\x2e\x2e\x20\x65\x78\x63\x65\x70\x74\x20\x2f\x6f\x70\x74\x2f\x7b\x7b\x20\x2e\x4e\x61\x6d\x65\x20\x7d\x7d\x20\x62\x65\x63\x61\x75\x73\x65\x20\x77\x65\x20\x77\x61\x6e\x74\x20\x61\x20\x70\x6c\x61\x63\x65\x20\x66\x6f\x72\x20\x74\x68\x65\x20\x64\x61\x74\x61\x62\x61\x73\x65\x0a\x23\x20\x61\x6e\x64\x20\x2f\x76\x61\x72\x2f\x6c\x6f\x67\x2f\x7b\x7b\x20\x2e\x4e\x61\x6d\x65\x20\x7d\x7d\x20\x62\x65\x63\x61\x75\x73\x65\x20\x77\x65\x20\x77\x61\x6e\x74\x20\x61\x20\x70\x6c\x61\x63\x65\x20\x77\x68\x65\x72\x65\x20\x6c\x6f\x67\x73\x20\x63\x61\x6e\x20\x67\x6f\x2e\x0a\x23\x20\x54\x68\x69\x73\x20\x6d\x65\x72\x65\x6c\x79\x20\x72\x65\x74\x61\x69\x6e\x73\x20\x72\x2f\x77\x20\x61\x63\x63\x65\x73\x73\x20\x72\x69\x67\x68\x74\x73\x2c\x20\x69\x74\x20\x64\x6f\x65\x73\x20\x6e\x6f\x74\x20\x61\x64\x64\x20\x61\x6e\x79\x20\x6e\x65\x77\x2e\x0a\x23\x20\x4d\x75\x73\x74\x20\x73\x74\x69\x6c\x6c\x20\x62\x65\x20\x77\x72\x69\x74\x61\x62\x6c\x65\x20\x6f\x6e\x20\x74\x68\x65\x20\x68\x6f\x73\x74\x21\x0a\x52\x65\x61\x64\x57\x72\x69\x74\x65\x44\x69\x72\x65\x63\x74\x6f\x72\x69\x65\x73\x3d\x2f\x6f\x70\x74\x2f\x7b\x7b\x20\x2e\x4e\x61\x6d\x65\x20\x7d\x7d\x20\x2f\x76\x61\x72\x2f\x6c\x6f\x67\x2f\x7b\x7b\x20\x2e\x4e\x61\x6d\x65\x20\x7d\x7d\x0a\x0a\x23\x20\x4e\x6f\x74\x65\x3a\x20\x69\x6e\x20\x76\x32\x33\x31\x20\x61\x6e\x64\x20\x61\x62\x6f\x76\x65\x20\x52\x65\x61\x64\x57\x72\x69\x74\x65\x50\x61\x74\x68\x73\x20\x68\x61\x73\x20\x62\x65\x65\x6e\x20\x72\x65\x6e\x61\x6d\x65\x64\x20\x74\x6f\x20\x52\x65\x61\x64\x57\x72\x69\x74\x65\x44\x69\x72\x65\x63\x74\x6f\x72\x69\x65\x73\x0a\x3b\x20\x52\x65\x61\x64\x57\x72\x69\x74\x65\x50\x61\x74\x68\x73\x3d\x2f\x6f\x70\x74\x2f\x7b\x7b\x20\x2e\x4e\x61\x6d\x65\x20\x7d\x7d\x20\x2f\x76\x61\x72\x2f\x6c\x6f\x67\x2f\x7b\x7b\x20\x2e\x4e\x61\x6d\x65\x20\x7d\x7d\x0a\x0a\x7b\x7b\x20\x65\x6e\x64\x20\x2d\x7d\x7d\x0a\x7b\x7b\x69\x66\x20\x2e\x50\x72\x69\x76\x69\x6c\x65\x67\x65\x64\x50\x6f\x72\x74\x73\x20\x2d\x7d\x7d\x0a\x23\x20\x54\x68\x65\x20\x66\x6f\x6c\x6c\x6f\x77\x69\x6e\x67\x20\x61\x64\x64\x69\x74\x69\x6f\x6e\x61\x6c\x20\x73\x65\x63\x75\x72\x69\x74\x79\x20\x64\x69\x72\x65\x63\x74\x69\x76\x65\x73\x20\x6f\x6e\x6c\x79\x20\x77\x6f\x72\x6b\x20\x77\x69\x74\x68\x20\x73\x79\x73\x74\x65\x6d\x64\x20\x76\x32\x32\x39\x20\x6f\x72\x20\x6c\x61\x74\x65\x72\x2e\x0a\x23\x20\x54\x68\x65\x79\x20\x66\x75\x72\x74\x68\x65\x72\x20\x72\x65\x74\x72\x69\x63\x74\x20\x70\x72\x69\x76\x69\x6c\x65\x67\x65\x73\x20\x74\x68\x61\x74\x20\x63\x61\x6e\x20\x62\x65\x20\x67\x61\x69\x6e\x65\x64\x20\x62\x79\x20\x74\x68\x65\x20\x73\x65\x72\x76\x69\x63\x65\x2e\x0a\x23\x20\x4e\x6f\x74\x65\x20\x74\x68\x61\x74\x20\x79\x6f\x75\x20\x6d\x61\x79\x20\x68\x61\x76\x65\x20\x74\x6f\x20\x61\x64\x64\x20\x63\x61\x70\x61\x62\x69\x6c\x69\x74\x69\x65\x73\x20\x72\x65\x71\x75\x69\x72\x65\x64\x20\x62\x79\x20\x61\x6e\x79\x20\x70\x6c\x75\x67\x69\x6e\x73\x20\x69\x6e\x20\x75\x73\x65\x2e\x0a\x43\x61\x70\x61\x62\x69\x6c\x69\x74\x79\x42\x6f\x75\x6e\x64\x69\x6e\x67\x53\x65\x74\x3d\x43\x41\x50\x5f\x4e\x45\x54\x5f\x42\x49\x4e\x44\x5f\x53\x45\x52\x56\x49\x43\x45\x0a\x41\x6d\x62\x69\x65\x6e\x74\x43\x61\x70\x61\x62\x69\x6c\x69\x74\x69\x65\x73\x3d\x43\x41\x50\x5f\x4e\x45\x54\x5f\x42\x49\x4e\x44\x5f\x53\x45\x52\x56\x49\x43\x45\x0a\x4e\x6f\x4e\x65\x77\x50\x72\x69\x76\x69\x6c\x65\x67\x65\x73\x3d\x74\x72\x75\x65\x0a\x0a\x23\x20\x43\x61\x76\x65\x61\x74\x3a\x20\x53\x6f\x6d\x65\x20\x66\x65\x61\x74\x75\x72\x65\x73\x20\x6d\x61\x79\x20\x6e\x65\x65\x64\x20\x61\x64\x64\x69\x74\x69\x6f\x6e\x61\x6c\x20\x63\x61\x70\x61\x62\x69\x6c\x69\x74\x69\x65\x73\x2e\x0a\x23\x20\x46\x6f\x72\x20\x65\x78\x61\x6d\x70\x6c\x65\x20\x61\x6e\x20\x22\x75\x70\x6c\x6f\x61\x64\x22\x20\x6d\x61\x79\x20\x6e\x65\x65\x64\x20\x43\x41\x50\x5f\x4c\x45\x41\x53\x45\x0a\x3b\x20\x43\x61\x70\x61\x62\x69\x6c\x69\x74\x79\x42\x6f\x75\x6e\x64\x69\x6e\x67\x53\x65\x74\x3d\x43\x41\x50\x5f\x4e\x45\x54\x5f\x42\x49\x4e\x44\x5f\x53\x45\x52\x56\x49\x43\x45\x20\x43\x41\x50\x5f\x4c\x45\x41\x53\x45\x0a\x3b\x20\x41\x6d\x62\x69\x65\x6e\x74\x43\x61\x70\x61\x62\x69\x6c\x69\x74\x69\x65\x73\x3d\x43\x41\x50\x5f\x4e\x45\x54\x5f\x42\x49\x4e\x44\x5f\x53\x45\x52\x56\x49\x43\x45\x20\x43\x41\x50\x5f\x4c\x45\x41\x53\x45\x0a\x3b\x20\x4e\x6f\x4e\x65\x77\x50\x72\x69\x76\x69\x6c\x65\x67\x65\x73\x3d\x74\x72\x75\x65\x0a\x0a\x7b\x7b\x20\x65\x6e\x64\x20\x2d\x7d\x7d\x0a\x5b\x49\x6e\x73\x74\x61\x6c\x6c\x5d\x0a\x7b\x7b\x20\x69\x66\x20\x2e\x53\x79\x73\x74\x65\x6d\x20\x2d\x7d\x7d\x0a\x57\x61\x6e\x74\x65\x64\x42\x79\x3d\x6d\x75\x6c\x74\x69\x2d\x75\x73\x65\x72\x2e\x74\x61\x72\x67\x65\x74\x0a\x7b\x7b\x2d\x20\x65\x6c\x73\x65\x20\x2d\x7d\x7d\x0a\x57\x61\x6e\x74\x65\x64\x42\x79\x3d\x64\x65\x66\x61\x75\x6c\x74\x2e\x74\x61\x72\x67\x65\x74\x0a\x7b\x7b\x2d\x20\x65\x6e\x64\x20\x7d\x7d\x0a") func init() { err := CTX.Err() diff --git a/serviceman.go b/serviceman.go index 7634c00..645f5ec 100644 --- a/serviceman.go +++ b/serviceman.go @@ -34,17 +34,19 @@ func main() { } } conf.Argv = args - conf.Args = strings.Join(conf.Argv, " ") + force := false forUser := false forSystem := false flag.StringVar(&conf.Title, "title", "", "a human-friendly name for the service") flag.StringVar(&conf.Desc, "desc", "", "a human-friendly description of the service (ex: Foo App)") flag.StringVar(&conf.Name, "name", "", "a computer-friendly name for the service (ex: foo-app)") flag.StringVar(&conf.URL, "url", "", "the documentation on home page of the service") + //flag.StringVar(&conf.Workdir, "workdir", "", "the directory in which the service should be started") flag.StringVar(&conf.ReverseDNS, "rdns", "", "a plist-friendly Reverse DNS name for launchctl (ex: com.example.foo-app)") flag.BoolVar(&forSystem, "system", false, "attempt to install system service as an unprivileged/unelevated user") flag.BoolVar(&forUser, "user", false, "install user space / user mode service even when admin/root/sudo/elevated") + flag.BoolVar(&force, "force", false, "if the interpreter or executable doesn't exist, or things don't make sense, try anyway") flag.StringVar(&conf.User, "username", "", "run the service as this user") flag.StringVar(&conf.Group, "groupname", "", "run the service as this group") flag.BoolVar(&conf.PrivilegedPorts, "cap-net-bind", false, "this service should have access to privileged ports") @@ -54,6 +56,7 @@ func main() { if forUser && forSystem { fmt.Println("Pfff! You can't --user AND --system! What are you trying to pull?") os.Exit(1) + return } if forUser { conf.System = false @@ -66,15 +69,20 @@ func main() { n := len(args) if 0 == n { fmt.Println("Usage: serviceman install ./foo-app -- --foo-arg") - os.Exit(1) + os.Exit(2) + return } execpath, err := installer.WhereIs(args[0]) if nil != err { - fmt.Fprintf(os.Stderr, "Error: '%s' could not be found.", args[0]) - os.Exit(1) + fmt.Fprintf(os.Stderr, "Error: '%s' could not be found.\n", args[0]) + if !force { + os.Exit(3) + return + } + } else { + args[0] = execpath } - args[0] = execpath conf.Exec = args[0] args = args[1:] @@ -93,7 +101,54 @@ func main() { conf.Title = conf.Name } if "" == conf.ReverseDNS { - conf.ReverseDNS = "com.example." + conf.Name + // technically should be something more like "com.example." + conf.Name, + // but whatever + conf.ReverseDNS = conf.Name + } + + if !conf.System { + home, err := os.UserHomeDir() + if nil != err { + fmt.Fprintf(os.Stderr, "Unrecoverable Error: %s", err) + os.Exit(4) + return + } + conf.Local = filepath.Join(home, ".local") + conf.LogDir = filepath.Join(home, ".local", "share", conf.Name, "var", "log") + } else { + conf.LogDir = "/var/log/" + conf.Name + } + + // Check to see if Exec exists + // /whatever => must exist exactly + // ./whatever => must exist in current or WorkDir(TODO) + // whatever => may also exist in {{ .Local }}/opt/{{ .Name }}/{{ .Exec }} + _, err = os.Stat(conf.Exec) + if nil != err { + bad := true + if !strings.Contains(filepath.ToSlash(conf.Exec), "/") { + optpath := filepath.Join(conf.Local, "/opt", conf.Name, conf.Exec) + _, err := os.Stat(optpath) + if nil == err { + bad = false + fmt.Fprintf(os.Stderr, "Using '%s' for '%s'\n", optpath, conf.Exec) + conf.Exec = optpath + } + } + + if bad { + // TODO look for it in WorkDir? + fmt.Fprintf(os.Stderr, "Error: '%s' could not be found.\n", conf.Exec) + if !force { + os.Exit(5) + return + } + execpath, err := filepath.Abs(conf.Exec) + if nil == err { + conf.Exec = execpath + } + fmt.Fprintf(os.Stderr, "Using '%s' anyway.\n", conf.Exec) + } } fmt.Printf("\n%#v\n\n", conf)