mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-09-25 06:38:22 +03:00
dockerTools.streamLayeredImage: add fakeRootCommands option
This commit is contained in:
parent
3ee1fb4f09
commit
b4d92811be
@ -7,6 +7,7 @@
|
||||
coreutils,
|
||||
docker,
|
||||
e2fsprogs,
|
||||
fakeroot,
|
||||
findutils,
|
||||
go,
|
||||
jq,
|
||||
@ -738,6 +739,9 @@ rec {
|
||||
created ? "1970-01-01T00:00:01Z",
|
||||
# Optional bash script to run on the files prior to fixturizing the layer.
|
||||
extraCommands ? "",
|
||||
# Optional bash script to run inside fakeroot environment.
|
||||
# Could be used for changing ownership of files in customisation layer.
|
||||
fakeRootCommands ? "",
|
||||
# We pick 100 to ensure there is plenty of room for extension. I
|
||||
# believe the actual maximum is 128.
|
||||
maxLayers ? 100
|
||||
@ -764,18 +768,24 @@ rec {
|
||||
name = "${baseName}-customisation-layer";
|
||||
paths = contentsList;
|
||||
inherit extraCommands;
|
||||
inherit fakeRootCommands;
|
||||
nativeBuildInputs = [ fakeroot ];
|
||||
postBuild = ''
|
||||
mv $out old_out
|
||||
(cd old_out; eval "$extraCommands" )
|
||||
|
||||
mkdir $out
|
||||
|
||||
tar \
|
||||
--sort name \
|
||||
--owner 0 --group 0 --mtime "@$SOURCE_DATE_EPOCH" \
|
||||
--hard-dereference \
|
||||
-C old_out \
|
||||
-cf $out/layer.tar .
|
||||
fakeroot bash -c '
|
||||
set -e
|
||||
cd old_out
|
||||
eval "$fakeRootCommands"
|
||||
tar \
|
||||
--sort name \
|
||||
--numeric-owner --mtime "@$SOURCE_DATE_EPOCH" \
|
||||
--hard-dereference \
|
||||
-cf $out/layer.tar .
|
||||
'
|
||||
|
||||
sha256sum $out/layer.tar \
|
||||
| cut -f 1 -d ' ' \
|
||||
|
Loading…
Reference in New Issue
Block a user