patch-iso supports multiple graft directories

Pungi patch iso now supports multiple graft directories. This should
make usage more comfortable.

Signed-off-by: Jiri Konecny <jkonecny@redhat.com>
This commit is contained in:
Jiri Konecny 2019-04-12 15:09:53 +02:00
parent 479d17c033
commit 0cd089802f
No known key found for this signature in database
GPG Key ID: 38F52F0E5C3FAD25
3 changed files with 9 additions and 5 deletions

View File

@ -40,8 +40,8 @@ def main(args=None):
help='which file to write the result to') help='which file to write the result to')
parser.add_argument('source', metavar='SOURCE_ISO', parser.add_argument('source', metavar='SOURCE_ISO',
help='source ISO to work with') help='source ISO to work with')
parser.add_argument('dir', metavar='GRAFT_DIR', parser.add_argument('dirs', nargs="+", metavar='GRAFT_DIR',
help='extra directory to graft on the ISO') help='extra directories to graft on the ISO')
opts = parser.parse_args(args) opts = parser.parse_args(args)
level = logging.DEBUG if opts.verbose else logging.INFO level = logging.DEBUG if opts.verbose else logging.INFO

View File

@ -92,7 +92,7 @@ def run(log, opts):
volume_id = opts.volume_id or iso.get_volume_id(opts.source) volume_id = opts.volume_id or iso.get_volume_id(opts.source)
# create graft points from mounted source iso + overlay dir # create graft points from mounted source iso + overlay dir
graft_points = iso.get_graft_points([work_dir, opts.dir]) graft_points = iso.get_graft_points([work_dir] + opts.dirs)
# if ks.cfg is detected, patch syslinux + grub to use it # if ks.cfg is detected, patch syslinux + grub to use it
if 'ks.cfg' in graft_points: if 'ks.cfg' in graft_points:
log.info('Adding ks.cfg to boot configs') log.info('Adding ks.cfg to boot configs')

View File

@ -87,6 +87,7 @@ class TestPatchingIso(unittest.TestCase):
source='source.iso', source='source.iso',
force_arch=None, force_arch=None,
volume_id='FOOBAR', volume_id='FOOBAR',
dirs=[]
) )
patch_iso.run(log, opts) patch_iso.run(log, opts)
@ -124,7 +125,8 @@ class TestPatchingIso(unittest.TestCase):
target='test.iso', target='test.iso',
source='source.iso', source='source.iso',
force_arch=None, force_arch=None,
volume_id=None volume_id=None,
dirs=[]
) )
patch_iso.run(log, opts) patch_iso.run(log, opts)
@ -164,7 +166,8 @@ class TestPatchingIso(unittest.TestCase):
target='test.iso', target='test.iso',
source='source.iso', source='source.iso',
force_arch=None, force_arch=None,
volume_id=None volume_id=None,
dirs=[]
) )
patch_iso.run(log, opts) patch_iso.run(log, opts)
@ -206,6 +209,7 @@ class TestPatchingIso(unittest.TestCase):
source='source.iso', source='source.iso',
force_arch='s390', force_arch='s390',
volume_id='foobar', volume_id='foobar',
dirs=[],
) )
patch_iso.run(log, opts) patch_iso.run(log, opts)