summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbill-auger <mr.j.spam.me@gmail.com>2022-08-14 23:43:42 -0400
committerbill-auger <mr.j.spam.me@gmail.com>2022-08-17 06:37:00 -0400
commit8f2fd91ea09d908d1060620bab037a6e14984b8d (patch)
tree88c2e86c10a230bfa4e1a517ea1d80dc6b2db641
parenta1fb7a16bcf0e6003aae7684cda4556ae45f829f (diff)
dialog tweaks
-rwxr-xr-xinstall.sh10
-rw-r--r--session-common.sh.inc22
2 files changed, 17 insertions, 15 deletions
diff --git a/install.sh b/install.sh
index d883692..c1e1d54 100755
--- a/install.sh
+++ b/install.sh
@@ -89,9 +89,11 @@ Init()
# detect isorepo and internet
local has_isorepo=$( [[ -d /isorepo && -f /etc/pacman-offline.conf ]] && echo 1 || echo 0 )
local is_online
- ( set -o pipefail
- [[ "$( ${CURL_CMD[@]} )" == 200 ]] | \
- WizardDlg "" --progressbox "${TR[online-${Lang}]} ...." 8 56
+ ( # display fake progress-bar while curl is fetching
+ set -o pipefail
+ [[ "$( ${CURL_CMD[@]} )" == 200 ]] |
+ ( while (( t < 99 )) && sleep 0.1 ; do echo $((++t)) ; done ; ) |
+ WizardDlg "" --gauge "${TR[online-${Lang}]} ...." 0 70
) && is_online=$(( ! $? )) || is_online=$(( ! $? ))
# setup state to prompt for online or offline install, as appropriate;
@@ -434,7 +436,7 @@ NoticeReady()
then ready_msg+="\n\n\Z1${TR[ready_warn-${Lang}]}\Zn\n\n * $(GetStateVar 'DEVICE')"
fi
- (( $( WizardDlg "${TR[dlg_ready-${Lang}]}" --yesno "${ready_msg}" 8 56 ) )) || exit
+ (( $( WizardDlg "${TR[dlg_ready-${Lang}]}" --yesno "${ready_msg}" 0 0 ) )) || exit
}
_PartitionAuto()
diff --git a/session-common.sh.inc b/session-common.sh.inc
index ae75bf8..4bc82e2 100644
--- a/session-common.sh.inc
+++ b/session-common.sh.inc
@@ -156,21 +156,22 @@ InitDlg() # (title prompt default_option options*)
}
# dialog prompts for install.sh
-WizardDlg() # (title box_type boxargs* options*)
+WizardDlg() # ("title" box_type "boxargs"* options*)
{
local title="$1"
local dialog_type=$2
local boxargs_and_options=("${@:3}")
+ local opts=( $( [[ "${dialog_type}" == '--progressbox' ]] ||
+ [[ "${dialog_type}" == '--infobox' ]] || echo '--erase-on-exit' ) )
local result
local status
result=$( DIALOG_ESC=${CANCEL_STATUS} \
dialog --stdout --insecure --sleep 1 \
- --colors --erase-on-exit \
- --backtitle "${TR[wizard-${Lang}]}" \
- --title "${title}" \
+ --colors ${opts[*]} \
+ --backtitle "${TR[wizard-${Lang}]}" \
+ --title "${title}" \
${dialog_type} "${boxargs_and_options[@]}" ) && status=$? || status=$?
- #clear >&2
# NOTE: a failure on the following LOC, indicates a bug in the caller code
(( ! status || status == CANCEL_STATUS ))
@@ -190,9 +191,10 @@ WizardDlg() # (title box_type boxargs* options*)
elif [[ "${dialog_type}" == '--checklist' ]]
then (( status != CANCEL_STATUS )) && echo "${result}" || echo ${CANCEL_SENTINEL}
- elif [[ "${dialog_type}" == '--msgbox' ]] ||
- [[ "${dialog_type}" == '--progressbox' ]] ||
- [[ "${dialog_type}" == '--textbox' ]]
+ elif [[ "${dialog_type}" == '--infobox' ]] ||
+ [[ "${dialog_type}" == '--gauge' ]] ||
+ [[ "${dialog_type}" == '--msgbox' ]] ||
+ [[ "${dialog_type}" == '--progressbox' ]]
then echo ''
else echo "unhandled dialog_type: ${dialog_type}" >&2
@@ -205,9 +207,7 @@ WizardDlg() # (title box_type boxargs* options*)
ExitFail() # ("exit_msg")
{
- echo "$@" > "${THIS_DIR}"/exit-fail.txt
- WizardDlg "${TR[exit_fail-${Lang}]}" --textbox "${THIS_DIR}"/exit-fail.txt 8 56
- rm "${THIS_DIR}"/exit-fail.txt
+ WizardDlg "${TR[exit_fail-${Lang}]}" --infobox "$(echo -e $@)" 0 0
exit
}