changed variable names to match standards

This commit is contained in:
Armin Briegel
2022-07-29 15:20:22 +02:00
parent dfe9860848
commit ef3113a05f
3 changed files with 26 additions and 23 deletions

View File

@@ -907,7 +907,7 @@ readDownloadPipe() {
# reads from a previously created named pipe # reads from a previously created named pipe
# output from curl with --progress-bar. % downloaded is read in and then sent to the specified log file # output from curl with --progress-bar. % downloaded is read in and then sent to the specified log file
local pipe=$1 local pipe=$1
local log=$2 local log=${2:-$DIALOG_CMD_FILE}
# set up read from pipe # set up read from pipe
while IFS= read -k 1 -u 0 char; do while IFS= read -k 1 -u 0 char; do
[[ $char =~ [0-9] ]] && keep=1 ; [[ $char =~ [0-9] ]] && keep=1 ;
@@ -936,20 +936,20 @@ killProcess() {
updateDialogProgress() { updateDialogProgress() {
local progress=$1 local progress=$1
local log=$2 local log=${2:-$DIALOG_CMD_FILE}
echo "progress: $progress" >> $log echo "progress: $progress" >> $log
} }
updateDialogProgressText() { updateDialogProgressText() {
local message=$1 local message=$1
local log=$2 local log=${2:-$DIALOG_CMD_FILE}
echo "progresstext: $message" >> $log echo "progresstext: $message" >> $log
} }
launchDialog() { launchDialog() {
# launches a dialog window to display download and/or install progress. # launches a dialog window to display download and/or install progress.
local name=$1 local name=$1
local log=$2 local log=${2:-$DIALOG_CMD_FILE}
if [[ -z "$log" ]]; then if [[ -z "$log" ]]; then
log="/var/tmp/dialog.log" log="/var/tmp/dialog.log"
fi fi
@@ -979,12 +979,12 @@ launchDialog() {
quitDialog() { quitDialog() {
# sends the quit command to dialog # sends the quit command to dialog
local log=$1 local log=${1:-$DIALOG_CMD_FILE}
echo "quit:" >> "$log" echo "quit:" >> "$log"
} }
enableDialogButtonAndSetToDone() { enableDialogButtonAndSetToDone() {
local log=$1 local log=${1:-$DIALOG_CMD_FILE}
echo "button1text: Done" >> $log echo "button1text: Done" >> $log
echo "button1: enable" >> $log echo "button1: enable" >> $log
} }

View File

@@ -34,13 +34,6 @@ NOTIFY=success
# - silent no notifications # - silent no notifications
# - all all notifications (great for Self Service installation) # - all all notifications (great for Self Service installation)
# show swiftDialog window with download and install progress
SHOWPROGRESS="no"
# options:
# - no do not show download or install progress
# - yes show download or install progress
DIALOGCMDFILE="/var/tmp/dialog.log"
# behavior when blocking processes are found # behavior when blocking processes are found
BLOCKING_PROCESS_ACTION=tell_user BLOCKING_PROCESS_ACTION=tell_user
# options: # options:
@@ -144,6 +137,14 @@ IGNORE_DND_APPS=""
# example that will ignore browsers when evaluating DND: # example that will ignore browsers when evaluating DND:
# IGNORE_DND_APPS="firefox,Google Chrome,Safari,Microsoft Edge,Opera,Amphetamine,caffeinate" # IGNORE_DND_APPS="firefox,Google Chrome,Safari,Microsoft Edge,Opera,Amphetamine,caffeinate"
# show swiftDialog window with download and install progress
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"
# NOTE: How labels work # NOTE: How labels work

View File

@@ -195,21 +195,23 @@ else
fi fi
fi fi
if [[ $SHOWPROGRESS == "yes" ]]; then if [[ $DIALOG_PROGRESS == "yes" ]]; then
# pipe # pipe
pipe="/tmp/dlpipe" pipe="/tmp/dlpipe"
# 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" & readDownloadPipe $pipe "$DIALOGCMDFILE" & downloadPipePID=$!
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 # launch dialog
launchDialog "$name" "$DIALOGCMDFILE" & 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 "$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
curlDownloadStatus=$(echo $pipestatus[1]) curlDownloadStatus=$(echo $pipestatus[1])
killProcess $downloadPipePID killProcess $downloadPipePID