コード例 #1
0
// Apply tries to install the package with APT for Debian or its derivatives. If
// the installation fails, it returns an error.
func (s *InstalledForDebian) Apply() error {
	if s.Update {
		if err := update.do(); err != nil {
			return err
		}
	}
	return apt.Install(s.Name, s.Version)
}
コード例 #2
0
func TestAPTWithVersion(t *testing.T) {
	if err := apt.Install(TargetPackage, "5.0.3"); err != nil {
		t.Errorf("Install: %v", err)
	}
	if err := apt.IsInstalled(TargetPackage, ""); err != nil {
		t.Errorf("IsInstalled: %v", err)
	}
	if err := apt.Remove(TargetPackage); err != nil {
		t.Errorf("Remove: %v", err)
	}
	if err := apt.IsNotInstalled(TargetPackage); err != nil {
		t.Errorf("IsNotInstalled: %v", err)
	}
}