1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-20 04:31:52 +00:00

fetchurl: support executables

This commit is contained in:
Domen Kožar 2016-01-19 11:17:49 +01:00
parent 75284b09e1
commit c7383cb34b
2 changed files with 10 additions and 2 deletions

View file

@ -45,6 +45,11 @@ tryDownload() {
finish() { finish() {
set +o noglob set +o noglob
if [[ $executable == "1" ]]; then
chmod +x $downloadedFile
fi
runHook postFetch runHook postFetch
stopNest stopNest
exit 0 exit 0

View file

@ -73,6 +73,9 @@ in
# is communicated to postFetch via $downloadedFile. # is communicated to postFetch via $downloadedFile.
downloadToTemp ? false downloadToTemp ? false
, # If true, set executable bit on downloaded file
executable ? false
, # If set, don't download the file, but write a list of all possible , # If set, don't download the file, but write a list of all possible
# URLs (resulting from resolving mirror:// URLs) to $out. # URLs (resulting from resolving mirror:// URLs) to $out.
showURLs ? false showURLs ? false
@ -116,9 +119,9 @@ if (!hasHash) then throw "Specify hash for fetchurl fixed-output derivation: ${s
outputHash = if outputHash != "" then outputHash else outputHash = if outputHash != "" then outputHash else
if sha256 != "" then sha256 else if sha1 != "" then sha1 else md5; if sha256 != "" then sha256 else if sha1 != "" then sha1 else md5;
outputHashMode = if recursiveHash then "recursive" else "flat"; outputHashMode = if (recursiveHash || executable) then "recursive" else "flat";
inherit curlOpts showURLs mirrorsFile impureEnvVars postFetch downloadToTemp; inherit curlOpts showURLs mirrorsFile impureEnvVars postFetch downloadToTemp executable;
# Doing the download on a remote machine just duplicates network # Doing the download on a remote machine just duplicates network
# traffic, so don't do that. # traffic, so don't do that.