Merge pull request #55003 from volth/patch-303

linkFarm: hacky quoting -> escapeShellArg
This commit is contained in:
Michael Raskin 2019-02-10 14:43:22 +00:00 committed by GitHub
commit f4a8ac84fc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -258,15 +258,17 @@ rec {
* Example: * Example:
* *
* # Symlinks hello path in store to current $out/hello * # Symlinks hello path in store to current $out/hello
* linkFarm "hello" entries = [ { name = "hello"; path = pkgs.hello; } ]; * linkFarm "hello" [ { name = "hello"; path = pkgs.hello; } ];
* *
*/ */
linkFarm = name: entries: runCommand name { preferLocalBuild = true; } linkFarm = name: entries: runCommand name { preferLocalBuild = true; allowSubstitutes = false; }
("mkdir -p $out; cd $out; \n" + ''mkdir -p $out
(lib.concatMapStrings (x: '' cd $out
mkdir -p "$(dirname '${x.name}')" ${lib.concatMapStrings (x: ''
ln -s '${x.path}' '${x.name}' mkdir -p "$(dirname ${lib.escapeShellArg x.name})"
'') entries)); ln -s ${lib.escapeShellArg x.path} ${lib.escapeShellArg x.name}
'') entries}
'';
/* Print an error message if the file with the specified name and /* Print an error message if the file with the specified name and