예제 #1
0
    def __init__(self,
                 ks,
                 name,
                 releasever=None,
                 tmpdir="/tmp",
                 useplugins=False,
                 cacheonly=False,
                 docleanup=True):
        """Initialize an ImageCreator instance.

        ks -- a pykickstart.KickstartParser instance; this instance will be
              used to drive the install by e.g. providing the list of packages
              to be installed, the system configuration and %post scripts

        name -- a name for the image; used for e.g. image filenames or
                filesystem labels

        releasever -- Value to substitute for $releasever in repo urls

        tmpdir -- Top level directory to use for temporary files and dirs

        cacheonly -- Only read from cache, work offline
        """
        self.ks = ks
        """A pykickstart.KickstartParser instance."""

        self.name = name
        """A name for the image."""

        self.releasever = releasever
        self.useplugins = useplugins

        self.tmpdir = tmpdir
        """The directory in which all temporary files will be created."""
        if not os.path.exists(self.tmpdir):
            makedirs(self.tmpdir)

        self.cacheonly = cacheonly
        self.docleanup = docleanup
        self.excludeWeakdeps = kickstart.exclude_weakdeps(self.ks)

        self.__builddir = None
        self.__bindmounts = []
        self.__fstype = kickstart.get_image_fstype(self.ks, "ext4")

        self.__sanity_check()

        # get selinuxfs mountpoint
        self.__selinux_mountpoint = "/sys/fs/selinux"
        with open("/proc/self/mountinfo", "r") as f:
            for line in f.readlines():
                fields = line.split()
                if fields[-2] == "selinuxfs":
                    self.__selinux_mountpoint = fields[4]
                    break
예제 #2
0
    def __init__(self, ks, name, releasever=None, tmpdir="/tmp", useplugins=False,
                 cacheonly=False, docleanup=True):
        """Initialize an ImageCreator instance.

        ks -- a pykickstart.KickstartParser instance; this instance will be
              used to drive the install by e.g. providing the list of packages
              to be installed, the system configuration and %post scripts

        name -- a name for the image; used for e.g. image filenames or
                filesystem labels

        releasever -- Value to substitute for $releasever in repo urls

        tmpdir -- Top level directory to use for temporary files and dirs

        cacheonly -- Only read from cache, work offline
        """
        self.ks = ks
        """A pykickstart.KickstartParser instance."""

        self.name = name
        """A name for the image."""

        self.releasever = releasever
        self.useplugins = useplugins

        self.tmpdir = tmpdir
        """The directory in which all temporary files will be created."""
        if not os.path.exists(self.tmpdir):
            makedirs(self.tmpdir)

        self.cacheonly = cacheonly
        self.docleanup = docleanup
        self.excludeWeakdeps = kickstart.exclude_weakdeps(self.ks)

        self.__builddir = None
        self.__bindmounts = []
        self.__fstype = kickstart.get_image_fstype(self.ks, "ext3")

        self.__sanity_check()

        # get selinuxfs mountpoint
        self.__selinux_mountpoint = "/sys/fs/selinux"
        with open("/proc/self/mountinfo", "r") as f:
            for line in f.readlines():
                fields = line.split()
                if fields[-2] == "selinuxfs":
                    self.__selinux_mountpoint = fields[4]
                    break