updated userinfo with global function
This commit is contained in:
parent
81d413ac70
commit
9a11eac27f
28
startup.sh
28
startup.sh
|
|
@ -42,6 +42,21 @@ invalid_option() {
|
||||||
echo -ne "Please select a valid option: \n"
|
echo -ne "Please select a valid option: \n"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
set_password() {
|
||||||
|
# password helper function
|
||||||
|
# read password without echoing (-s)
|
||||||
|
read -prs "Please enter password: " PASSWORD1
|
||||||
|
echo -ne "\n"
|
||||||
|
read -prs "Please re-enter password: " PASSWORD2
|
||||||
|
echo -ne "\n"
|
||||||
|
if [ "$PASSWORD1" == "$PASSWORD2" ]; then
|
||||||
|
set_option "$1" "$PASSWORD1"
|
||||||
|
else
|
||||||
|
echo -ne "Passwords do not match \n"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# make a title
|
# make a title
|
||||||
title () {
|
title () {
|
||||||
echo -ne "\n"
|
echo -ne "\n"
|
||||||
|
|
@ -197,14 +212,13 @@ echo "DISK=$option" >> setup.conf
|
||||||
drivessd
|
drivessd
|
||||||
set_option DISK "$option"
|
set_option DISK "$option"
|
||||||
}
|
}
|
||||||
|
|
||||||
userinfo () {
|
userinfo () {
|
||||||
read -rp "Please enter your username: " username
|
read -pr "Please enter your username: " USERNAME
|
||||||
set_option USERNAME "${username,,} "# convert to lower case as in issue #109
|
set_option USERNAME "${USERNAME,,}" # convert to lower case as in issue #109
|
||||||
echo -ne "Please enter your password: \n"
|
set_password "PASSWORD"
|
||||||
read -rs password # read password without echo
|
read -pr "Please enter your hostname: " HOSTNAME
|
||||||
set_option PASSWORD "$password"
|
set_option HOSTNAME "$HOSTNAME"
|
||||||
read -rp "Please enter your hostname: " nameofmachine
|
|
||||||
set_option nameofmachine "$nameofmachine"
|
|
||||||
}
|
}
|
||||||
# More features in future
|
# More features in future
|
||||||
# language (){}
|
# language (){}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue