mirror of
https://github.com/mtan93/Installomator.git
synced 2026-03-08 21:02:46 +00:00
changed variable names to match standards
This commit is contained in:
@@ -895,7 +895,7 @@ initNamedPipe() {
|
|||||||
mkfifo -m 644 $pipe
|
mkfifo -m 644 $pipe
|
||||||
;;
|
;;
|
||||||
"delete")
|
"delete")
|
||||||
# clean up
|
# clean up
|
||||||
rm $pipe
|
rm $pipe
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
@@ -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
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ label="" # if no label is sent to the script, this will be used
|
|||||||
# 2020-2021 Installomator
|
# 2020-2021 Installomator
|
||||||
#
|
#
|
||||||
# inspired by the download scripts from William Smith and Sander Schram
|
# inspired by the download scripts from William Smith and Sander Schram
|
||||||
#
|
#
|
||||||
# Contributers:
|
# Contributers:
|
||||||
# Armin Briegel - @scriptingosx
|
# Armin Briegel - @scriptingosx
|
||||||
# Isaac Ordonez - @issacatmann
|
# 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
|
# set to 0 for production, 1 or 2 for debugging
|
||||||
# while debugging, items will be downloaded to the parent directory of this script
|
# while debugging, items will be downloaded to the parent directory of this script
|
||||||
# also no actual installation will be performed
|
# 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 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
|
DEBUG=1
|
||||||
|
|
||||||
@@ -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
|
||||||
|
|
||||||
@@ -190,7 +191,7 @@ IGNORE_DND_APPS=""
|
|||||||
# How we get version number from app. Possible values:
|
# How we get version number from app. Possible values:
|
||||||
# - CFBundleShortVersionString
|
# - CFBundleShortVersionString
|
||||||
# - CFBundleVersion
|
# - CFBundleVersion
|
||||||
# Not all software titles uses fields the same.
|
# Not all software titles uses fields the same.
|
||||||
# See Opera label.
|
# See Opera label.
|
||||||
#
|
#
|
||||||
# - appCustomVersion(){}: (optional function)
|
# - appCustomVersion(){}: (optional function)
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -220,7 +222,7 @@ else
|
|||||||
curlDownload=$(curl -v -fsL --show-error ${curlOptions} "$downloadURL" -o "$archiveName" 2>&1)
|
curlDownload=$(curl -v -fsL --show-error ${curlOptions} "$downloadURL" -o "$archiveName" 2>&1)
|
||||||
curlDownloadStatus=$(echo $?)
|
curlDownloadStatus=$(echo $?)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
deduplicatelogs "$curlDownload"
|
deduplicatelogs "$curlDownload"
|
||||||
if [[ $curlDownloadStatus -ne 0 ]]; then
|
if [[ $curlDownloadStatus -ne 0 ]]; then
|
||||||
#if ! curl --location --fail --silent "$downloadURL" -o "$archiveName"; then
|
#if ! curl --location --fail --silent "$downloadURL" -o "$archiveName"; then
|
||||||
|
|||||||
Reference in New Issue
Block a user