X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=plugins%2Fimager%2Fqcow_plugin.py;h=a1d808a037aa363e58ca792a5ab0adb4c4795005;hb=7db9b0c91a5b26f96a86ec10dfad261a7d781f3b;hp=03ed0da3ea6e5810880b09ece4fde6e853e13fba;hpb=ffcf7e2f5ca11ae5b7ebb6b88370011611ba669d;p=tools%2Fmic.git diff --git a/plugins/imager/qcow_plugin.py b/plugins/imager/qcow_plugin.py old mode 100644 new mode 100755 index 03ed0da..a1d808a --- a/plugins/imager/qcow_plugin.py +++ b/plugins/imager/qcow_plugin.py @@ -15,6 +15,7 @@ # Temple Place - Suite 330, Boston, MA 02111-1307, USA. import os +import subprocess import shutil from mic import msger, rt_util @@ -64,7 +65,7 @@ class QcowPlugin(ImagerPlugin): name = 'qcow' @classmethod - def do_create(cls, subcmd, opts, *args): + def do_create(cls, args): """${cmd_name}: create qcow image Usage: @@ -72,25 +73,15 @@ class QcowPlugin(ImagerPlugin): ${cmd_option_list} """ - if len(args) != 1: - raise errors.Usage("Extra arguments given") + if args is None: + raise errors.Usage("Invalid arguments") creatoropts = configmgr.create - ksconf = args[0] + ksconf = args.ksfile if creatoropts['runtime'] == "bootstrap": configmgr._ksconf = ksconf rt_util.bootstrap_mic() - elif not rt_util.inbootstrap(): - try: - fs_related.find_binary_path('mic-native') - except errors.CreatorError: - if not msger.ask("Subpackage \"mic-native\" has not been " - "installed in your host system, still " - "continue with \"native\" running mode?", - False): - raise errors.Abort("Abort because subpackage 'mic-native' " - "has not been installed") recording_pkgs = [] if len(creatoropts['record_pkgs']) > 0: @@ -120,7 +111,7 @@ class QcowPlugin(ImagerPlugin): if not pkgmgr: raise errors.CreatorError("Can't find backend: %s, " - "available choices: %s" % + "available choices: %s" % (creatoropts['pkgmgr'], ','.join(backends.keys()))) @@ -143,7 +134,10 @@ class QcowPlugin(ImagerPlugin): creator.install() creator.configure(creatoropts["repomd"]) creator.copy_kernel() + creator.copy_attachment() + creator.create_cpio_image() creator.unmount() + creator.copy_cpio_image() creator.package(creatoropts["destdir"]) creator.create_manifest() @@ -158,6 +152,15 @@ class QcowPlugin(ImagerPlugin): finally: creator.cleanup() + #Run script of --run_script after image created + if creatoropts['run_script']: + cmd = creatoropts['run_script'] + try: + runner.show(cmd) + except OSError,err: + msger.warning(str(err)) + + msger.info("Finished.") return 0