Пример #1
0
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"
}
Пример #2
0
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
}
Пример #3
0
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))
}