From 91073a50a3657a75e65d94f1121f584996cf00e4 Mon Sep 17 00:00:00 2001 From: Alexander Tomokhov Date: Thu, 28 Dec 2023 00:56:47 +0400 Subject: [PATCH] additional check for 2nd volume --- nixos-infect | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/nixos-infect b/nixos-infect index a1254fe..7cae9eb 100755 --- a/nixos-infect +++ b/nixos-infect @@ -32,19 +32,22 @@ genOptionalSsh() { EOF } -# TODO receive disk device from outside +# TODO receive disk device path from outside determine2ndDisk() { + local guess rootFsDev case "$PROVIDER" in hetzner) - echo "/dev/sdb" + guess="/dev/sdb" ;; digitalocean) - echo "/dev/sda" + guess="/dev/sda" ;; *) return 1 ;; esac + rootFsDev="$(findmnt -no source -T /)" + [[ -b "$guess" && "$guess" != "$rootFsDev" ]] && echo "$guess" } # Merge original userdata.json with deployment specific fields and print result.