mirror of
https://github.com/mtan93/Installomator.git
synced 2026-03-08 05:31:53 +00:00
changed variable names to match standards
This commit is contained in:
@@ -895,7 +895,7 @@ initNamedPipe() {
|
||||
mkfifo -m 644 $pipe
|
||||
;;
|
||||
"delete")
|
||||
# clean up
|
||||
# clean up
|
||||
rm $pipe
|
||||
;;
|
||||
*)
|
||||
@@ -907,7 +907,7 @@ readDownloadPipe() {
|
||||
# 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
|
||||
local pipe=$1
|
||||
local log=$2
|
||||
local log=${2:-$DIALOG_CMD_FILE}
|
||||
# set up read from pipe
|
||||
while IFS= read -k 1 -u 0 char; do
|
||||
[[ $char =~ [0-9] ]] && keep=1 ;
|
||||
@@ -936,20 +936,20 @@ killProcess() {
|
||||
|
||||
updateDialogProgress() {
|
||||
local progress=$1
|
||||
local log=$2
|
||||
local log=${2:-$DIALOG_CMD_FILE}
|
||||
echo "progress: $progress" >> $log
|
||||
}
|
||||
|
||||
updateDialogProgressText() {
|
||||
local message=$1
|
||||
local log=$2
|
||||
local log=${2:-$DIALOG_CMD_FILE}
|
||||
echo "progresstext: $message" >> $log
|
||||
}
|
||||
|
||||
launchDialog() {
|
||||
# launches a dialog window to display download and/or install progress.
|
||||
local name=$1
|
||||
local log=$2
|
||||
local log=${2:-$DIALOG_CMD_FILE}
|
||||
if [[ -z "$log" ]]; then
|
||||
log="/var/tmp/dialog.log"
|
||||
fi
|
||||
@@ -979,12 +979,12 @@ launchDialog() {
|
||||
|
||||
quitDialog() {
|
||||
# sends the quit command to dialog
|
||||
local log=$1
|
||||
local log=${1:-$DIALOG_CMD_FILE}
|
||||
echo "quit:" >> "$log"
|
||||
}
|
||||
|
||||
enableDialogButtonAndSetToDone() {
|
||||
local log=$1
|
||||
local log=${1:-$DIALOG_CMD_FILE}
|
||||
echo "button1text: Done" >> $log
|
||||
echo "button1: enable" >> $log
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ label="" # if no label is sent to the script, this will be used
|
||||
# 2020-2021 Installomator
|
||||
#
|
||||
# inspired by the download scripts from William Smith and Sander Schram
|
||||
#
|
||||
#
|
||||
# Contributers:
|
||||
# Armin Briegel - @scriptingosx
|
||||
# Isaac Ordonez - @issacatmann
|
||||
@@ -23,7 +23,7 @@ export PATH=/usr/bin:/bin:/usr/sbin:/sbin
|
||||
# set to 0 for production, 1 or 2 for debugging
|
||||
# while debugging, items will be downloaded to the parent directory of this script
|
||||
# also no actual installation will be performed
|
||||
# debug mode 1 will download to the directory the script is run in, but will not check the version
|
||||
# debug mode 1 will download to the directory the script is run in, but will not check the version
|
||||
# debug mode 2 will download to the temp directory, check for blocking processes, check the version, but will not install anything or remove the current version
|
||||
DEBUG=1
|
||||
|
||||
@@ -34,13 +34,6 @@ NOTIFY=success
|
||||
# - silent no notifications
|
||||
# - 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
|
||||
BLOCKING_PROCESS_ACTION=tell_user
|
||||
# options:
|
||||
@@ -144,6 +137,14 @@ IGNORE_DND_APPS=""
|
||||
# example that will ignore browsers when evaluating DND:
|
||||
# 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
|
||||
|
||||
@@ -190,7 +191,7 @@ IGNORE_DND_APPS=""
|
||||
# How we get version number from app. Possible values:
|
||||
# - CFBundleShortVersionString
|
||||
# - CFBundleVersion
|
||||
# Not all software titles uses fields the same.
|
||||
# Not all software titles uses fields the same.
|
||||
# See Opera label.
|
||||
#
|
||||
# - appCustomVersion(){}: (optional function)
|
||||
|
||||
@@ -195,21 +195,23 @@ else
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ $SHOWPROGRESS == "yes" ]]; then
|
||||
if [[ $DIALOG_PROGRESS == "yes" ]]; then
|
||||
# pipe
|
||||
pipe="/tmp/dlpipe"
|
||||
# initialise named pipe for curl output
|
||||
initNamedPipe create $pipe
|
||||
|
||||
|
||||
# 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)
|
||||
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
|
||||
curlDownloadStatus=$(echo $pipestatus[1])
|
||||
killProcess $downloadPipePID
|
||||
@@ -220,7 +222,7 @@ else
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user