mirror of
https://abf.rosa.ru/djam/livecd-tools.git
synced 2025-02-23 15:42:58 +00:00
290 lines
12 KiB
Diff
290 lines
12 KiB
Diff
diff -ur livecd-tools-031.orig/imgcreate/creator.py livecd-tools-031/imgcreate/creator.py
|
|
--- livecd-tools-031.orig/imgcreate/creator.py 2010-10-05 14:29:24.000000000 +0400
|
|
+++ livecd-tools-031/imgcreate/creator.py 2010-10-05 14:37:04.000000000 +0400
|
|
@@ -26,12 +26,12 @@
|
|
import logging
|
|
|
|
import selinux
|
|
-import yum
|
|
+#import yum
|
|
import rpm
|
|
|
|
from imgcreate.errors import *
|
|
from imgcreate.fs import *
|
|
-from imgcreate.yuminst import *
|
|
+#from imgcreate.yuminst import *
|
|
from imgcreate import kickstart
|
|
|
|
FSLABEL_MAXLEN = 32
|
|
@@ -581,48 +581,48 @@
|
|
shutil.rmtree(self.__builddir, ignore_errors = True)
|
|
self.__builddir = None
|
|
|
|
- def __select_packages(self, ayum):
|
|
- skipped_pkgs = []
|
|
- for pkg in kickstart.get_packages(self.ks,
|
|
- self._get_required_packages()):
|
|
- try:
|
|
- ayum.selectPackage(pkg)
|
|
- except yum.Errors.InstallError, e:
|
|
- if kickstart.ignore_missing(self.ks):
|
|
- skipped_pkgs.append(pkg)
|
|
- else:
|
|
- raise CreatorError("Failed to find package '%s' : %s" %
|
|
- (pkg, e))
|
|
-
|
|
- for pkg in skipped_pkgs:
|
|
- logging.warn("Skipping missing package '%s'" % (pkg,))
|
|
-
|
|
- def __select_groups(self, ayum):
|
|
- skipped_groups = []
|
|
- for group in kickstart.get_groups(self.ks):
|
|
- try:
|
|
- ayum.selectGroup(group.name, group.include)
|
|
- except (yum.Errors.InstallError, yum.Errors.GroupsError), e:
|
|
- if kickstart.ignore_missing(self.ks):
|
|
- raise CreatorError("Failed to find group '%s' : %s" %
|
|
- (group.name, e))
|
|
- else:
|
|
- skipped_groups.append(group)
|
|
-
|
|
- for group in skipped_groups:
|
|
- logging.warn("Skipping missing group '%s'" % (group.name,))
|
|
-
|
|
- def __deselect_packages(self, ayum):
|
|
- for pkg in kickstart.get_excluded(self.ks,
|
|
- self._get_excluded_packages()):
|
|
- ayum.deselectPackage(pkg)
|
|
-
|
|
- # if the system is running selinux and the kickstart wants it disabled
|
|
- # we need /usr/sbin/lokkit
|
|
- def __can_handle_selinux(self, ayum):
|
|
- file = "/usr/sbin/lokkit"
|
|
- if not kickstart.selinux_enabled(self.ks) and os.path.exists("/selinux/enforce") and not ayum.installHasFile(file):
|
|
- raise CreatorError("Unable to disable SELinux because the installed package set did not include the file %s" % (file))
|
|
+ #def __select_packages(self, ayum):
|
|
+ #skipped_pkgs = []
|
|
+ #for pkg in kickstart.get_packages(self.ks,
|
|
+ #self._get_required_packages()):
|
|
+ #try:
|
|
+ #ayum.selectPackage(pkg)
|
|
+ #except yum.Errors.InstallError, e:
|
|
+ #if kickstart.ignore_missing(self.ks):
|
|
+ #skipped_pkgs.append(pkg)
|
|
+ #else:
|
|
+ #raise CreatorError("Failed to find package '%s' : %s" %
|
|
+ #(pkg, e))
|
|
+
|
|
+ #for pkg in skipped_pkgs:
|
|
+ #logging.warn("Skipping missing package '%s'" % (pkg,))
|
|
+
|
|
+ #def __select_groups(self, ayum):
|
|
+ #skipped_groups = []
|
|
+ #for group in kickstart.get_groups(self.ks):
|
|
+ #try:
|
|
+ #ayum.selectGroup(group.name, group.include)
|
|
+ #except (yum.Errors.InstallError, yum.Errors.GroupsError), e:
|
|
+ #if kickstart.ignore_missing(self.ks):
|
|
+ #raise CreatorError("Failed to find group '%s' : %s" %
|
|
+ #(group.name, e))
|
|
+ #else:
|
|
+ #skipped_groups.append(group)
|
|
+
|
|
+ #for group in skipped_groups:
|
|
+ #logging.warn("Skipping missing group '%s'" % (group.name,))
|
|
+
|
|
+ #def __deselect_packages(self, ayum):
|
|
+ #for pkg in kickstart.get_excluded(self.ks,
|
|
+ #self._get_excluded_packages()):
|
|
+ #ayum.deselectPackage(pkg)
|
|
+
|
|
+ ## if the system is running selinux and the kickstart wants it disabled
|
|
+ ## we need /usr/sbin/lokkit
|
|
+ #def __can_handle_selinux(self, ayum):
|
|
+ #file = "/usr/sbin/lokkit"
|
|
+ #if not kickstart.selinux_enabled(self.ks) and os.path.exists("/selinux/enforce") and not ayum.installHasFile(file):
|
|
+ #raise CreatorError("Unable to disable SELinux because the installed package set did not include the file %s" % (file))
|
|
|
|
def install_urpmi(self, repo_urls = {}):
|
|
|
|
@@ -641,64 +641,64 @@
|
|
#subprocess.call(["/usr/sbin/urpmi", "--auto", "--urpmi-root", urpmi_conf, "--root", self._instroot, package])
|
|
subprocess.call(["/usr/sbin/urpmi", "--auto", "--no-suggests", "--urpmi-root", urpmi_conf, "--root", self._instroot] + packages)
|
|
|
|
- def install(self, repo_urls = {}):
|
|
- """Install packages into the install root.
|
|
+ #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.
|
|
+ #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.
|
|
+ #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-")
|
|
+ #"""
|
|
+ #yum_conf = self._mktemp(prefix = "yum.conf-")
|
|
|
|
- ayum = LiveCDYum()
|
|
- ayum.setup(yum_conf, self._instroot)
|
|
+ #ayum = LiveCDYum()
|
|
+ #ayum.setup(yum_conf, self._instroot)
|
|
|
|
- for repo in kickstart.get_repos(self.ks, repo_urls):
|
|
- (name, baseurl, mirrorlist, inc, exc) = repo
|
|
+ #for repo in kickstart.get_repos(self.ks, repo_urls):
|
|
+ #(name, baseurl, mirrorlist, inc, exc) = repo
|
|
|
|
- yr = ayum.addRepository(name, baseurl, mirrorlist)
|
|
- if inc:
|
|
- yr.includepkgs = inc
|
|
- if exc:
|
|
- yr.exclude = exc
|
|
-
|
|
- 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)
|
|
-
|
|
- self.__can_handle_selinux(ayum)
|
|
-
|
|
- ayum.runInstall()
|
|
- except yum.Errors.RepoError, e:
|
|
- raise CreatorError("Unable to download from repo : %s" % (e,))
|
|
- except yum.Errors.YumBaseError, e:
|
|
- raise CreatorError("Unable to install: %s" % (e,))
|
|
- finally:
|
|
- ayum.closeRpmDB()
|
|
- ayum.close()
|
|
- os.unlink(yum_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
|
|
+ #yr = ayum.addRepository(name, baseurl, mirrorlist)
|
|
+ #if inc:
|
|
+ #yr.includepkgs = inc
|
|
+ #if exc:
|
|
+ #yr.exclude = exc
|
|
+
|
|
+ #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)
|
|
+
|
|
+ #self.__can_handle_selinux(ayum)
|
|
+
|
|
+ #ayum.runInstall()
|
|
+ #except yum.Errors.RepoError, e:
|
|
+ #raise CreatorError("Unable to download from repo : %s" % (e,))
|
|
+ #except yum.Errors.YumBaseError, e:
|
|
+ #raise CreatorError("Unable to install: %s" % (e,))
|
|
+ #finally:
|
|
+ #ayum.closeRpmDB()
|
|
+ #ayum.close()
|
|
+ #os.unlink(yum_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
|
|
|
|
def __run_post_scripts(self):
|
|
for s in kickstart.get_post_scripts(self.ks):
|
|
diff -ur livecd-tools-031.orig/imgcreate/__init__.py livecd-tools-031/imgcreate/__init__.py
|
|
--- livecd-tools-031.orig/imgcreate/__init__.py 2009-10-30 00:26:09.000000000 +0300
|
|
+++ livecd-tools-031/imgcreate/__init__.py 2010-10-05 14:42:10.000000000 +0400
|
|
@@ -18,7 +18,7 @@
|
|
|
|
from imgcreate.live import *
|
|
from imgcreate.creator import *
|
|
-from imgcreate.yuminst import *
|
|
+#from imgcreate.yuminst import *
|
|
from imgcreate.kickstart import *
|
|
from imgcreate.fs import *
|
|
from imgcreate.debug import *
|
|
diff -ur livecd-tools-031.orig/imgcreate/live.py livecd-tools-031/imgcreate/live.py
|
|
--- livecd-tools-031.orig/imgcreate/live.py 2010-10-05 14:29:24.000000000 +0400
|
|
+++ livecd-tools-031/imgcreate/live.py 2010-10-05 14:49:45.000000000 +0400
|
|
@@ -684,15 +684,15 @@
|
|
cfgf.close()
|
|
|
|
# first gen mactel machines get the bootloader name wrong apparently
|
|
- if rpmUtils.arch.getBaseArch() == "i386":
|
|
- os.link(isodir + "/EFI/boot/grub.efi", isodir + "/EFI/boot/boot.efi")
|
|
- os.link(isodir + "/EFI/boot/grub.conf", isodir + "/EFI/boot/boot.conf")
|
|
-
|
|
- # for most things, we want them named boot$efiarch
|
|
- efiarch = {"i386": "ia32", "x86_64": "x64"}
|
|
- efiname = efiarch[rpmUtils.arch.getBaseArch()]
|
|
- os.rename(isodir + "/EFI/boot/grub.efi", isodir + "/EFI/boot/boot%s.efi" %(efiname,))
|
|
- os.link(isodir + "/EFI/boot/grub.conf", isodir + "/EFI/boot/boot%s.conf" %(efiname,))
|
|
+ #if rpmUtils.arch.getBaseArch() == "i386":
|
|
+ #os.link(isodir + "/EFI/boot/grub.efi", isodir + "/EFI/boot/boot.efi")
|
|
+ #os.link(isodir + "/EFI/boot/grub.conf", isodir + "/EFI/boot/boot.conf")
|
|
+
|
|
+ ## for most things, we want them named boot$efiarch
|
|
+ #efiarch = {"i386": "ia32", "x86_64": "x64"}
|
|
+ #efiname = efiarch[rpmUtils.arch.getBaseArch()]
|
|
+ #os.rename(isodir + "/EFI/boot/grub.efi", isodir + "/EFI/boot/boot%s.efi" %(efiname,))
|
|
+ #os.link(isodir + "/EFI/boot/grub.conf", isodir + "/EFI/boot/boot%s.conf" %(efiname,))
|
|
|
|
|
|
def _configure_bootloader(self, isodir):
|
|
@@ -894,12 +894,14 @@
|
|
return ["kernel.ppc"] + \
|
|
ppcLiveImageCreator._get_excluded_packages(self)
|
|
|
|
-arch = rpmUtils.arch.getBaseArch()
|
|
-if arch in ("i386", "x86_64"):
|
|
- LiveImageCreator = x86LiveImageCreator
|
|
-elif arch in ("ppc",):
|
|
- LiveImageCreator = ppcLiveImageCreator
|
|
-elif arch in ("ppc64",):
|
|
- LiveImageCreator = ppc64LiveImageCreator
|
|
-else:
|
|
- raise CreatorError("Architecture not supported!")
|
|
+LiveImageCreator = x86LiveImageCreator
|
|
+
|
|
+#arch = rpmUtils.arch.getBaseArch()
|
|
+#if arch in ("i386", "x86_64"):
|
|
+ #LiveImageCreator = x86LiveImageCreator
|
|
+#elif arch in ("ppc",):
|
|
+ #LiveImageCreator = ppcLiveImageCreator
|
|
+#elif arch in ("ppc64",):
|
|
+ #LiveImageCreator = ppc64LiveImageCreator
|
|
+#else:
|
|
+ #raise CreatorError("Architecture not supported!")
|