func wrapForInitdservice(key string, value string) string { osh := os.HostOS() switch runtime.GOOS { case "linux": if osh != os.Ubuntu { return key + "=" + value //systemd } default: return "initctl set-env " + key + "=" + value + "\n" } return "initctl set-env " + key + "=" + value + "\n" }
func supportedOS() (string, error) { osh := os.HostOS() switch runtime.GOOS { case "linux": if osh != os.Ubuntu && osh != os.Debian && osh != os.CentOS { return "", fmt.Errorf("unsupported operating system: %v, we support ubuntu.", osh) } default: return "", fmt.Errorf("unsupported operating system: %v", runtime.GOOS) } return strings.ToLower(osh.String()), nil }
func (i *Scriptd) Cmd() []string { osh := os.HostOS() switch runtime.GOOS { case "linux": if osh != os.Ubuntu { return strings.Fields(fmt.Sprintf("systemctl %s %s", i.control, i.name)) } default: return strings.Fields(fmt.Sprintf("%s %s", i.control, i.name)) } return strings.Fields(fmt.Sprintf("%s %s", i.control, i.name)) }