fix crypt script (matching and passwd chk)

This commit is contained in:
Freya Murphy 2023-10-07 15:51:00 -04:00
parent d78d5fe4b3
commit 1c5c24cd96
No known key found for this signature in database
GPG key ID: 988032A5638EE799

View file

@ -10,10 +10,10 @@ PASSWORD_CONFIRM=""
EVENT "Setting up disk encryption with luks"
if [[ $DISK == sd* ]]; then
if [[ $DISK == "/dev/sd"* ]]; then
CRYPT_PARTITION="$DISK""2"
EFI_PARTITION="$DISK""1"
elif [[ $DISK == nvme** ]]; then
elif [[ $DISK == "/dev/nvme"* ]]; then
CRYPT_PARTITION="$DISK""p2"
EFI_PARTITION="$DISK""p1"
else
@ -24,7 +24,7 @@ fi
get_password() {
read -s -p "LUKS password: " PASSWORD
read -s -p "Confirm password: " PASSWORD_CONFIRM
if [ "$PASSWORD" == "$CONFIRM_PASSWORD" ]; then
if [ "$PASSWORD" == "$PASSWORD_CONFIRM" ]; then
exit 0
else
ERROR "Passwords do not match"
@ -39,7 +39,7 @@ EVENT "Setting up luks"
cryptsetup luksFormat --type luks1 "$CRYPT_PARTITION" <<EOF
YES
$PASSWORD
$CONFIRM_PASSWORD
$PASSWORD_CONFIRM
EOF
EVENT "Opening cryptroot"
@ -58,5 +58,5 @@ mkfs.vfat "-F32" "$EFI_PARTITION"
EVENT "Successfully setup efi vfat and luks"
echo "CRYPT_PARTITION=\"$CRYPT_PARTITION\"" > ./guix-env
echo "EFI_PARTITION=\"$EFI_PARTITION\"" > ./guix-env
echo "CRYPT_PARTITION=\"$CRYPT_PARTITION\"" >> ./guix-env
echo "EFI_PARTITION=\"$EFI_PARTITION\"" >> ./guix-env