summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorGui Chen <gui.chen@intel.com>2012-02-15 17:24:35 +0800
committerGui Chen <gui.chen@intel.com>2012-02-15 17:39:57 +0800
commitcb407ae7fdbc809c3436dc6e004f95ec497f190e (patch)
treec4de1535edc6a8e5f4597fa4af8062f3875f2ad3 /tools
parentf1d620bbb4ca9694e77eab7151bb3ed56f624554 (diff)
downloadmic-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-xtools/mic14
1 files changed, 14 insertions, 0 deletions
diff --git a/tools/mic b/tools/mic
index b6a3dbc..4d5ee3f 100755
--- a/tools/mic
+++ b/tools/mic
@@ -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)