diff --git a/bin/is b/bin/is index 901c34b7e6b6b7e897d1393713359e7a26bd2b2f..9af1d94cf1d820e2f345c54ac5fb9b74631a806a 100755 --- a/bin/is +++ b/bin/is @@ -193,7 +193,7 @@ def c_get(parser, args): repoman = load_repositories(args) for image in args.image: img, repo = select_image(image, repoman, args.best) - img.download(".", payload=args.payload, force=args.force) + img.download(".", image=not args.noimage, payload=args.payload, force=args.force) def c_help(parser, args): ''' @@ -441,6 +441,8 @@ p_extract.set_defaults(func=c_extract) p_get = subparsers.add_parser("get", help=c_get.__doc__.lower()) p_get.add_argument("-p", action="store_true", dest="payload", default=False, help="get payloads") +p_get.add_argument("-I", action="store_true", dest="noimage", default=False, + help="do not get image") p_get.add_argument("-f", "--force", action="store_true", default=False, help="overwrite existing destinations") p_get.add_argument("-b", "--best", action="store_true", default=False, diff --git a/installsystems/image.py b/installsystems/image.py index d54da9bce0cc38b46b2d996490571f458e4ff628..0b34136fee863dc0f9f0515f039634d308f69ad0 100644 --- a/installsystems/image.py +++ b/installsystems/image.py @@ -633,7 +633,7 @@ class PackageImage(Image): arrow(filename) out(self._tarball.get_str(filename)) - def download(self, directory, force=False, payload=False): + def download(self, directory, force=False, image=True, payload=False): ''' Download image in directory Doesn't use in memory image because we cannot access it @@ -641,26 +641,27 @@ class PackageImage(Image): ''' # check if destination exists directory = os.path.abspath(directory) - dest = os.path.join(directory, self.filename) - if not force and os.path.exists(dest): - raise Exception("Image destination already exists: %s" % dest) - # some display - arrow("Downloading image in %s" % directory) - debug("Downloading %s from %s" % (self.id, self.path)) - # open source - fs = PipeFile(self.path, progressbar=True) - # check if announced file size is good - if fs.size is not None and self.size != fs.size: - raise Exception("Downloading image %s failed: Invalid announced size" % self.name) - # open destination - fd = open(self.filename, "wb") - fs.consume(fd) - fs.close() - fd.close() - if self.size != fs.consumed_size: - raise Exception("Download image %s failed: Invalid size" % self.name) - if self.md5 != fs.md5: - raise Exception("Download image %s failed: Invalid MD5" % self.name) + if image: + dest = os.path.join(directory, self.filename) + if not force and os.path.exists(dest): + raise Exception("Image destination already exists: %s" % dest) + # some display + arrow("Downloading image in %s" % directory) + debug("Downloading %s from %s" % (self.id, self.path)) + # open source + fs = PipeFile(self.path, progressbar=True) + # check if announced file size is good + if fs.size is not None and self.size != fs.size: + raise Exception("Downloading image %s failed: Invalid announced size" % self.name) + # open destination + fd = open(self.filename, "wb") + fs.consume(fd) + fs.close() + fd.close() + if self.size != fs.consumed_size: + raise Exception("Download image %s failed: Invalid size" % self.name) + if self.md5 != fs.md5: + raise Exception("Download image %s failed: Invalid MD5" % self.name) if payload: for payname in self.payload: arrow("Downloading payload %s in %s" % (payname, directory))