diff options
author | Gui Chen <gui.chen@intel.com> | 2012-02-15 17:24:35 +0800 |
---|---|---|
committer | Gui Chen <gui.chen@intel.com> | 2012-02-15 17:39:57 +0800 |
commit | cb407ae7fdbc809c3436dc6e004f95ec497f190e (patch) | |
tree | c4de1535edc6a8e5f4597fa4af8062f3875f2ad3 /tools | |
parent | f1d620bbb4ca9694e77eab7151bb3ed56f624554 (diff) | |
download | mic-cb407ae7fdbc809c3436dc6e004f95ec497f190e.tar.gz mic-cb407ae7fdbc809c3436dc6e004f95ec497f190e.tar.bz2 mic-cb407ae7fdbc809c3436dc6e004f95ec497f190e.zip |
give hint when converted image existed
Signed-off-by: Gui Chen <gui.chen@intel.com>
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/mic | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -132,6 +132,20 @@ class MicCmd(cmdln.Cmdln): raise errors.CreatorError("Can't convert from %s to %s" \ % (srcformat, destformat)) else: + maptab = {"livecd": "iso", + "liveusb": "usbimg", + "loop": "img" + } + if destformat in maptab.keys(): + imgname = os.path.splitext(os.path.basename(srcimg))[0] + dstname = "{0}.{1}".format(imgname, maptab[destformat]) + if os.path.exists(dstname): + if msger.ask("Converted image %s seems existed, " + "remove and continue?" % dstname): + os.unlink(dstname) + else: + raise errors.Abort("Canceled") + base_on = srcimager.do_unpack(srcimg) destimager.do_pack(base_on) |