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
while [ -z "$password" ]; do if [ -z "$password" ]; then
echo incEcho "\nYou need to enter a password for the LUKS Container in order to continue."
incEcho "You need to enter a password for the LUKS Container in order to continue." return 1
read -r -s -p "Insert password for the LUKS container (you're not going to see the password): " password fi
[ -n "$password" ] && break
done
echo echo
read -r -s -p "Password (again): " password2 read -r -s -p "Password (again): " password2
echo echo
[ "$password" = "$password2" ] && break if [ "$password" != "$password2" ]; then
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
while [ -z "$userpass" ]; do if [ -z "$userpass" ]; then
echo incEcho "\nYou need to enter a password for $username."
incEcho "You need to enter a password for $username." return 1
read -r -s -p "Set a user password for $username: " userpass fi
[ -n "$userpass" ] && break
done
echo echo
read -r -s -p "Insert password again: " userpass2 read -r -s -p "Insert password again: " userpass2
echo echo
[ "$userpass" = "$userpass2" ] && break if [ "$userpass" != "$userpass2" ]; then
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
while [ -z "$rootpass" ]; do if [ -z "$rootpass" ]; then
echo incEcho "\nYou need to enter a root password."
incEcho "You need to enter a root password." return 1
read -r -s -p "Set a root password: " rootpass fi
[ -n "$rootpass" ] && break
done
echo echo
read -r -s -p "Password (again): " rootpass2 read -r -s -p "Password (again): " rootpass2
echo echo
[ "$rootpass" = "$rootpass2" ] && break if [ "$rootpass" != "$rootpass2" ]; then
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."