Пример #1
0
func runBuild(args []string) {
	if len(args) == 0 {
		utils.ExitMsg(usage)
	}
	directory := args[0]
	fi, err := os.Stat(directory)
	if os.IsNotExist(err) {
		utils.ExitError(err)
	}
	if os.IsNotExist(err) {
		utils.ExitError(err)
	}
	if !fi.IsDir() {
		utils.ExitMsg(directory + " is not a directory")
	}
	manifest := "."
	manifest = filepath.Join(manifest, "manifest.json")
	if !utils.Exists(filepath.Join(directory, manifest)) {
		utils.ExitMsg("directory " + directory + " does not contain manifest file " + manifest)
	}
	path, err := build(directory, manifest)
	if err != nil {
		utils.ExitError(err)
	}
	fmt.Printf("Successfully built package in '%s'.\n", path)
}
Пример #2
0
func runContents(args []string) {
	if len(args) == 0 {
		utils.ExitMsg("error: need file")
	}

	clickfile := args[0]
	if !utils.Exists(clickfile) {
		utils.ExitMsg(clickfile + " does not exist")
	}
	cmd := exec.Command("dpkg-deb", "-c", clickfile)
	out, err := cmd.Output()
	if err != nil {
		utils.ExitError(err)
	}
	fmt.Printf("%s", out)
}