From: Gui Chen Date: Mon, 16 Jan 2012 03:14:35 +0000 (+0800) Subject: add shell option for convertor to enable modification before conerting X-Git-Tag: 0.5~17 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=aec417a99f7e5705ed006bdaa4229c1a9099a94f;p=tools%2Fmic.git add shell option for convertor to enable modification before conerting recreate image modified by internal shell Signed-off-by: Gui Chen --- diff --git a/mic/conf.py b/mic/conf.py index 54d8ab4..05832f6 100644 --- a/mic/conf.py +++ b/mic/conf.py @@ -53,7 +53,9 @@ class ConfigMgr(object): "runtime": None, }, 'chroot': {}, - 'convert': {}, + 'convert': { + "shell": False, + }, 'bootstraps': {}, } diff --git a/plugins/imager/livecd_plugin.py b/plugins/imager/livecd_plugin.py index 4c1ac71..6572eef 100644 --- a/plugins/imager/livecd_plugin.py +++ b/plugins/imager/livecd_plugin.py @@ -177,8 +177,8 @@ class LiveCDPlugin(ImagerPlugin): raise errors.CreatorError("Failed to run post cleanups: %s" % msg) convertoropts = configmgr.convert + convertoropts['name'] = os.path.splitext(os.path.basename(base_on))[0] convertor = livecd.LiveCDImageCreator(convertoropts) - convertor.name = os.path.splitext(os.path.basename(base_on))[0] imgtype = misc.get_image_type(base_on) if imgtype == "btrfsimg": fstype = "btrfs" @@ -192,6 +192,7 @@ class LiveCDPlugin(ImagerPlugin): __mkinitrd(convertor) convertor._create_bootconfig() __run_post_cleanups(convertor) + convertor.launch_shell(convertoropts['shell']) convertor.unmount() convertor.package() convertor.print_outimage_info() diff --git a/plugins/imager/liveusb_plugin.py b/plugins/imager/liveusb_plugin.py index e638b10..cbcf81e 100644 --- a/plugins/imager/liveusb_plugin.py +++ b/plugins/imager/liveusb_plugin.py @@ -180,8 +180,8 @@ class LiveUSBPlugin(ImagerPlugin): raise errors.CreatorError("Failed to run post cleanups: %s" % msg) convertoropts = configmgr.convert + convertoropts['name'] = os.path.splitext(os.path.basename(base_on))[0] convertor = liveusb.LiveUSBImageCreator(convertoropts) - convertor.name = os.path.splitext(os.path.basename(base_on))[0] imgtype = misc.get_image_type(base_on) if imgtype == "btrfsimg": fstype = "btrfs" @@ -195,6 +195,7 @@ class LiveUSBPlugin(ImagerPlugin): __mkinitrd(convertor) convertor._create_bootconfig() __run_post_cleanups(convertor) + convertor.launch_shell(convertoropts['shell']) convertor.unmount() convertor.package() convertor.print_outimage_info() diff --git a/tools/mic b/tools/mic index 1a08e85..c55c5f1 100755 --- a/tools/mic +++ b/tools/mic @@ -18,6 +18,7 @@ import os, sys, errno from mic import msger, creator from mic.utils import cmdln, misc, errors +from mic.conf import configmgr from mic.plugin import pluginmgr from mic.__version__ import VERSION @@ -82,6 +83,9 @@ class MicCmd(cmdln.Cmdln): msger.error('Root permission is required to continue, abort') @cmdln.alias("cv") + @cmdln.option("-S", "--shell", + action="store_true", dest="shell", default=False, + help="Launch shell before packaging the converted image") def do_convert(self, subcmd, opts, *args): """${cmd_name}: convert image format @@ -110,6 +114,8 @@ class MicCmd(cmdln.Cmdln): self._root_confirm() + configmgr.convert['shell'] = opts.shell + srcformat = misc.get_image_type(srcimg) if srcformat == "ext3fsimg": srcformat = "loop"