def main(): if len(sys.argv) < 5: usage () os._exit (0) img_path = sys.argv[1] os_release = sys.argv[2] version = sys.argv[3] arch = sys.argv[4] tarball_path = os.path.join (conf.OS_IMAGE_DIR, "%s-%s-%s.tar.gz" % (os_release, version, arch)) if not os.path.exists (img_path): print "%s not exists" % (img_path) os._exit (1) if os.path.exists (tarball_path): answer = raw_input ('%s exists, override ? [y/n]' % (tarball_path)) if answer not in ['y', 'Y']: print "aborted" os._exit (0) os.unlink (tarball_path) vps_common.pack_vps_fs_tarball (img_path, tarball_path) print "done"
def main(): if len(sys.argv) < 5: usage() os._exit(0) img_path = sys.argv[1] os_release = sys.argv[2] version = sys.argv[3] arch = sys.argv[4] tarball_path = os.path.join( conf.OS_IMAGE_DIR, "%s-%s-%s.tar.gz" % (os_release, version, arch)) if not os.path.exists(img_path): print "%s not exists" % (img_path) os._exit(1) if os.path.exists(tarball_path): answer = raw_input('%s exists, override ? [y/n]' % (tarball_path)) if answer not in ['y', 'Y']: print "aborted" os._exit(0) os.unlink(tarball_path) vps_common.pack_vps_fs_tarball(img_path, tarball_path) print "done"
def main(): if len(sys.argv) < 3: usage () os._exit (0) img_path = sys.argv[1] tarball_dir = sys.argv[2] if not os.path.exists (img_path): print "%s not exists" % (img_path) os._exit (1) if not os.path.isdir (tarball_dir): print '%s is not a directory' % (tarball_dir) os._exit (1) tarball_path = vps_common.pack_vps_fs_tarball (img_path, tarball_dir) print "%s packed in %s" % (img_path, tarball_path)