change pass creation funcs to new repeating method

changes functions prompting the user to create passwords to use the new method for repeating questions from f281da1. also changed the message given after choosing the default locale to be shorter/more accurate.
This commit is contained in:
i-c-u-p 2022-04-29 12:12:50 +00:00
parent 4c5ea199c4
commit c07aee4269
No known key found for this signature in database
GPG key ID: ABB80C12170FC0D1

View file

@ -119,56 +119,53 @@ network_installer () {
# User enters a password for the LUKS Container (function). # User enters a password for the LUKS Container (function).
lukspass_selector () { lukspass_selector () {
while true; do read -r -s -p "Insert password for the LUKS container (you're not going to see the password): " password
read -r -s -p "Insert password for the LUKS container (you're not going to see the password): " password if [ -z "$password" ]; then
while [ -z "$password" ]; do incEcho "\nYou need to enter a password for the LUKS Container in order to continue."
echo return 1
incEcho "You need to enter a password for the LUKS Container in order to continue." fi
read -r -s -p "Insert password for the LUKS container (you're not going to see the password): " password echo
[ -n "$password" ] && break read -r -s -p "Password (again): " password2
done echo
echo if [ "$password" != "$password2" ]; then
read -r -s -p "Password (again): " password2
echo
[ "$password" = "$password2" ] && break
incEcho "Passwords don't match, try again." incEcho "Passwords don't match, try again."
done return 1
fi
return 0
} }
# User enters a password for the user account (function). # User enters a password for the user account (function).
userpass_selector () { userpass_selector () {
while true; do read -r -s -p "Set a user password for $username: " userpass
read -r -s -p "Set a user password for $username: " userpass if [ -z "$userpass" ]; then
while [ -z "$userpass" ]; do incEcho "\nYou need to enter a password for $username."
echo return 1
incEcho "You need to enter a password for $username." fi
read -r -s -p "Set a user password for $username: " userpass echo
[ -n "$userpass" ] && break read -r -s -p "Insert password again: " userpass2
done echo
echo if [ "$userpass" != "$userpass2" ]; then
read -r -s -p "Insert password again: " userpass2
echo
[ "$userpass" = "$userpass2" ] && break
incEcho "Passwords don't match, try again." incEcho "Passwords don't match, try again."
done return 1
fi
return 0
} }
# User enters a password for the root account (function). # User enters a password for the root account (function).
rootpass_selector () { rootpass_selector () {
while true; do read -r -s -p "Set a root password: " rootpass
read -r -s -p "Set a root password: " rootpass if [ -z "$rootpass" ]; then
while [ -z "$rootpass" ]; do incEcho "\nYou need to enter a root password."
echo return 1
incEcho "You need to enter a root password." fi
read -r -s -p "Set a root password: " rootpass echo
[ -n "$rootpass" ] && break read -r -s -p "Password (again): " rootpass2
done echo
echo if [ "$rootpass" != "$rootpass2" ]; then
read -r -s -p "Password (again): " rootpass2
echo
[ "$rootpass" = "$rootpass2" ] && break
incEcho "Passwords don't match, try again." incEcho "Passwords don't match, try again."
done return 1
fi
return 0
} }
# Microcode detector (function). # Microcode detector (function).
@ -197,7 +194,7 @@ hostname_selector () {
locale_selector () { locale_selector () {
read -r -p "Please insert the locale you use (format: xx_XX. Enter empty to use en_US, or \"/\" to search locales): " locale read -r -p "Please insert the locale you use (format: xx_XX. Enter empty to use en_US, or \"/\" to search locales): " locale
case $locale in case $locale in
'') print "en_US will be used as default locale." '') print "en_US.UTF-8 will be the default locale."
locale="en_US.UTF-8";; locale="en_US.UTF-8";;
'/') sed -E '/^# +|^#$/d;s/^#| *$//g;s/ .*/ (Charset:&)/' /etc/locale.gen | less -M '/') sed -E '/^# +|^#$/d;s/^#| *$//g;s/ .*/ (Charset:&)/' /etc/locale.gen | less -M
clear clear
@ -255,7 +252,7 @@ if ! [[ "$disk_response" =~ ^(yes|y)$ ]]; then
fi fi
# Setting up LUKS password. # Setting up LUKS password.
lukspass_selector until lukspass_selector; do : ; done
# Setting up the kernel. # Setting up the kernel.
until kernel_selector; do : ; done until kernel_selector; do : ; done
@ -271,8 +268,8 @@ until hostname_selector; do : ; done
# User chooses username. # User chooses username.
read -r -p "Please enter name for a user account (enter empty to not create one): " username read -r -p "Please enter name for a user account (enter empty to not create one): " username
userpass_selector until userpass_selector; do : ; done
rootpass_selector until rootpass_selector; do : ; done
# Deleting old partition scheme. # Deleting old partition scheme.
print "Wiping $DISK." print "Wiping $DISK."