Cosmetics.

This commit is contained in:
Tommaso Chiti 2022-05-28 17:56:38 +02:00
parent 28021f29fe
commit 93c72be270

View file

@ -13,7 +13,7 @@ RESET='\e[0m'
# Pretty print (function). # Pretty print (function).
info_print () { info_print () {
echo -e "${BOLD}${BYELLOW}[ ${BGREEN}${BYELLOW} ] $1${RESET}" echo -e "${BOLD}${BGREEN}[ ${BYELLOW}${BGREEN} ] $1${RESET}"
} }
# Pretty print for input (function). # Pretty print for input (function).
@ -59,7 +59,8 @@ kernel_selector () {
info_print "2) Hardened: A security-focused Linux kernel" info_print "2) Hardened: A security-focused Linux kernel"
info_print "3) Longterm: Long-term support (LTS) Linux kernel" info_print "3) Longterm: Long-term support (LTS) Linux kernel"
info_print "4) Zen Kernel: A Linux kernel optimized for desktop usage" info_print "4) Zen Kernel: A Linux kernel optimized for desktop usage"
read -r -p "Please select the number of the corresponding kernel (e.g. 1): " kernel_choice input_print "Please select the number of the corresponding kernel (e.g. 1): "
read -r kernel_choice
case $kernel_choice in case $kernel_choice in
1 ) kernel="linux" 1 ) kernel="linux"
return 0;; return 0;;
@ -82,7 +83,8 @@ network_selector () {
info_print "3) wpa_supplicant: Utility with support for WEP and WPA/WPA2 (WiFi-only, DHCPCD will be automatically installed)" info_print "3) wpa_supplicant: Utility with support for WEP and WPA/WPA2 (WiFi-only, DHCPCD will be automatically installed)"
info_print "4) dhcpcd: Basic DHCP client (Ethernet connections or VMs)" info_print "4) dhcpcd: Basic DHCP client (Ethernet connections or VMs)"
info_print "5) I will do this on my own (only advanced users)" info_print "5) I will do this on my own (only advanced users)"
read -r -p "Please select the number of the corresponding networking utility (e.g. 1): " network_choice input_print "Please select the number of the corresponding networking utility (e.g. 1): "
read -r network_choice
if ! ((1 <= network_choice <= 5)); then if ! ((1 <= network_choice <= 5)); then
error_print "You did not enter a valid selection." error_print "You did not enter a valid selection."
return 1 return 1
@ -118,12 +120,14 @@ network_installer () {
# User enters a password for the LUKS Container (function). # User enters a password for the LUKS Container (function).
lukspass_selector () { lukspass_selector () {
read -r -s -p "Insert the password for the LUKS container (you're not going to see the password): " password input_print "Insert the password for the LUKS container (you're not going to see the password): "
read -r -s password
if [[ -z "$password" ]]; then if [[ -z "$password" ]]; then
error_print "\nYou need to enter a password for the LUKS Container in order to continue." error_print "\nYou need to enter a password for the LUKS Container in order to continue."
return 1 return 1
fi fi
read -r -s -p "Insert the password for the LUKS container again (you're not going to see the password): " password2 input_print "Insert the password for the LUKS container again (you're not going to see the password): "
read -r -s password2
if [[ "$password" != "$password2" ]]; then if [[ "$password" != "$password2" ]]; then
error_print "Passwords don't match, please try again." error_print "Passwords don't match, please try again."
return 1 return 1
@ -133,16 +137,19 @@ lukspass_selector () {
# Setting up a password for the user account (function). # Setting up a password for the user account (function).
userpass_selector () { userpass_selector () {
read -r -p "Please enter name for a user account (enter empty to not create one): " username input_print "Please enter name for a user account (enter empty to not create one): "
read -r username
if [[ -z "$username" ]]; then if [[ -z "$username" ]]; then
return 0 return 0
fi fi
read -r -s -p "Insert a user password for $username (you're not going to see the password): " userpass input_print "Insert a user password for $username (you're not going to see the password): "
read -r -s userpass
if [[ -z "$userpass" ]]; then if [[ -z "$userpass" ]]; then
error_print "You need to enter a password for $username in order to continue." error_print "You need to enter a password for $username in order to continue."
return 1 return 1
fi fi
read -r -s -p "Insert the password again (you're not going to see the password): " userpass2 input_print "Insert the password again (you're not going to see the password): "
read -r -s userpass2
if [[ "$userpass" != "$userpass2" ]]; then if [[ "$userpass" != "$userpass2" ]]; then
error_print "Passwords don't match, please try again." error_print "Passwords don't match, please try again."
return 1 return 1
@ -152,12 +159,14 @@ userpass_selector () {
# Setting up a password for the root account (function). # Setting up a password for the root account (function).
rootpass_selector () { rootpass_selector () {
read -r -s -p "Insert a user password for the root user (you're not going to see it): " rootpass input_print "Insert a user password for the root user (you're not going to see it): "
read -r -s rootpass
if [[ -z "$rootpass" ]]; then if [[ -z "$rootpass" ]]; then
error_print "You need to enter a root password." error_print "You need to enter a root password."
return 1 return 1
fi fi
read -r -s -p "Insert the password again (for double checking): " rootpass2 input_print "Insert the password again (for double checking): "
read -r -s rootpass2
if [[ "$rootpass" != "$rootpass2" ]]; then if [[ "$rootpass" != "$rootpass2" ]]; then
error_print "Passwords don't match, try again." error_print "Passwords don't match, try again."
return 1 return 1
@ -179,7 +188,8 @@ microcode_detector () {
# User enters a hostname (function). # User enters a hostname (function).
hostname_selector () { hostname_selector () {
read -r -p "Please enter the hostname: " hostname input_print "Please enter the hostname: "
read -r hostname
if [[ -z "$hostname" ]]; then if [[ -z "$hostname" ]]; then
error_print "You need to enter a hostname in order to continue." error_print "You need to enter a hostname in order to continue."
return 1 return 1
@ -208,7 +218,8 @@ locale_selector () {
# User chooses the console keyboard layout (function). # User chooses the console keyboard layout (function).
keyboard_selector () { keyboard_selector () {
read -r -p "Please insert the keyboard layout to use in console (enter empty to use US, or \"/\" to look up for keyboard layouts): " kblayout input_print "Please insert the keyboard layout to use in console (enter empty to use US, or \"/\" to look up for keyboard layouts): "
read -r kblayout
case "$kblayout" in case "$kblayout" in
'') kblayout="us" '') kblayout="us"
info_print "The standard US keyboard layout will be used." info_print "The standard US keyboard layout will be used."
@ -276,7 +287,7 @@ until rootpass_selector; do : ; done
error_print "This will delete the current partition table on $DISK once installation starts. Do you agree [y/N]?: " error_print "This will delete the current partition table on $DISK once installation starts. Do you agree [y/N]?: "
read -r disk_response read -r disk_response
if ! [[ "${disk_response,,}" =~ ^(yes|y)$ ]]; then if ! [[ "${disk_response,,}" =~ ^(yes|y)$ ]]; then
info_print "Quitting." error_print "Quitting."
exit exit
fi fi
info_print "Wiping $DISK." info_print "Wiping $DISK."