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 }
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 }
func runCrouton(args []string) string { output, _ := common.RunCmd("sh", append([]string{"/home/chronos/user/Downloads/crouton"}, args...)...) return output }
func runCommand(path string, args []string) string { output, _ := common.RunCmd(path, args...) return output }