\r
if args.pack_to is not None:\r
configmgr.create['pack_to'] = args.pack_to\r
- if args.cpio:\r
- configmgr.create['cpio'] = args.cpio \r
\r
if args.copy_kernel:\r
configmgr.create['copy_kernel'] = args.copy_kernel\r
"extrarepos": {},
"ignore_ksrepo": False,
"strict_mode": False,
- "cpio":False,
},
'chroot': {
"saveto": None,
self.pack_to = None
self.repourl = {}
self.multiple_partitions = False
- self.cpio = False
# If the kernel is save to the destdir when copy_kernel cmd is called.
self._need_copy_kernel = False
if part.fstype and part.fstype == "btrfs":
self._dep_checks.append("mkfs.btrfs")
break
+ if part.fstype == "cpio":
+ part.fstype = "ext4"
if len(self.ks.handler.partition.partitions) > 1:
self.multiple_partitions = True
self._instloops.remove(item)
def create_cpio_image(self):
- if self.cpio:
- cpiomountdir = self._instroot + '/mnt/initrd'
- if os.path.exists(cpiomountdir):
+ for item in self._instloops:
+ if item['cpioopts']:
msger.info("Create image by cpio.")
- imgfile = os.path.join(self._imgdir, 'ramdisk.img')
+ imgfile = os.path.join(self._imgdir, item['name'])
if imgfile:
os.remove(imgfile)
try:
cpiocmd = fs.find_binary_path('cpio')
if cpiocmd:
oldoutdir = os.getcwd()
+ cpiomountdir = os.path.join(self._instroot, item['mountpoint'].lstrip('/'))
os.chdir(cpiomountdir)
# find . | cpio --create --'format=newc' | gzip > ../ramdisk.img
- runner.show('find . | cpio -o -H newc | gzip > %s' % imgfile)
+ runner.show('find . | cpio --create --format=%s | gzip > %s' % (item['cpioopts'], imgfile))
shutil.rmtree(cpiomountdir, ignore_errors=True)
fs.makedirs(cpiomountdir)
os.chdir(oldoutdir)
except OSError, (errno, msg):
raise errors.KsError("Create image by cpio error: %s" % msg)
- else:
- msger.warning("Do not create image by cpio. There is no directory '/mnt/initrd'.")
def package(self, destdir = "."):
"""Prepares the created image for final delivery.
'extopts': part.extopts or None,
'vdfsopts': part.vdfsopts or None,
'squashfsopts': part.squashfsopts or None,
+ 'cpioopts': part.cpioopts or None,
'loop': None, # to be created in _mount_instroot
'uuid': part.uuid or None,
'kspart' : part,
"""
minsize = 0
for item in self._instloops:
- if item['name'] == self._img_name:
- minsize = item['loop'].resparse(size)
- else:
- item['loop'].resparse(size)
+ if not item['cpioopts']:
+ if item['name'] == self._img_name:
+ minsize = item['loop'].resparse(size)
+ else:
+ item['loop'].resparse(size)
return minsize
self.exclude_image = kwargs.get("exclude_from_image", False)
self.vdfsopts = kwargs.get("vdfsopts", None)
self.squashfsopts = kwargs.get("squashfsopts", None)
+ self.cpioopts = kwargs.get("cpioopts", None)
def _getArgsAsStr(self):
retval = FC4_PartData._getArgsAsStr(self)
retval += " --vdfsoptions=%s" % self.vdfsopts
if self.squashfsopts:
retval += " --squashfsoptions=%s" % self.squashfsopts
-
+ if self.cpioopts:
+ retval += " --cpiooptions=%s" % self.cpioopts
return retval
class Mic_Partition(FC4_Partition):
default=None)
op.add_option("--squashfsoptions", type="string", action="store", dest="squashfsopts",
default=None)
+ op.add_option("--cpiooptions", type="string", action="store", dest="cpioopts",
+ default=None)
return op
#Download the source packages ###private options
if args.include_src:
installed_pkgs = creator.get_installed_packages()
- msger.info('--------------------------------------------------')
msger.info('Generating the image with source rpms included ...')
if not misc.SrcpkgsDownload(installed_pkgs, creatoropts["repomd"],
creator._instroot, creatoropts["cachedir"]):
creator.configure(creatoropts["repomd"])
creator.copy_kernel()
- if creatoropts['cpio']:
- creator.create_cpio_image()
creator.unmount()
creator.package(creatoropts["destdir"])
creator.create_manifest()
creator.install()
creator.configure(creatoropts["repomd"])
creator.copy_kernel()
- if creatoropts['cpio']:
- creator.create_cpio_image()
+ creator.create_cpio_image()
creator.unmount()
creator.package(creatoropts["destdir"])
creator.create_manifest()
creator.install()
creator.configure(creatoropts["repomd"])
creator.copy_kernel()
- if creatoropts['cpio']:
- creator.create_cpio_image()
+ creator.create_cpio_image()
creator.unmount()
creator.package(creatoropts["destdir"])
creator.create_manifest()
creator.install()
creator.configure(creatoropts["repomd"])
creator.copy_kernel()
- if creatoropts['cpio']:
- creator.create_cpio_image()
creator.unmount()
creator.generate_bmap()
creator.package(creatoropts["destdir"])
"""
parent_parser = ArgumentParser(add_help=False)
- parent_parser.add_argument('--cpio', action='store_true',
- dest='cpio', default=False,
- help='Use cpio to generate image')
parent_parser.add_argument('ksfile', help='Path of ksfile')
parent_parser.add_argument('--logfile', dest='logfile', default=None,
help='Path of logfile')