Esempio n. 1
0
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")
}
Esempio n. 2
0
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)
		}
	}
}
Esempio n. 3
0
func (p pacman) Install(name ...string) error {
	args := []string{"-S", "--needed", "--noprogressbar"}

	return osutil.Exec("/usr/bin/pacman", append(args, name...)...)
}
Esempio n. 4
0
File: rpm.go Progetto: kless/osutil
func (p rpm) Clean() error {
	return osutil.Exec("/usr/bin/yum", "clean", "packages")
}
Esempio n. 5
0
File: rpm.go Progetto: kless/osutil
func (p rpm) Upgrade() error {
	return osutil.Exec("/usr/bin/yum", "update")
}
Esempio n. 6
0
File: rpm.go Progetto: kless/osutil
func (p rpm) Remove(name ...string) error {
	args := []string{"remove"}

	return osutil.Exec("/usr/bin/yum", append(args, name...)...)
}
Esempio n. 7
0
File: rpm.go Progetto: kless/osutil
func (p rpm) Install(name ...string) error {
	args := []string{"install"}

	return osutil.Exec("/usr/bin/yum", append(args, name...)...)
}
Esempio n. 8
0
func (p ebuild) Remove(name ...string) error {
	args := []string{"--unmerge"}

	return osutil.Exec("/usr/bin/emerge", append(args, name...)...)
}
Esempio n. 9
0
func (p pacman) Upgrade() error {
	return osutil.Exec("/usr/bin/pacman", "-Syu")
}
Esempio n. 10
0
File: zypp.go Progetto: kless/osutil
func (p zypp) Upgrade() error {
	return osutil.Exec("/usr/bin/zypper", "up", "--auto-agree-with-licenses")
}
Esempio n. 11
0
File: zypp.go Progetto: kless/osutil
func (p zypp) Update() error {
	return osutil.Exec("/usr/bin/zypper", "refresh")
}
Esempio n. 12
0
File: zypp.go Progetto: kless/osutil
func (p zypp) Install(name ...string) error {
	args := []string{"install", "--auto-agree-with-licenses"}

	return osutil.Exec("/usr/bin/zypper", append(args, name...)...)
}
Esempio n. 13
0
func (p ebuild) Upgrade() error {
	return osutil.Exec("/usr/bin/emerge", "--update", "--deep", "--with-bdeps=y", "--newuse @world")
}
Esempio n. 14
0
func (p ebuild) Update() error {
	return osutil.Exec("/usr/bin/emerge", "--sync")
}
Esempio n. 15
0
func (p pacman) Purge(name ...string) error {
	args := []string{"-Rsn"}

	return osutil.Exec("/usr/bin/pacman", append(args, name...)...)
}
Esempio n. 16
0
func (p pacman) Update() error {
	return osutil.Exec("/usr/bin/pacman", "-Syu", "--needed", "--noprogressbar")
}
Esempio n. 17
0
File: zypp.go Progetto: kless/osutil
func (p zypp) Clean() error {
	return osutil.Exec("/usr/bin/zypper", "clean")
}
Esempio n. 18
0
func (p pacman) Clean() error {
	return osutil.Exec("/usr/bin/paccache", "-r")
}
Esempio n. 19
0
func (p ebuild) Install(name ...string) error {
	return osutil.Exec("/usr/bin/emerge", name...)
}