Merge pull request #641 from scriptingosx/swiftdialog

swiftDialog Integration
This commit is contained in:
Armin Briegel
2022-08-12 16:35:40 +02:00
committed by GitHub
10 changed files with 713 additions and 10 deletions
+28 -2
View File
@@ -168,6 +168,8 @@ fi
# MARK: check if this is an Update and we can use updateTool
if [[ (-n $appversion && -n "$updateTool") || "$type" == "updateronly" ]]; then
printlog "appversion & updateTool"
updateDialog "wait" "Updating..."
if [[ $DEBUG -ne 1 ]]; then
if runUpdateTool; then
finishing
@@ -194,8 +196,28 @@ else
displaynotification "Downloading new $name" "Download in progress …"
fi
fi
curlDownload=$(curl -v -fsL --show-error ${curlOptions} "$downloadURL" -o "$archiveName" 2>&1)
curlDownloadStatus=$(echo $?)
if [[ $DIALOG_CMD_FILE != "" ]]; then
# pipe
pipe="$tmpDir/downloadpipe"
# initialise named pipe for curl output
initNamedPipe create $pipe
# run the pipe read in the background
readDownloadPipe $pipe "$DIALOG_CMD_FILE" & downloadPipePID=$!
printlog "listening to output of curl with pipe $pipe and command file $DIALOG_CMD_FILE on PID $downloadPipePID" DEBUG
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
curlDownloadStatus=$(echo $pipestatus[1])
killProcess $downloadPipePID
else
printlog "No Dialog connection, just download" DEBUG
curlDownload=$(curl -v -fsL --show-error ${curlOptions} "$downloadURL" -o "$archiveName" 2>&1)
curlDownloadStatus=$(echo $?)
fi
deduplicatelogs "$curlDownload"
if [[ $curlDownloadStatus -ne 0 ]]; then
#if ! curl --location --fail --silent "$downloadURL" -o "$archiveName"; then
@@ -237,8 +259,10 @@ if [[ $currentUser != "loginwindow" && $NOTIFY == "all" ]]; then
printlog "notifying"
if [[ $updateDetected == "YES" ]]; then
displaynotification "Updating $name" "Installation in progress …"
updateDialog "wait" "Updating..."
else
displaynotification "Installing $name" "Installation in progress …"
updateDialog "wait" "Installing..."
fi
fi
@@ -275,6 +299,8 @@ case $type in
;;
esac
updateDialog "wait" "Finishing..."
# MARK: Finishing — print installed application location and version
finishing