dockerTools: fixes extraCommands for mkRootLayer.
The extraCommands was, previously, simply put in the body of the script using nix expansion `${extraCommands}` (which looks exactly like bash expansion!). This causes issues like in #34779 where scripts will eventually create invalid bash. The solution is to use a script like `run-as-root`. * * * Fixes #34779
This commit is contained in:
parent
090b7cc8f1
commit
60737bd319
1 changed files with 4 additions and 2 deletions
|
@ -360,7 +360,9 @@ rec {
|
|||
extraCommands ? ""
|
||||
}:
|
||||
# Generate an executable script from the `runAsRoot` text.
|
||||
let runAsRootScript = shellScript "run-as-root.sh" runAsRoot;
|
||||
let
|
||||
runAsRootScript = shellScript "run-as-root.sh" runAsRoot;
|
||||
extraCommandsScript = shellScript "extra-commands.sh" extraCommands;
|
||||
in runWithOverlay {
|
||||
name = "docker-layer-${name}";
|
||||
|
||||
|
@ -398,7 +400,7 @@ rec {
|
|||
'';
|
||||
|
||||
postUmount = ''
|
||||
(cd layer; eval "${extraCommands}")
|
||||
(cd layer; ${extraCommandsScript})
|
||||
|
||||
echo "Packing layer..."
|
||||
mkdir $out
|
||||
|
|
Loading…
Reference in a new issue