1// Copyright 2012 Jonas mg 2// 3// This Source Code Form is subject to the terms of the Mozilla Public 4// License, v. 2.0. If a copy of the MPL was not distributed with this 5// file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 7package pkgutil 8 9import "github.com/kless/osutil" 10 11type deb struct{} 12 13func (p deb) Install(name ...string) error { 14 args := []string{"install", "-y"} 15 16 return osutil.ExecSudo("/usr/bin/apt-get", append(args, name...)...) 17} 18 19func (p deb) Remove(name ...string) error { 20 args := []string{"remove", "-y"} 21 22 return osutil.ExecSudo("/usr/bin/apt-get", append(args, name...)...) 23} 24 25func (p deb) Purge(name ...string) error { 26 args := []string{"purge", "-y"} 27 28 return osutil.ExecSudo("/usr/bin/apt-get", append(args, name...)...) 29} 30 31func (p deb) Update() error { 32 return osutil.ExecSudo("/usr/bin/apt-get", "update", "-qq") 33} 34 35func (p deb) Upgrade() error { 36 return osutil.ExecSudo("/usr/bin/apt-get", "upgrade") 37} 38 39func (p deb) Clean() error { 40 err := osutil.ExecSudo("/usr/bin/apt-get", "autoremove", "-y") 41 if err != nil { 42 return err 43 } 44 45 return osutil.ExecSudo("/usr/bin/apt-get", "clean") 46} 47