aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/install-with-disko19
1 files changed, 18 insertions, 1 deletions
diff --git a/scripts/install-with-disko b/scripts/install-with-disko
index 859a647..4a89676 100755
--- a/scripts/install-with-disko
+++ b/scripts/install-with-disko
@@ -28,10 +28,20 @@ if grep -q "data.keyfile" "${DIR}/../hosts/${TARGET_HOST}/disks.nix"; then
while true; do
echo -en "\n${TARGET_HOST} uses ZFS encryption. Enter a passphrase to encrypt your pool: "
read -s pass
- echo -e '\n'
+ echo
if [[ "${#pass}" -lt 8 ]]; then
echo 'ERROR! Passphrase must be at least 8 characters.' >&2
+ continue
+ fi
+
+ echo -n "Re-enter passphrase: "
+ read -s pass2
+ echo -e '\n'
+
+ if [[ "${pass}" != "${pass2}" ]]; then
+ echo 'ERROR! Passphrases must match.' >&2
+ continue
else
break
fi
@@ -65,4 +75,11 @@ if [[ "${REPLY}" == "y" ]]; then
sudo rsync -a --delete --exclude .git "${DIR}/.." /mnt/etc/nixos
cd /mnt/etc/nixos
sudo nixos-install --flake ".#${TARGET_HOST}"
+
+ if [[ "${?}" -eq 0 ]]; then
+ cd
+ mount | grep -v zfs | awk '$3 ~ /^\/mnt\// {print $3}' | xargs -i{} sudo umount -lf {}
+ while ! sudo umount -t zfs -a; do echo 'attempting to umount all ZFS file systems' >&2; sleep 1; done
+ while ! sudo zpool export -a; do echo 'attempting to export all zpools' >&2; sleep 1; done
+ fi
fi