From d0d121bc1556d5b91d6a02931c7f158a4e5d7e80 Mon Sep 17 00:00:00 2001 From: Austin Horstman Date: Sun, 16 Jan 2022 15:18:59 -0600 Subject: [PATCH] Input validation on luks password, same as user password --- startup.sh | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/startup.sh b/startup.sh index 9ef9a36..76bf882 100644 --- a/startup.sh +++ b/startup.sh @@ -47,10 +47,22 @@ case $fs in 1) set_option FS btrfs;; 2) set_option FS ext4;; 3) -echo -ne "Please enter your luks password: " -read -s luks_password # read password without echo -set_option LUKS_PASSWORD $luks_password -set_option FS luks;; +while true; do + echo -ne "Please enter your luks password: \n" + read -s luks_password # read password without echo + + echo -ne "Please repeat your luks password: \n" + read -s luks_password2 # read password without echo + + if [ "$luks_password" = "$luks_password2" ]; then + set_option LUKS_PASSWORD $luks_password + set_option FS luks + break + else + echo -e "\nPasswords do not match. Please try again. \n" + fi +done +;; 0) exit ;; *) echo "Wrong option please select again"; filesystem;; esac