mirror of
https://github.com/mtan93/Installomator.git
synced 2026-03-08 21:02:46 +00:00
created swiftdialog_example.sh
This commit is contained in:
@@ -14,10 +14,10 @@ cleanupAndExit() { # $1 = exit code, $2 message, $3 level
|
|||||||
printlog "Debugging enabled, Deleting tmpDir output was:\n$deleteTmpOut" DEBUG
|
printlog "Debugging enabled, Deleting tmpDir output was:\n$deleteTmpOut" DEBUG
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If displaying progres, quit dialog
|
# # If displaying progres, quit dialog
|
||||||
if [[ $SHOWPROGRESS == "yes" ]]; then
|
# if [[ $DIALOG_PROGRESS == "main" || $DIALOG_PROGRESS == "list" ]]; then
|
||||||
quitDialog "$DIALOGCMDFILE"
|
# quitDialog "$DIALOGCMDFILE"
|
||||||
fi
|
# fi
|
||||||
|
|
||||||
# If we closed any processes, reopen the app again
|
# If we closed any processes, reopen the app again
|
||||||
reopenClosedProcess
|
reopenClosedProcess
|
||||||
@@ -829,10 +829,11 @@ runUpdateTool() {
|
|||||||
|
|
||||||
finishing() {
|
finishing() {
|
||||||
printlog "Finishing..."
|
printlog "Finishing..."
|
||||||
if [[ $SHOWPROGRESS == "yes" ]]; then
|
if [[ $DIALOG_PROGRESS == "main" || $DIALOG_PROGRESS == "list" ]]; then
|
||||||
updateDialogProgress "complete" "$DIALOGCMDFILE"
|
updateDialogProgress "complete" "$DIALOGCMDFILE"
|
||||||
fi
|
fi
|
||||||
sleep 10 # wait a moment to let spotlight catch up
|
|
||||||
|
sleep 5 # wait a moment to let spotlight catch up
|
||||||
getAppVersion
|
getAppVersion
|
||||||
|
|
||||||
if [[ -z $appversion ]]; then
|
if [[ -z $appversion ]]; then
|
||||||
@@ -951,7 +952,7 @@ launchDialog() {
|
|||||||
local name=$1
|
local name=$1
|
||||||
local log=${2:-$DIALOG_CMD_FILE}
|
local log=${2:-$DIALOG_CMD_FILE}
|
||||||
if [[ -z "$log" ]]; then
|
if [[ -z "$log" ]]; then
|
||||||
log="/var/tmp/dialog.log"
|
log="/private/var/tmp/dialog.log"
|
||||||
fi
|
fi
|
||||||
# check for laptop or desktop
|
# check for laptop or desktop
|
||||||
#if /usr/bin/pmset -g batt | grep -iq "battery"; then
|
#if /usr/bin/pmset -g batt | grep -iq "battery"; then
|
||||||
|
|||||||
@@ -141,8 +141,10 @@ IGNORE_DND_APPS=""
|
|||||||
DIALOG_PROGRESS="no"
|
DIALOG_PROGRESS="no"
|
||||||
# options:
|
# options:
|
||||||
# - no do not show download or install progress (default)
|
# - no do not show download or install progress (default)
|
||||||
# - yes show download or install progress
|
# - main show download or install progress in the main progress bar
|
||||||
DIALOG_CMD_FILE="/var/tmp/dialog.log"
|
# - 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"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -195,21 +195,15 @@ else
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $DIALOG_PROGRESS == "yes" ]]; then
|
if [[ $DIALOG_PROGRESS == "main" || $DIALOG_PROGRESS == "list" ]]; then
|
||||||
# pipe
|
# pipe
|
||||||
pipe="/tmp/dlpipe"
|
pipe="$tmpDir/downloadpipe"
|
||||||
# initialise named pipe for curl output
|
# initialise named pipe for curl output
|
||||||
initNamedPipe create $pipe
|
initNamedPipe create $pipe
|
||||||
|
|
||||||
# run the pipe read in the background
|
# run the pipe read in the background
|
||||||
readDownloadPipe $pipe "$DIALOGCMDFILE" & downloadPipePID=$!
|
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)
|
# curl (extract - line in "# MARK: download the archive" of Installomator.sh)
|
||||||
curlDownload=$(curl -fL -# --show-error ${curlOptions} "$downloadURL" -o "$archiveName" 2>&1 | tee $pipe)
|
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
|
# because we are tee-ing the output, we want the pipe status of the first command in the chain, not the most recent one
|
||||||
|
|||||||
Reference in New Issue
Block a user