def install(self, repo_urls={}): """Install packages into the install root. This function installs the packages listed in the supplied kickstart into the install root. By default, the packages are installed from the repository URLs specified in the kickstart. repo_urls -- a dict which maps a repository name to a repository URL; if supplied, this causes any repository URLs specified in the kickstart to be overridden. """ yum_conf = self._mktemp(prefix="yum.conf-") ayum = LiveCDYum(releasever=self.releasever, useplugins=self.useplugins) ayum.setup(yum_conf, self._instroot, cacheonly=self.cacheonly) for repo in kickstart.get_repos(self.ks, repo_urls): (name, baseurl, mirrorlist, proxy, inc, exc, cost, sslverify) = repo yr = ayum.addRepository(name, baseurl, mirrorlist) if inc: yr.includepkgs = inc if exc: yr.exclude = exc if proxy: yr.proxy = proxy if cost is not None: yr.cost = cost yr.sslverify = sslverify ayum.setup(yum_conf, self._instroot) if kickstart.exclude_docs(self.ks): rpm.addMacro("_excludedocs", "1") if not kickstart.selinux_enabled(self.ks): rpm.addMacro("__file_context_path", "%{nil}") if kickstart.inst_langs(self.ks) != None: rpm.addMacro("_install_langs", kickstart.inst_langs(self.ks)) try: self.__select_packages(ayum) self.__select_groups(ayum) self.__deselect_packages(ayum) ayum.runInstall() except yum.Errors.RepoError, e: raise CreatorError("Unable to download from repo : %s" % (e, ))
def install(self, repo_urls = {}): """Install packages into the install root. This function installs the packages listed in the supplied kickstart into the install root. By default, the packages are installed from the repository URLs specified in the kickstart. repo_urls -- a dict which maps a repository name to a repository URL; if supplied, this causes any repository URLs specified in the kickstart to be overridden. """ yum_conf = self._mktemp(prefix = "yum.conf-") ayum = LiveCDYum(releasever=self.releasever, useplugins=self.useplugins) ayum.setup(yum_conf, self._instroot, cacheonly=self.cacheonly) for repo in kickstart.get_repos(self.ks, repo_urls): (name, baseurl, mirrorlist, proxy, inc, exc, cost, sslverify) = repo yr = ayum.addRepository(name, baseurl, mirrorlist) if inc: yr.includepkgs = inc if exc: yr.exclude = exc if proxy: yr.proxy = proxy if cost is not None: yr.cost = cost yr.sslverify = sslverify ayum.setup(yum_conf, self._instroot) if kickstart.exclude_docs(self.ks): rpm.addMacro("_excludedocs", "1") if not kickstart.selinux_enabled(self.ks): rpm.addMacro("__file_context_path", "%{nil}") if kickstart.inst_langs(self.ks) != None: rpm.addMacro("_install_langs", kickstart.inst_langs(self.ks)) try: self.__select_packages(ayum) self.__select_groups(ayum) self.__deselect_packages(ayum) ayum.runInstall() except yum.Errors.RepoError, e: raise CreatorError("Unable to download from repo : %s" % (e,))
def install(self, repo_urls = {}): """Install packages into the install root. This function installs the packages listed in the supplied kickstart into the install root. By default, the packages are installed from the repository URLs specified in the kickstart. repo_urls -- a dict which maps a repository name to a repository URL; if supplied, this causes any repository URLs specified in the kickstart to be overridden. """ dnf_conf = self._mktemp(prefix = "dnf.conf-") dbo = DnfLiveCD(releasever=self.releasever, useplugins=self.useplugins) dbo.setup(dnf_conf, self._instroot, cacheonly=self.cacheonly, excludeWeakdeps=self.excludeWeakdeps) for repo in kickstart.get_repos(self.ks, repo_urls): (name, baseurl, mirrorlist, proxy, inc, exc, cost, sslverify) = repo yr = dbo.addRepository(name, baseurl, mirrorlist) if inc: yr.includepkgs = inc if exc: yr.exclude = exc if proxy: yr.proxy = proxy if cost is not None: yr.cost = cost yr.sslverify = sslverify if kickstart.exclude_docs(self.ks): rpm.addMacro("_excludedocs", "1") if not kickstart.selinux_enabled(self.ks): rpm.addMacro("__file_context_path", "%{nil}") if kickstart.inst_langs(self.ks) != None: rpm.addMacro("_install_langs", kickstart.inst_langs(self.ks)) dbo.fill_sack(load_system_repo = os.path.exists(self._instroot + "/var/lib/rpm/Packages")) dbo.read_comps() try: self.__apply_selections(dbo) dbo.runInstall() except (dnf.exceptions.DownloadError, dnf.exceptions.RepoError) as e: raise CreatorError("Unable to download from repo : %s" % (e,)) except dnf.exceptions.Error as e: raise CreatorError("Unable to install: %s" % (e,)) finally: dbo.close() os.unlink(dnf_conf) # do some clean up to avoid lvm info leakage. this sucks. for subdir in ("cache", "backup", "archive"): lvmdir = self._instroot + "/etc/lvm/" + subdir try: for f in os.listdir(lvmdir): os.unlink(lvmdir + "/" + f) except: pass