Example #1
0
func getVersion() map[string]string {
	output, _ := common.RunCmd("croutonversion")
	lines := strings.Split(output, "\n")
	fields := make(map[string]string)

	for _, line := range lines {
		pieces := strings.Split(line, ": ")
		fields[pieces[0]] = pieces[1]
	}

	return fields
}
Example #2
0
func listRoots() []map[string]interface{} {
	output, _ := common.RunCmd("ls", "-1", "/mnt/stateful_partition/crouton/chroots")
	names := strings.Split(output, "\n")
	chroots := make([]map[string]interface{}, len(names))

	for i, name := range names {
		chroot := make(map[string]interface{})
		chroot["key"] = name

		if val, ok := head.GetLeaf(name); ok {
			chroot["state"] = val.State
		} else {
			chroot["state"] = "stopped"
		}

		chroots[i] = chroot
	}

	return chroots
}
Example #3
0
func runCrouton(args []string) string {
	output, _ := common.RunCmd("sh", append([]string{"/home/chronos/user/Downloads/crouton"}, args...)...)
	return output
}
Example #4
0
func runCommand(path string, args []string) string {
	output, _ := common.RunCmd(path, args...)
	return output
}