Improved logging

Overall purpose was to improve the logging in the scripts. But the handling of macOS version and Installomator version in order to utilize swiftDialog has been improved, too.
This commit is contained in:
Theile
2022-10-24 12:38:46 +02:00
parent 2362e8a9d0
commit e22a7754bd
14 changed files with 62 additions and 32 deletions

View File

@@ -5,6 +5,10 @@
LOGO="" # "mosyleb", "mosylem", "addigy", "microsoft", "ws1"
# Have the label been submittet in a PR for Installomator?
# What version of Installomator is it expected to be included in?
# Version 10.0
item="gfxcardstatus" # enter the software to install (if it has a label in future version of Installomator)
# Label variables below
@@ -104,9 +108,10 @@ installomatorOptions="BLOCKING_PROCESS_ACTION=prompt_user DIALOG_CMD_FILE=${dial
# INSTALL=force
######################################################################
# To be used as a script sent out from a MDM.
# Fill the variable "item" above with a label.
# Fill out the label variables above, and those will be included in the Installomator call, circa on line 248
# Script will run this label through Installomator.
######################################################################
# v. 10.0.3 : A bit more logging on succes, and change in ending Dialog part.
# v. 10.0.2 : Improved icon checks and failovers
# v. 10.0.1 : github-functions added. Improved appIcon handling. Can add the app to Dock using dockutil.
# v. 10.0 : Integration with Dialog and Installomator v. 10
@@ -119,6 +124,10 @@ export PATH=/usr/bin:/bin:/usr/sbin:/sbin
echo "$(date +%F\ %T) [LOG-BEGIN] $item"
if [[ -z "$item" ]]; then
item="$name"
fi
dialogUpdate() {
# $1: dialog command
local dcommand="$1"
@@ -176,7 +185,7 @@ caffexit () {
# Mark: Installation begins
installomatorVersion="$(${destFile} version | cut -d "." -f1 || true)"
if [[ $installomatorVersion -lt 10 ]] || [[ $(sw_vers -buildVersion) < "20A" ]]; then
if [[ $installomatorVersion -lt 10 ]] || [[ $(sw_vers -buildVersion | cut -c1-2) -lt 20 ]]; then
echo "Skipping swiftDialog UI, using notifications."
#echo "Installomator should be at least version 10 to support swiftDialog. Installed version $installomatorVersion."
#echo "And macOS 11 Big Sur (build 20A) is required for swiftDialog. Installed build $(sw_vers -buildVersion)."
@@ -323,7 +332,7 @@ else
fi
# Mark: Ending
if [[ $installomatorVersion -ge 10 ]] && [[ $(sw_vers -buildVersion) >= "20" ]]; then
if [[ $installomatorVersion -ge 10 && $(sw_vers -buildVersion | cut -c1-2) -ge 20 ]]; then
# close and quit dialog
dialogUpdate "progress: complete"
dialogUpdate "progresstext: Done"

View File

@@ -5,10 +5,14 @@
LOGO="" # "mosyleb", "mosylem", "addigy", "microsoft", "ws1"
# Have the label been submittet in a PR for Installomator?
# What version of Installomator is it expected to be included in?
# Version 10.0
item="clickshare" # enter the software to install (if it has a label in future version of Installomator)
# Variables for label
name="ClickShare" # Spaces in the name will not work
name="ClickShare" # If spaces in the name, fill out "${name}" in Installomator-call below, circa line 249. Spaces should be escaped in that line.
type="appInDmgInZip"
packageID=""
downloadURL="https://www.barco.com$( curl -fs "https://www.barco.com/en/clickshare/app" | grep -A6 -i "macos" | grep -i "FileNumber" | tr '"' "\n" | grep -i "FileNumber" )"
@@ -50,9 +54,10 @@ installomatorOptions="BLOCKING_PROCESS_ACTION=prompt_user DIALOG_CMD_FILE=${dial
# INSTALL=force
######################################################################
# To be used as a script sent out from a MDM.
# Fill the variable "item" above with a label.
# Fill out the label variables above, and those will be included in the Installomator call, circa on line 248
# Script will run this label through Installomator.
######################################################################
# v. 10.0.3 : A bit more logging on succes, and change in ending Dialog part.
# v. 10.0.2 : Improved icon checks and failovers
# v. 10.0.1 : Improved appIcon handling. Can add the app to Dock using dockutil
# v. 10.0 : Integration with Dialog and Installomator v. 10
@@ -126,7 +131,7 @@ caffexit () {
# Mark: Installation begins
installomatorVersion="$(${destFile} version | cut -d "." -f1 || true)"
if [[ $installomatorVersion -lt 10 ]] || [[ $(sw_vers -buildVersion) < "20A" ]]; then
if [[ $installomatorVersion -lt 10 ]] || [[ $(sw_vers -buildVersion | cut -c1-2) -lt 20 ]]; then
echo "Skipping swiftDialog UI, using notifications."
#echo "Installomator should be at least version 10 to support swiftDialog. Installed version $installomatorVersion."
#echo "And macOS 11 Big Sur (build 20A) is required for swiftDialog. Installed build $(sw_vers -buildVersion)."
@@ -245,7 +250,7 @@ fi
# Install software using Installomator with valuesfromarguments
cmdOutput="$(${destFile} valuesfromarguments LOGO=$LOGO \
name=${name} \
name=\"${name}\" \
type=${type} \
packageID=${packageID} \
downloadURL=\"$downloadURL\" \
@@ -273,7 +278,7 @@ else
fi
# Mark: Ending
if [[ $installomatorVersion -ge 10 ]] && [[ $(sw_vers -buildVersion) >= "20" ]]; then
if [[ $installomatorVersion -ge 10 && $(sw_vers -buildVersion | cut -c1-2) -ge 20 ]]; then
# close and quit dialog
dialogUpdate "progress: complete"
dialogUpdate "progresstext: Done"

View File

@@ -45,6 +45,7 @@ installomatorOptions="BLOCKING_PROCESS_ACTION=tell_user_then_quit DIALOG_CMD_FIL
# Fill the variable "item" above with a label.
# Script will run this label through Installomator.
######################################################################
# v. 10.0.3 : A bit more logging on succes, and change in ending Dialog part.
# v. 10.0.2 : Improved icon checks and failovers
# v. 10.0.1 : Improved appIcon handling. Can add the app to Dock using dockutil
# v. 10.0 : Integration with Dialog and Installomator v. 10
@@ -114,7 +115,7 @@ caffexit () {
# Mark: Installation begins
installomatorVersion="$(${destFile} version | cut -d "." -f1 || true)"
if [[ $installomatorVersion -lt 10 ]] || [[ $(sw_vers -buildVersion) < "20A" ]]; then
if [[ $installomatorVersion -lt 10 ]] || [[ $(sw_vers -buildVersion | cut -c1-2) -lt 20 ]]; then
echo "Skipping swiftDialog UI, using notifications."
#echo "Installomator should be at least version 10 to support swiftDialog. Installed version $installomatorVersion."
#echo "And macOS 11 Big Sur (build 20A) is required for swiftDialog. Installed build $(sw_vers -buildVersion)."
@@ -252,7 +253,7 @@ else
fi
# Mark: Ending
if [[ $installomatorVersion -ge 10 ]] && [[ $(sw_vers -buildVersion) >= "20" ]]; then
if [[ $installomatorVersion -ge 10 && $(sw_vers -buildVersion | cut -c1-2) -ge 20 ]]; then
# close and quit dialog
dialogUpdate "progress: complete"
dialogUpdate "progresstext: Done"

View File

@@ -45,6 +45,7 @@ installomatorOptions="BLOCKING_PROCESS_ACTION=prompt_user DIALOG_CMD_FILE=${dial
# Fill the variable "item" above with a label.
# Script will run this label through Installomator.
######################################################################
# v. 10.0.3 : A bit more logging on succes, and change in ending Dialog part.
# v. 10.0.2 : Improved icon checks and failovers
# v. 10.0.1 : Improved appIcon handling. Can add the app to Dock using dockutil
# v. 10.0 : Integration with Dialog and Installomator v. 10
@@ -114,7 +115,7 @@ caffexit () {
# Mark: Installation begins
installomatorVersion="$(${destFile} version | cut -d "." -f1 || true)"
if [[ $installomatorVersion -lt 10 ]] || [[ $(sw_vers -buildVersion) < "20A" ]]; then
if [[ $installomatorVersion -lt 10 ]] || [[ $(sw_vers -buildVersion | cut -c1-2) -lt 20 ]]; then
echo "Skipping swiftDialog UI, using notifications."
#echo "Installomator should be at least version 10 to support swiftDialog. Installed version $installomatorVersion."
#echo "And macOS 11 Big Sur (build 20A) is required for swiftDialog. Installed build $(sw_vers -buildVersion)."
@@ -255,7 +256,7 @@ else
fi
# Mark: Ending
if [[ $installomatorVersion -ge 10 ]] && [[ $(sw_vers -buildVersion) >= "20" ]]; then
iif [[ $installomatorVersion -ge 10 && $(sw_vers -buildVersion | cut -c1-2) -ge 20 ]]; then
# close and quit dialog
dialogUpdate "progress: complete"
dialogUpdate "progresstext: Done"

View File

@@ -42,6 +42,7 @@ installomatorOptions="BLOCKING_PROCESS_ACTION=prompt_user DIALOG_CMD_FILE=${dial
# Fill the variable "item" above with a label.
# Script will run this label through Installomator.
######################################################################
# v. 10.0.3 : A bit more logging on succes, and change in ending Dialog part.
# v. 10.0.2 : Improved icon checks and failovers
# v. 10.0.1 : Improved appIcon handling. Can add the app to Dock using dockutil
# v. 10.0 : Integration with Dialog and Installomator v. 10
@@ -111,7 +112,7 @@ caffexit () {
# Mark: Installation begins
installomatorVersion="$(${destFile} version | cut -d "." -f1 || true)"
if [[ $installomatorVersion -lt 10 ]] || [[ $(sw_vers -buildVersion) < "20A" ]]; then
if [[ $installomatorVersion -lt 10 ]] || [[ $(sw_vers -buildVersion | cut -c1-2) -lt 20 ]]; then
echo "Skipping swiftDialog UI, using notifications."
#echo "Installomator should be at least version 10 to support swiftDialog. Installed version $installomatorVersion."
#echo "And macOS 11 Big Sur (build 20A) is required for swiftDialog. Installed build $(sw_vers -buildVersion)."
@@ -249,7 +250,7 @@ else
fi
# Mark: Ending
if [[ $installomatorVersion -ge 10 ]] && [[ $(sw_vers -buildVersion) >= "20" ]]; then
if [[ $installomatorVersion -ge 10 && $(sw_vers -buildVersion | cut -c1-2) -ge 20 ]]; then
# close and quit dialog
dialogUpdate "progress: complete"
dialogUpdate "progresstext: Done"

View File

@@ -45,6 +45,7 @@ installomatorOptions="BLOCKING_PROCESS_ACTION=ignore NOTIFY=silent DIALOG_CMD_FI
# Fill the variable "item" above with a label.
# Script will run this label through Installomator.
######################################################################
# v. 10.0.3 : A bit more logging on succes, and change in ending Dialog part.
# v. 10.0.2 : Improved icon checks and failovers
# v. 10.0.1 : Can add the app to Dock using dockutil
# v. 10.0 : Integration with Dialog and Installomator v. 10
@@ -114,7 +115,7 @@ caffexit () {
# Mark: Installation begins
installomatorVersion="$(${destFile} version | cut -d "." -f1 || true)"
if [[ $installomatorVersion -lt 10 ]] || [[ $(sw_vers -buildVersion) < "20A" ]]; then
if [[ $installomatorVersion -lt 10 ]] || [[ $(sw_vers -buildVersion | cut -c1-2) -lt 20 ]]; then
echo "Skipping swiftDialog UI, using notifications."
#echo "Installomator should be at least version 10 to support swiftDialog. Installed version $installomatorVersion."
#echo "And macOS 11 Big Sur (build 20A) is required for swiftDialog. Installed build $(sw_vers -buildVersion)."
@@ -252,7 +253,7 @@ else
fi
# Mark: Ending
if [[ $installomatorVersion -ge 10 ]] && [[ $(sw_vers -buildVersion) >= "20" ]]; then
if [[ $installomatorVersion -ge 10 && $(sw_vers -buildVersion | cut -c1-2) -ge 20 ]]; then
# close and quit dialog
dialogUpdate "progress: complete"
dialogUpdate "progresstext: Done"

View File

@@ -5,10 +5,14 @@
LOGO="" # "mosyleb", "mosylem", "addigy", "microsoft", "ws1"
#item="" # enter the software to install (if it has a label in future version of Installomator)
# Have the label been submittet in a PR for Installomator?
# What version of Installomator is it expected to be included in?
# Version 10
item="" # enter the software to install (if it has a label in future version of Installomator)
# Variables for label
name="ClickShare"
name="ClickShare" # Spaces in the name will not work
type="appInDmgInZip"
packageID=""
downloadURL="https://www.barco.com$( curl -fs "https://www.barco.com/en/clickshare/app" | grep -A6 -i "macos" | grep -i "FileNumber" | tr '"' "\n" | grep -i "FileNumber" )"
@@ -40,6 +44,7 @@ installomatorOptions="BLOCKING_PROCESS_ACTION=prompt_user LOGGING=INFO NOTIFY=al
# Fill the variable "what" above with a label.
# Script will run this label through Installomator.
######################################################################
# v. 9.2.2 : A bit more logging on succes.
# v. 9.2.1 : Better logging handling and installomatorOptions fix.
######################################################################
@@ -84,8 +89,8 @@ cmdOutput="$(${destFile} valuesfromarguments LOGO=$LOGO \
exitStatus="$( echo "${cmdOutput}" | grep --binary-files=text -i "exit" | tail -1 | sed -E 's/.*exit code ([0-9]).*/\1/g' || true )"
if [[ ${exitStatus} -eq 0 ]] ; then
echo "${what} succesfully installed."
warnOutput="$( echo "${cmdOutput}" | grep --binary-files=text -i "warn" || true )"
echo "$warnOutput"
selectedOutput="$( echo "${cmdOutput}" | grep --binary-files=text -E ": (REQ|ERROR|WARN)" || true )"
echo "$selectedOutput"
else
echo "ERROR installing ${what}. Exit code ${exitStatus}"
echo "$cmdOutput"

View File

@@ -31,6 +31,7 @@ installomatorOptions="BLOCKING_PROCESS_ACTION=tell_user_then_quit" # Separated b
# Fill the variable "item" above with a label.
# Script will run this label through Installomator.
######################################################################
# v. 9.2.2 : A bit more logging on succes.
# v. 9.2.1 : Better logging handling and installomatorOptions fix.
######################################################################

View File

@@ -31,6 +31,7 @@ installomatorOptions="BLOCKING_PROCESS_ACTION=tell_user_then_quit NOTIFY=all" #
# Fill the variable "what" above with a label.
# Script will run this label through Installomator.
######################################################################
# v. 9.2.2 : A bit more logging on succes.
# v. 9.2.1 : Better logging handling and installomatorOptions fix.
######################################################################
@@ -65,8 +66,8 @@ cmdOutput="$(${destFile} ${what} LOGO=$LOGO ${installomatorOptions} || true)"
exitStatus="$( echo "${cmdOutput}" | grep --binary-files=text -i "exit" | tail -1 | sed -E 's/.*exit code ([0-9]).*/\1/g' || true )"
if [[ ${exitStatus} -eq 0 ]] ; then
echo "${what} succesfully installed."
warnOutput="$( echo "${cmdOutput}" | grep --binary-files=text -i "warn" || true )"
echo "$warnOutput"
selectedOutput="$( echo "${cmdOutput}" | grep --binary-files=text -E ": (REQ|ERROR|WARN)" || true )"
echo "$selectedOutput"
else
echo "ERROR installing ${what}. Exit code ${exitStatus}"
echo "$cmdOutput"

View File

@@ -31,6 +31,7 @@ installomatorOptions="BLOCKING_PROCESS_ACTION=tell_user" # Separated by space
# Fill the variable "item" above with a label.
# Script will run this label through Installomator.
######################################################################
# v. 9.2.2 : A bit more logging on succes.
# v. 9.2.1 : Better logging handling and installomatorOptions fix.
######################################################################
@@ -65,8 +66,8 @@ cmdOutput="$(${destFile} ${item} LOGO=$LOGO ${installomatorOptions} || true)"
exitStatus="$( echo "${cmdOutput}" | grep --binary-files=text -i "exit" | tail -1 | sed -E 's/.*exit code ([0-9]).*/\1/g' || true )"
if [[ ${exitStatus} -eq 0 ]] ; then
echo "${item} succesfully installed."
warnOutput="$( echo "${cmdOutput}" | grep --binary-files=text -i "warn" || true )"
echo "$warnOutput"
selectedOutput="$( echo "${cmdOutput}" | grep --binary-files=text -E ": (REQ|ERROR|WARN)" || true )"
echo "$selectedOutput"
else
echo "ERROR installing ${item}. Exit code ${exitStatus}"
echo "$cmdOutput"

View File

@@ -32,6 +32,7 @@ installomatorOptions="BLOCKING_PROCESS_ACTION=prompt_user NOTIFY=all" # Separate
# Fill the variable "item" above with a label.
# Script will run this label through Installomator.
######################################################################
# v. 9.2.2 : A bit more logging on succes.
# v. 9.2.1 : Better logging handling and installomatorOptions fix.
######################################################################
@@ -66,8 +67,8 @@ cmdOutput="$(${destFile} ${item} LOGO=$LOGO ${installomatorOptions} || true)"
exitStatus="$( echo "${cmdOutput}" | grep --binary-files=text -i "exit" | tail -1 | sed -E 's/.*exit code ([0-9]).*/\1/g' || true )"
if [[ ${exitStatus} -eq 0 ]] ; then
echo "${item} succesfully installed."
warnOutput="$( echo "${cmdOutput}" | grep --binary-files=text -i "warn" || true )"
echo "$warnOutput"
selectedOutput="$( echo "${cmdOutput}" | grep --binary-files=text -E ": (REQ|ERROR|WARN)" || true )"
echo "$selectedOutput"
else
echo "ERROR installing ${item}. Exit code ${exitStatus}"
echo "$cmdOutput"

View File

@@ -31,6 +31,7 @@ installomatorOptions="BLOCKING_PROCESS_ACTION=ignore NOTIFY=silent" # Separated
# Fill the variable "item" above with a label.
# Script will run this label through Installomator.
######################################################################
# v. 9.2.2 : A bit more logging on succes.
# v. 9.2.1 : Better logging handling and installomatorOptions fix.
######################################################################
@@ -65,8 +66,8 @@ cmdOutput="$(${destFile} ${item} LOGO=$LOGO ${installomatorOptions} || true)"
exitStatus="$( echo "${cmdOutput}" | grep --binary-files=text -i "exit" | tail -1 | sed -E 's/.*exit code ([0-9]).*/\1/g' || true )"
if [[ ${exitStatus} -eq 0 ]] ; then
echo "${item} succesfully installed."
warnOutput="$( echo "${cmdOutput}" | grep --binary-files=text -i "warn" || true )"
echo "$warnOutput"
selectedOutput="$( echo "${cmdOutput}" | grep --binary-files=text -E ": (REQ|ERROR|WARN)" || true )"
echo "$selectedOutput"
else
echo "ERROR installing ${item}. Exit code ${exitStatus}"
echo "$cmdOutput"

View File

@@ -33,6 +33,7 @@ installomatorOptions="BLOCKING_PROCESS_ACTION=tell_user_then_quit" # Separated b
# Fill the variable "item" above with a label.
# Script will run this label through Installomator.
######################################################################
# v. 9.2.2 : A bit more logging on succes.
# v. 9.2.1 : Better logging handling and installomatorOptions fix.
######################################################################
@@ -77,8 +78,8 @@ cmdOutput="$(${destFile} ${item} LOGO=$LOGO ${installomatorOptions} || true)"
exitStatus="$( echo "${cmdOutput}" | grep --binary-files=text -i "exit" | tail -1 | sed -E 's/.*exit code ([0-9]).*/\1/g' || true )"
if [[ ${exitStatus} -eq 0 ]] ; then
echo "${item} succesfully installed."
warnOutput="$( echo "${cmdOutput}" | grep --binary-files=text -i "warn" || true )"
echo "$warnOutput"
selectedOutput="$( echo "${cmdOutput}" | grep --binary-files=text -E ": (REQ|ERROR|WARN)" || true )"
echo "$selectedOutput"
else
echo "ERROR installing ${item}. Exit code ${exitStatus}"
echo "$cmdOutput"

View File

@@ -33,6 +33,7 @@ installomatorOptions="BLOCKING_PROCESS_ACTION=prompt_user" # Separated by space
# Fill the variable "item" above with a label.
# Script will run this label through Installomator.
######################################################################
# v. 9.2.2 : A bit more logging on succes.
# v. 9.2.1 : Better logging handling and installomatorOptions fix.
######################################################################
@@ -77,8 +78,8 @@ cmdOutput="$(${destFile} ${item} LOGO=$LOGO ${installomatorOptions} || true)"
exitStatus="$( echo "${cmdOutput}" | grep --binary-files=text -i "exit" | tail -1 | sed -E 's/.*exit code ([0-9]).*/\1/g' || true )"
if [[ ${exitStatus} -eq 0 ]] ; then
echo "${item} succesfully installed."
warnOutput="$( echo "${cmdOutput}" | grep --binary-files=text -i "warn" || true )"
echo "$warnOutput"
selectedOutput="$( echo "${cmdOutput}" | grep --binary-files=text -E ": (REQ|ERROR|WARN)" || true )"
echo "$selectedOutput"
else
echo "ERROR installing ${item}. Exit code ${exitStatus}"
echo "$cmdOutput"