func (p ebuild) Clean() error { err := osutil.Exec("/usr/bin/emerge", "--update", "--deep", "--newuse @world") if err != nil { return err } return osutil.Exec("/usr/bin/emerge", "--depclean") }
func TestCommand(t *testing.T) { CMD_MAIN := "starter" CMD_TEST := "tester" // Build the command and executable test err := exec.Command("go", "build", "./"+filepath.Join("cmd", CMD_MAIN)).Run() if err != nil { t.Fatal(err) } err = exec.Command("go", "build", "-o", CMD_TEST, "./testdata").Run() if err != nil { t.Fatal(err) } CMD_MAIN = "./" + CMD_MAIN go func() { err = osutil.Exec(CMD_MAIN, "./"+CMD_TEST) }() if err != nil { t.Fatal(err) } time.Sleep(3 * time.Second) if err = osutil.Exec(CMD_MAIN, "-status", CMD_TEST); err != nil { t.Error(err) } time.Sleep(3 * time.Second) fmt.Println() if err = osutil.Exec(CMD_MAIN, "-restart", CMD_TEST); err != nil { t.Error(err) } time.Sleep(7 * time.Second) fmt.Println() if err = osutil.Exec(CMD_MAIN, "-stop", CMD_TEST); err != nil { t.Error(err) } time.Sleep(3 * time.Second) fmt.Println() if err = osutil.Exec(CMD_MAIN, "-status", CMD_TEST); err != nil { t.Error(err) } time.Sleep(2 * time.Second) // Remove the commands for _, v := range []string{CMD_MAIN, CMD_TEST} { if err = os.Remove(v); err != nil { t.Log(err) } } }
func (p pacman) Install(name ...string) error { args := []string{"-S", "--needed", "--noprogressbar"} return osutil.Exec("/usr/bin/pacman", append(args, name...)...) }
func (p rpm) Clean() error { return osutil.Exec("/usr/bin/yum", "clean", "packages") }
func (p rpm) Upgrade() error { return osutil.Exec("/usr/bin/yum", "update") }
func (p rpm) Remove(name ...string) error { args := []string{"remove"} return osutil.Exec("/usr/bin/yum", append(args, name...)...) }
func (p rpm) Install(name ...string) error { args := []string{"install"} return osutil.Exec("/usr/bin/yum", append(args, name...)...) }
func (p ebuild) Remove(name ...string) error { args := []string{"--unmerge"} return osutil.Exec("/usr/bin/emerge", append(args, name...)...) }
func (p pacman) Upgrade() error { return osutil.Exec("/usr/bin/pacman", "-Syu") }
func (p zypp) Upgrade() error { return osutil.Exec("/usr/bin/zypper", "up", "--auto-agree-with-licenses") }
func (p zypp) Update() error { return osutil.Exec("/usr/bin/zypper", "refresh") }
func (p zypp) Install(name ...string) error { args := []string{"install", "--auto-agree-with-licenses"} return osutil.Exec("/usr/bin/zypper", append(args, name...)...) }
func (p ebuild) Upgrade() error { return osutil.Exec("/usr/bin/emerge", "--update", "--deep", "--with-bdeps=y", "--newuse @world") }
func (p ebuild) Update() error { return osutil.Exec("/usr/bin/emerge", "--sync") }
func (p pacman) Purge(name ...string) error { args := []string{"-Rsn"} return osutil.Exec("/usr/bin/pacman", append(args, name...)...) }
func (p pacman) Update() error { return osutil.Exec("/usr/bin/pacman", "-Syu", "--needed", "--noprogressbar") }
func (p zypp) Clean() error { return osutil.Exec("/usr/bin/zypper", "clean") }
func (p pacman) Clean() error { return osutil.Exec("/usr/bin/paccache", "-r") }
func (p ebuild) Install(name ...string) error { return osutil.Exec("/usr/bin/emerge", name...) }