Edited disk config logic
This commit is contained in:
@@ -41,4 +41,4 @@
|
||||
type = "xfs";
|
||||
label = "data-storage";
|
||||
mountpoint = "/mnt/data-storage";
|
||||
};
|
||||
|
||||
|
||||
@@ -392,13 +392,11 @@ The mirror will be created using the size of the smaller disk, and any extra spa
|
||||
gum confirm "Do you want to proceed anyway?" || { echo " ❌ Aborting as requested."; exit 1; }
|
||||
fi
|
||||
|
||||
mv ./nix-config/disks/snapraid.nix ./nix-config/disks/snapraid.original
|
||||
sed -i 's| ./disks/snapraid.nix|# ./disks/snapraid.nix|' ./nix-config/configuration.nix
|
||||
|
||||
export CONTENT_DISK_1=${DISK_BY_ID_MAP[${selected_data_names[0]}]}
|
||||
export PARITY_DISK_1=${DISK_BY_ID_MAP[${selected_data_names[1]}]}
|
||||
export CONTENT_DISK_1_KEY_VAR="CONTENT_DISK_1_KEY"
|
||||
export PARITY_DISK_1_KEY_VAR="PARITY_DISK_1_KEY"
|
||||
export CONTENT_DISK_1_KEY=${!CONTENT_DISK_1_KEY_VAR}
|
||||
export PARITY_DISK_1_KEY=${!PARITY_DISK_1_KEY_VAR}
|
||||
(envsubst < "config-files/disks/mirror.nix") >> ./nix-config/disks/disko.nix
|
||||
NUMBER_OF_CONTENT_DISKS=1 # For summary and key generation
|
||||
NUMBER_OF_PARITY_DISKS=1
|
||||
|
||||
@@ -477,6 +475,10 @@ EOF
|
||||
(envsubst < "$template_file") > ./nix-config/disks/disko.nix
|
||||
echo -e "\n ✅ Generated boot disk configuration."
|
||||
|
||||
if (( NUMBER_OF_CONTENT_DISKS == 1 && NUMBER_OF_PARITY_DISKS == 1 )); then
|
||||
(envsubst < "config-files/disks/data-mirror.nix") >> ./nix-config/disks/disko.nix
|
||||
fi
|
||||
|
||||
if (( NUMBER_OF_CONTENT_DISKS != 2 )); then
|
||||
for i in $(seq 1 $NUMBER_OF_CONTENT_DISKS); do
|
||||
disk_var="CONTENT_DISK_$i"
|
||||
@@ -505,7 +507,7 @@ EOF
|
||||
|
||||
# --> Generate automatic unlock configuration in ./nix-config/disks/snapraid.nix
|
||||
if [[ "$NUMBER_OF_CONTENT_DISKS" -gt 0 || "$NUMBER_OF_PARITY_DISKS" -gt 0 ]]; then
|
||||
echo -e "\n\n ✅ Generating automatic disk unlocking configuration..."
|
||||
echo -e "\n ✅ Generating automatic disk unlocking configuration..."
|
||||
sed -i '$ d' ./nix-config/disks/snapraid.nix
|
||||
|
||||
cat <<EOF >> ./nix-config/disks/snapraid.nix
|
||||
|
||||
Reference in New Issue
Block a user