mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-15 02:42:58 +00:00
Merge pull request #4229 from MichaIng/patch-3
Hardcode whiptail dimensions to 20 rows and 70 chars width
This commit is contained in:
commit
e393048488
1 changed files with 4 additions and 19 deletions
|
@ -94,24 +94,9 @@ if [ -z "${USER}" ]; then
|
||||||
USER="$(id -un)"
|
USER="$(id -un)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# whiptail dialog dimensions: 20 rows and 70 chars width assures to fit on small screens and is known to hold all content.
|
||||||
# Check if we are running on a real terminal and find the rows and columns
|
r=20
|
||||||
# If there is no real terminal, we will default to 80x24
|
c=70
|
||||||
if [ -t 0 ] ; then
|
|
||||||
screen_size=$(stty size)
|
|
||||||
else
|
|
||||||
screen_size="24 80"
|
|
||||||
fi
|
|
||||||
# Determine terminal rows and columns by parsing screen_size
|
|
||||||
printf -v rows '%d' "${screen_size%% *}"
|
|
||||||
printf -v columns '%d' "${screen_size##* }"
|
|
||||||
|
|
||||||
# Divide by two so the dialogs take up half of the screen, which looks nice.
|
|
||||||
r=$(( rows / 2 ))
|
|
||||||
c=$(( columns / 2 ))
|
|
||||||
# Unless the screen is tiny
|
|
||||||
r=$(( r < 20 ? 20 : r ))
|
|
||||||
c=$(( c < 70 ? 70 : c ))
|
|
||||||
|
|
||||||
######## Undocumented Flags. Shhh ########
|
######## Undocumented Flags. Shhh ########
|
||||||
# These are undocumented flags; some of which we can use when repairing an installation
|
# These are undocumented flags; some of which we can use when repairing an installation
|
||||||
|
@ -2056,7 +2041,7 @@ update_dialogs() {
|
||||||
strAdd="You will be updated to the latest version."
|
strAdd="You will be updated to the latest version."
|
||||||
fi
|
fi
|
||||||
opt2a="Reconfigure"
|
opt2a="Reconfigure"
|
||||||
opt2b="This will reset your Pi-hole and allow you to enter new settings."
|
opt2b="Resets Pi-hole and allows re-selecting settings."
|
||||||
|
|
||||||
# Display the information to the user
|
# Display the information to the user
|
||||||
UpdateCmd=$(whiptail --title "Existing Install Detected!" --menu "\\n\\nWe have detected an existing install.\\n\\nPlease choose from the following options: \\n($strAdd)" "${r}" "${c}" 2 \
|
UpdateCmd=$(whiptail --title "Existing Install Detected!" --menu "\\n\\nWe have detected an existing install.\\n\\nPlease choose from the following options: \\n($strAdd)" "${r}" "${c}" 2 \
|
||||||
|
|
Loading…
Reference in a new issue