mirror of
https://github.com/robmcmullen/atrcopy.git
synced 2024-12-02 00:51:41 +00:00
Updated create command to show more info about image as it's created
This commit is contained in:
parent
b8a1b35d3e
commit
9cbd705421
@ -276,7 +276,7 @@ def list_templates():
|
|||||||
description = fh.read().strip()
|
description = fh.read().strip()
|
||||||
except IOError:
|
except IOError:
|
||||||
description = ""
|
description = ""
|
||||||
print "%-12s %s" % (os.path.basename(name), description)
|
print "%-14s %s" % (os.path.basename(name), description)
|
||||||
|
|
||||||
|
|
||||||
def get_template_data(template):
|
def get_template_data(template):
|
||||||
@ -286,12 +286,17 @@ def get_template_data(template):
|
|||||||
data = fh.read()
|
data = fh.read()
|
||||||
except:
|
except:
|
||||||
raise InvalidDiskImage("Template disk image %s not found" % template)
|
raise InvalidDiskImage("Template disk image %s not found" % template)
|
||||||
return data
|
try:
|
||||||
|
with open(path + ".inf", "r") as fh:
|
||||||
|
inf = fh.read().strip()
|
||||||
|
except IOError:
|
||||||
|
inf = ""
|
||||||
|
return data, inf
|
||||||
|
|
||||||
|
|
||||||
def create_image(template, name):
|
def create_image(template, name):
|
||||||
data = get_template_data(template)
|
data, inf = get_template_data(template)
|
||||||
print "using %s template to create %s" % (template, name)
|
print "using %s template: %s" % (template, inf)
|
||||||
if not options.dry_run:
|
if not options.dry_run:
|
||||||
if os.path.exists(name) and not options.force:
|
if os.path.exists(name) and not options.force:
|
||||||
print "skipping %s, use -f to overwrite" % (name)
|
print "skipping %s, use -f to overwrite" % (name)
|
||||||
@ -299,7 +304,10 @@ def create_image(template, name):
|
|||||||
with open(name, "wb") as fh:
|
with open(name, "wb") as fh:
|
||||||
fh.write(data)
|
fh.write(data)
|
||||||
parser = find_diskimage(name)
|
parser = find_diskimage(name)
|
||||||
|
print "created %s: %s" % (name, str(parser.image))
|
||||||
list_files(parser.image, [])
|
list_files(parser.image, [])
|
||||||
|
else:
|
||||||
|
print "creating %s" % name
|
||||||
|
|
||||||
|
|
||||||
def run():
|
def run():
|
||||||
|
Loading…
Reference in New Issue
Block a user