Skip to content

Instantly share code, notes, and snippets.

@jfinstrom
Created November 24, 2012 17:35
Show Gist options
  • Save jfinstrom/4140631 to your computer and use it in GitHub Desktop.
Save jfinstrom/4140631 to your computer and use it in GitHub Desktop.
Yum install class.
class pack_install:
import yum
packages = []
def addPackage(self,p):
self.packages.append(p)
def runInstall(self):
sys.path.append('/usr/share/yum-cli')
import cli
y = cli.YumBaseCli()
y.doConfigSetup()
y.doTsSetup()
y.doRpmDBSetup()
y.installPkgs(self.packages)
y.buildTransaction()
y.conf.setConfigOption('assumeyes',True)
y.conf.setConfigOption('gpgcheck', False)
y.doTransaction()
def packageCount(self):
return len(self.packages)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment