Exemple #1
0
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
}
Exemple #2
0
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
}