Merge pull request #8576 from obadz/nix-prefetch-zip

Add --ext option to nix-prefetch-zip

+7 -2
+7 -2
pkgs/build-support/fetchzip/nix-prefetch-zip
··· 6 6 Options: 7 7 --url url The url of the archive to fetch. 8 8 --name name The name to use for the store path (defaults to \`basename \$url\`). 9 + --ext ext The file extension (.zip, .tar.gz, ...) to be REMOVED from name 9 10 --hash hash The hash of unpacked archive. 10 11 --hash-type type Use the specified cryptographic hash algorithm, which can be one of md5, sha1, and sha256. 11 12 --leave-root Keep the root directory of the archive. ··· 16 17 17 18 18 19 name="" 20 + ext="" 19 21 argi=0 20 22 argfun="" 21 23 for arg; do ··· 23 25 case $arg in 24 26 --url) argfun=set_url;; 25 27 --name) argfun=set_name;; 28 + --ext) argfun=set_ext;; 26 29 --hash) argfun=set_expHash;; 27 30 --hash-type) argfun=set_hashType;; 28 31 --leave-root) leaveRoot=true;; ··· 67 70 tmp=$(mktemp -d 2>/dev/null || mktemp -d -t "$$") 68 71 trap "rm -rf '$tmp'" EXIT 69 72 70 - unpackDirTmp=$tmp/unpacked-tmp/$name 73 + dirname=$(basename -s "$ext" "$name") 74 + 75 + unpackDirTmp=$tmp/unpacked-tmp/$dirname 71 76 mkdir -p $unpackDirTmp 72 77 73 - unpackDir=$tmp/unpacked/$name 78 + unpackDir=$tmp/unpacked/$dirname 74 79 mkdir -p $unpackDir 75 80 76 81 downloadedFile=$tmp/$(basename "$url")