diff options
author | Marco Pesenti Gritti <marco@marcopg.org> | 2009-01-23 19:55:02 (GMT) |
---|---|---|
committer | Marco Pesenti Gritti <marco@marcopg.org> | 2009-01-23 19:55:02 (GMT) |
commit | f139cf28fd96e47175ba3bddce6aefdd8d92b0b3 (patch) | |
tree | 6af5d72ca86650a2cd836e8fb4ca78b02ad30a44 /build | |
parent | eee4f0dfae184aa4cc5b0613d87ceb9bba9ad3a9 (diff) |
Create the snapshot image names in the format Soas-23-Jan-2009.iso
- remove the version file part
- abort if file with the same timestamp exist
Diffstat (limited to 'build')
-rwxr-xr-x | build | 15 |
1 files changed, 7 insertions, 8 deletions
@@ -3,6 +3,7 @@ import logging import os import sys +from time import gmtime, strftime import imgcreate @@ -15,14 +16,14 @@ def main(): if not os.path.exists(images_dir): os.mkdir(images_dir) - try: - last = open(last_file).read() - version = int(last) + 1 - except IOError: - version = 1 + image_date = strftime("%d-%b-%Y", gmtime()) + image_name = 'Soas-%s' % image_date + if os.path.exists(os.path.join(images_dir, image_name + '.iso')): + print 'Image %s exist already' % image_name + sys.exit(2) ks = imgcreate.read_kickstart(os.path.join(base_dir, 'soas.ks')) - creator = imgcreate.LiveImageCreator(ks, 'soas-%d' % version, 'Sugar') + creator = imgcreate.LiveImageCreator(ks, image_name, 'Sugar') try: creator.mount(cachedir=cache_dir) @@ -36,8 +37,6 @@ def main(): finally: creator.cleanup() - open(last_file, 'w').write(str(version)) - return 0 if __name__ == "__main__": |