Skip to content

Commit bcb3f2a

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

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

docs/disko-images.md

Lines changed: 7 additions & 7 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
75-
This is useful to provide secrets like LUKS keys, or other files you need for formatting
74+
copies the content of path <src> to path <dst> on the VM, before disko is run.
75+
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
78-
These end up in the images later and is useful if you want to add some extra stateful files
79-
They will have the same permissions but will be owned by root:root
77+
copies the content of path <src> to path <dst> on the finished image.
78+
These end up in the images later and is useful if you want to add some extra stateful files.
79+
They will have the same permissions but will be owned by root:root .
8080
* --build-memory <amt>
81-
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
81+
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.
8383
The default is 1024 MiB
8484
```
8585

lib/make-disk-image.nix

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -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)