示例#1
0
文件: debian.go 项目: pacur/pacur
func (d *Debian) createScripts() (err error) {
	scripts := map[string][]string{
		"preinst":  d.Pack.PreInst,
		"postinst": d.Pack.PostInst,
		"prerm":    d.Pack.PreRm,
		"postrm":   d.Pack.PostRm,
	}

	for name, script := range scripts {
		if len(script) == 0 {
			continue
		}

		data := strings.Join(script, "\n")
		if name == "prerm" || name == "postrm" {
			data = removeHeader + data
		}

		path := filepath.Join(d.debDir, name)

		err = utils.CreateWrite(path, data)
		if err != nil {
			return
		}

		err = utils.Chmod(path, 0755)
		if err != nil {
			return
		}
	}

	return
}
示例#2
0
文件: pacman.go 项目: pacur/pacur
func (p *Pacman) pacmanBuild() (err error) {
	err = utils.Chmod(p.pacmanDir, 0777)
	if err != nil {
		return
	}

	err = utils.Exec(p.pacmanDir, "sudo", "-u", "nobody", "makepkg")
	if err != nil {
		return
	}

	return
}