Skip to content

make-disk-image: pre/post-format-files copies content of source path #1079

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions docs/disko-images.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,15 @@ In the this example we create a flake containing a nixos configuration for

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

Expand Down
12 changes: 6 additions & 6 deletions lib/make-disk-image.nix
Original file line number Diff line number Diff line change
Expand Up @@ -207,13 +207,13 @@ in
--pre-format-files)
src=$2
dst=$3
cp --reflink=auto -r "$src" copy_before_disko/"$(echo "$dst" | base64)"
cp --reflink=auto -rv "$src" copy_before_disko/"$(echo "$dst" | base64)"
shift 2
;;
--post-format-files)
src=$2
dst=$3
cp --reflink=auto -r "$src" copy_after_disko/"$(echo "$dst" | base64)"
cp --reflink=auto -rv "$src" copy_after_disko/"$(echo "$dst" | base64)"
shift 2
;;
--build-memory)
Expand Down Expand Up @@ -243,17 +243,17 @@ in
for src in /tmp/xchg/copy_before_disko/*; do
[ -e "$src" ] || continue
dst=$(basename "$src" | base64 -d)
mkdir -p "$(dirname "$dst")"
cp -r "$src" "$dst"
mkdir -p "$dst"
cp -rv "$src"/. "$dst"
done
set -f
${partitioner}
set +f
for src in /tmp/xchg/copy_after_disko/*; do
[ -e "$src" ] || continue
dst=/mnt/$(basename "$src" | base64 -d)
mkdir -p "$(dirname "$dst")"
cp -r "$src" "$dst"
mkdir -p "$dst"
cp -rv "$src"/. "$dst"
done
${installer}
''}
Expand Down