From ba36595f4f604c4d90959a06eb48507b10b3aeb0 Mon Sep 17 00:00:00 2001 From: Santiago Lo Coco Date: Mon, 27 Dec 2021 20:00:52 -0300 Subject: [PATCH] Add dynamic height calculation for dialog boxes with long text --- install.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/install.sh b/install.sh index c70e8c9..c964a57 100755 --- a/install.sh +++ b/install.sh @@ -30,7 +30,14 @@ updateSystemClock() { exitIfCancel() { if [ $? -eq 1 ]; then - whiptail --msgbox "${1} Therefore, the installation process will stop, but you can continue where you left off by running:\n\nsh CocoASAIS" 0 0 + str="${1} Therefore, the installation process will stop, but you can continue where you left off by running:\n\nsh CocoASAIS" + newlines=$(printf $str | grep -c $'\n') + chars=$(echo $str | wc -c) + height=$(echo "$chars" "$newlines" | awk '{ + x = (($1 - $2 + ($2 * 60)) / 60) + printf "%d", (x == int(x)) ? x : int(x) + 1 + }') + whiptail --msgbox "$str" $height 60 echo "${2}" > CocoASAIS.log exit 1 fi