Skip to content

Commit d00e5ee

Browse files
committed
make-disk-image: pre/post-format-files copies content of source path
1 parent 8fd2d6c commit d00e5ee

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

docs/disko-images.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,15 +71,15 @@ In the this example we create a flake containing a nixos configuration for
7171

7272
Options:
7373
* --pre-format-files <src> <dst>
74-
copies the src to the dst on the VM, before disko is run
74+
copies the content of path <src> to path <dst> on the VM, before disko is run
7575
This is useful to provide secrets like LUKS keys, or other files you need for formatting
7676
* --post-format-files <src> <dst>
77-
copies the src to the dst on the finished image
77+
copies the content of path <src> to path <dst> on the finished image
7878
These end up in the images later and is useful if you want to add some extra stateful files
7979
They will have the same permissions but will be owned by root:root
8080
* --build-memory <amt>
8181
specify the amount of memory in MiB that gets allocated to the build VM
82-
This can be useful if you want to build images with a more involed NixOS config
82+
This can be useful if you want to build images with a more involved NixOS config
8383
The default is 1024 MiB
8484
```
8585

lib/make-disk-image.nix

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -179,15 +179,15 @@ in
179179
180180
Options:
181181
* --pre-format-files <src> <dst>
182-
copies the src to the dst on the VM, before disko is run
182+
copies the content of path <src> to path <dst> on the VM, before disko is run
183183
This is useful to provide secrets like LUKS keys, or other files you need for formatting
184184
* --post-format-files <src> <dst>
185-
copies the src to the dst on the finished image
185+
copies the content of path <src> to path <dst> on the finished image
186186
These end up in the images later and is useful if you want to add some extra stateful files
187187
They will have the same permissions but will be owned by root:root
188188
* --build-memory <amt>
189189
specify the amount of memory in MiB that gets allocated to the build VM
190-
This can be useful if you want to build images with a more involed NixOS config
190+
This can be useful if you want to build images with a more involved NixOS config
191191
The default is disko.memSize which defaults to ${builtins.toString options.disko.memSize.default} MiB
192192
USAGE
193193
}
@@ -207,13 +207,13 @@ in
207207
--pre-format-files)
208208
src=$2
209209
dst=$3
210-
cp --reflink=auto -r "$src" copy_before_disko/"$(echo "$dst" | base64)"
210+
cp --reflink=auto -rv "$src" copy_before_disko/"$(echo "$dst" | base64)"
211211
shift 2
212212
;;
213213
--post-format-files)
214214
src=$2
215215
dst=$3
216-
cp --reflink=auto -r "$src" copy_after_disko/"$(echo "$dst" | base64)"
216+
cp --reflink=auto -rv "$src" copy_after_disko/"$(echo "$dst" | base64)"
217217
shift 2
218218
;;
219219
--build-memory)
@@ -243,17 +243,17 @@ in
243243
for src in /tmp/xchg/copy_before_disko/*; do
244244
[ -e "$src" ] || continue
245245
dst=$(basename "$src" | base64 -d)
246-
mkdir -p "$(dirname "$dst")"
247-
cp -r "$src" "$dst"
246+
mkdir -p "$dst"
247+
cp -rv "$src"/. "$dst"
248248
done
249249
set -f
250250
${partitioner}
251251
set +f
252252
for src in /tmp/xchg/copy_after_disko/*; do
253253
[ -e "$src" ] || continue
254254
dst=/mnt/$(basename "$src" | base64 -d)
255-
mkdir -p "$(dirname "$dst")"
256-
cp -r "$src" "$dst"
255+
mkdir -p "$dst"
256+
cp -rv "$src"/. "$dst"
257257
done
258258
${installer}
259259
''}

0 commit comments

Comments
 (0)