created swiftdialog_example.sh

This commit is contained in:
Armin Briegel
2022-07-29 18:47:28 +02:00
parent ef3113a05f
commit 0063c0e025
3 changed files with 14 additions and 17 deletions

View File

@@ -14,10 +14,10 @@ cleanupAndExit() { # $1 = exit code, $2 message, $3 level
printlog "Debugging enabled, Deleting tmpDir output was:\n$deleteTmpOut" DEBUG
fi
# If displaying progres, quit dialog
if [[ $SHOWPROGRESS == "yes" ]]; then
quitDialog "$DIALOGCMDFILE"
fi
# # If displaying progres, quit dialog
# if [[ $DIALOG_PROGRESS == "main" || $DIALOG_PROGRESS == "list" ]]; then
# quitDialog "$DIALOGCMDFILE"
# fi
# If we closed any processes, reopen the app again
reopenClosedProcess
@@ -829,10 +829,11 @@ runUpdateTool() {
finishing() {
printlog "Finishing..."
if [[ $SHOWPROGRESS == "yes" ]]; then
if [[ $DIALOG_PROGRESS == "main" || $DIALOG_PROGRESS == "list" ]]; then
updateDialogProgress "complete" "$DIALOGCMDFILE"
fi
sleep 10 # wait a moment to let spotlight catch up
sleep 5 # wait a moment to let spotlight catch up
getAppVersion
if [[ -z $appversion ]]; then
@@ -951,7 +952,7 @@ launchDialog() {
local name=$1
local log=${2:-$DIALOG_CMD_FILE}
if [[ -z "$log" ]]; then
log="/var/tmp/dialog.log"
log="/private/var/tmp/dialog.log"
fi
# check for laptop or desktop
#if /usr/bin/pmset -g batt | grep -iq "battery"; then

View File

@@ -141,8 +141,10 @@ IGNORE_DND_APPS=""
DIALOG_PROGRESS="no"
# options:
# - no do not show download or install progress (default)
# - yes show download or install progress
DIALOG_CMD_FILE="/var/tmp/dialog.log"
# - main show download or install progress in the main progress bar
# - list show download or install progress with each list item
# the `-list` option requires the DIALOG_LIST_INDEX to be set
DIALOG_CMD_FILE="/private/var/tmp/dialog.log"

View File

@@ -195,21 +195,15 @@ else
fi
fi
if [[ $DIALOG_PROGRESS == "yes" ]]; then
if [[ $DIALOG_PROGRESS == "main" || $DIALOG_PROGRESS == "list" ]]; then
# pipe
pipe="/tmp/dlpipe"
pipe="$tmpDir/downloadpipe"
# initialise named pipe for curl output
initNamedPipe create $pipe
# run the pipe read in the background
readDownloadPipe $pipe "$DIALOGCMDFILE" & downloadPipePID=$!
# TODO: this should _not_ be part of Installomator.
# Also there should be a check if DIALOG_PROGRESS is set but dialog is not installed
# launch dialog
launchDialog "$name" "$DIALOGCMDFILE" &
# curl (extract - line in "# MARK: download the archive" of Installomator.sh)
curlDownload=$(curl -fL -# --show-error ${curlOptions} "$downloadURL" -o "$archiveName" 2>&1 | tee $pipe)
# because we are tee-ing the output, we want the pipe status of the first command in the chain, not the most recent one