From 84f0f4327db59e301518e547206a001562804693 Mon Sep 17 00:00:00 2001 From: Pogobanane Date: Mon, 6 Feb 2023 21:06:24 +0100 Subject: [PATCH 1/3] nixos-remote: add --skip-disko flag --- README.md | 2 ++ src/nixos-anywhere.sh | 13 +++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 98eb9360..85e9f321 100644 --- a/README.md +++ b/README.md @@ -64,6 +64,8 @@ Options: do not reboot after installation, allowing further customization of the target installation. * --kexec url use another kexec tarball to bootstrap NixOS +* --skip-disko + dont format disks with disko * --stop-after-disko exit after disko formating, you can then proceed to install manually or some other way * --extra-files files diff --git a/src/nixos-anywhere.sh b/src/nixos-anywhere.sh index a3a7f967..9151e3e6 100755 --- a/src/nixos-anywhere.sh +++ b/src/nixos-anywhere.sh @@ -15,6 +15,8 @@ Options: do not reboot after installation, allowing further customization of the target installation. * --kexec url use another kexec tarball to bootstrap NixOS +* --skip-disko + dont format disks with disko * --stop-after-disko exit after disko formating, you can then proceed to install manually or some other way * --extra-files files @@ -89,6 +91,9 @@ while [[ $# -gt 0 ]]; do shift shift ;; + --skip-disko) + skip_disko=y + ;; --stop-after-disko) stop_after_disko=y ;; @@ -293,8 +298,12 @@ for path in "${!disk_encryption_keys[@]}"; do ssh_ "umask 077; cat > $path" <"${disk_encryption_keys[$path]}" done -nix_copy --to "ssh://$ssh_connection" "$disko_script" -ssh_ "$disko_script" +if [[ ${skip_disko} == "y" ]]; then + echo "Skipping disko (partitioning)." +else + nix_copy --to "ssh://$ssh_connection" "$disko_script" + ssh_ "$disko_script" +fi if [[ ${stop_after_disko-n} == "y" ]]; then # Should we also do this for `--no-reboot`? From c1251e3b874c4fd94e2de86da838c9e015161d31 Mon Sep 17 00:00:00 2001 From: Pogobanane Date: Wed, 20 Sep 2023 11:12:56 +0200 Subject: [PATCH 2/3] disko: mount, even when skipping reformatting disks --- src/nixos-anywhere.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/nixos-anywhere.sh b/src/nixos-anywhere.sh index 9151e3e6..065282e1 100755 --- a/src/nixos-anywhere.sh +++ b/src/nixos-anywhere.sh @@ -298,10 +298,11 @@ for path in "${!disk_encryption_keys[@]}"; do ssh_ "umask 077; cat > $path" <"${disk_encryption_keys[$path]}" done +nix_copy --to "ssh://$ssh_connection" "$disko_script" if [[ ${skip_disko} == "y" ]]; then - echo "Skipping disko (partitioning)." + echo "Skipping disko partitioning (only do mount)." + ssh_ "$disko_script -m mount" else - nix_copy --to "ssh://$ssh_connection" "$disko_script" ssh_ "$disko_script" fi From e32566b1a3e4ad4847dce3ce551854e8a47ec806 Mon Sep 17 00:00:00 2001 From: Pogobanane Date: Wed, 20 Sep 2023 11:22:11 +0200 Subject: [PATCH 3/3] nixos-anywhere: rename --skip-disko to --skip-reformat --- README.md | 4 ++-- src/nixos-anywhere.sh | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 85e9f321..40e20b0f 100644 --- a/README.md +++ b/README.md @@ -64,8 +64,8 @@ Options: do not reboot after installation, allowing further customization of the target installation. * --kexec url use another kexec tarball to bootstrap NixOS -* --skip-disko - dont format disks with disko +* --skip-reformat + dont format disks with disko (only mount) * --stop-after-disko exit after disko formating, you can then proceed to install manually or some other way * --extra-files files diff --git a/src/nixos-anywhere.sh b/src/nixos-anywhere.sh index 065282e1..48a129b4 100755 --- a/src/nixos-anywhere.sh +++ b/src/nixos-anywhere.sh @@ -15,8 +15,8 @@ Options: do not reboot after installation, allowing further customization of the target installation. * --kexec url use another kexec tarball to bootstrap NixOS -* --skip-disko - dont format disks with disko +* --skip-reformat + dont format disks with disko (only mount) * --stop-after-disko exit after disko formating, you can then proceed to install manually or some other way * --extra-files files @@ -91,8 +91,8 @@ while [[ $# -gt 0 ]]; do shift shift ;; - --skip-disko) - skip_disko=y + --skip-reformat) + skip_reformat=y ;; --stop-after-disko) stop_after_disko=y @@ -299,7 +299,7 @@ for path in "${!disk_encryption_keys[@]}"; do done nix_copy --to "ssh://$ssh_connection" "$disko_script" -if [[ ${skip_disko} == "y" ]]; then +if [[ ${skip_reformat} == "y" ]]; then echo "Skipping disko partitioning (only do mount)." ssh_ "$disko_script -m mount" else