Add dynamic width calculation
This commit is contained in:
parent
00540a534d
commit
89930c09a3
18
install.sh
18
install.sh
|
@ -98,7 +98,7 @@ mountPart() {
|
||||||
}
|
}
|
||||||
|
|
||||||
installPackage() {
|
installPackage() {
|
||||||
whiptail --infobox "Installing '$1'." 7 40
|
calcWidthAndRun "whiptail --infobox "Installing '$1'." 7 WIDTH"
|
||||||
case ${2} in
|
case ${2} in
|
||||||
Y)
|
Y)
|
||||||
if [ -z $username ]; then
|
if [ -z $username ]; then
|
||||||
|
@ -183,15 +183,20 @@ networkConf() {
|
||||||
unset hostname
|
unset hostname
|
||||||
}
|
}
|
||||||
|
|
||||||
|
calcWidthAndRun() {
|
||||||
|
width=$(echo "$@" | grep -oP '(?<=").*?(?=")' | wc -c)
|
||||||
|
echo $(eval $(echo "$@" | sed "s/WIDTH/$((${width}+8))/g"))
|
||||||
|
}
|
||||||
|
|
||||||
askForPassword() {
|
askForPassword() {
|
||||||
password=$(whiptail --passwordbox "Now, enter the password for ${1}." 8 40 3>&1 1>&2 2>&3)
|
password=$(calcWidthAndRun "whiptail --passwordbox \"Now, enter the password for ${1}.\" 8 WIDTH 3>&1 1>&2 2>&3")
|
||||||
exitIfCancel "You must enter a password." "${2}"
|
exitIfCancel "You must enter a password." "${2}"
|
||||||
passwordRep=$(whiptail --passwordbox "Reenter password." 8 30 3>&1 1>&2 2>&3)
|
passwordRep=$(calcWidthAndRun "whiptail --passwordbox \"Reenter password.\" 8 WIDTH 3>&1 1>&2 2>&3")
|
||||||
exitIfCancel "You must enter a password." "${2}"
|
exitIfCancel "You must enter a password." "${2}"
|
||||||
while ! [ "$password" = "$passwordRep" ]; do
|
while ! [ "$password" = "$passwordRep" ]; do
|
||||||
password=$(whiptail --passwordbox "Passwords do not match! Please enter the password again." 8 65 3>&1 1>&2 2>&3)
|
password=$(calcWidthAndRun "whiptail --passwordbox \"Passwords do not match! Please enter the password again.\" 8 WIDTH 3>&1 1>&2 2>&3")
|
||||||
exitIfCancel "You must enter a password." "${2}"
|
exitIfCancel "You must enter a password." "${2}"
|
||||||
passwordRep=$(whiptail --passwordbox "Reenter password." 8 30 3>&1 1>&2 2>&3)
|
passwordRep=$(calcWidthAndRun "whiptail --passwordbox \"Reenter password.\" 8 WIDTH 3>&1 1>&2 2>&3")
|
||||||
exitIfCancel "You must enter a password." "${2}"
|
exitIfCancel "You must enter a password." "${2}"
|
||||||
done
|
done
|
||||||
unset passwordRep
|
unset passwordRep
|
||||||
|
@ -318,4 +323,5 @@ runScript() {
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
runScript
|
# runScript
|
||||||
|
askForPassword
|
||||||
|
|
Loading…
Reference in New Issue