Improved logging

This commit is contained in:
Theile
2022-10-21 14:01:59 +02:00
parent a7224fcbea
commit 2362e8a9d0
6 changed files with 57 additions and 66 deletions

View File

@@ -5,7 +5,7 @@
LOGO="" # "mosyleb", "mosylem", "addigy", "microsoft", "ws1"
#item="gfxcardstatus" # enter the software to install (if it has a label in future version of Installomator)
item="gfxcardstatus" # enter the software to install (if it has a label in future version of Installomator)
# Label variables below
@@ -129,19 +129,19 @@ dialogUpdate() {
fi
}
checkCmdOutput () {
# $1: cmdOutput
local cmdOutput="$1"
exitStatus="$( echo "${cmdOutput}" | grep --binary-files=text -i "exit" | tail -1 | sed -E 's/.*exit code ([0-9]).*/\1/g' || true )"
local checkOutput="$1"
exitStatus="$( echo "${checkOutput}" | 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."
selectedOutput="$( echo "${cmdOutput}" | grep --binary-files=text -E ": (REQ|ERROR|WARN)" || true )"
selectedOutput="$( echo "${checkOutput}" | grep --binary-files=text -E ": (REQ|ERROR|WARN)" || true )"
echo "$selectedOutput"
else
echo "ERROR installing ${item}. Exit code ${exitStatus}"
echo "$cmdOutput"
#errorOutput="$( echo "${cmdOutput}" | grep --binary-files=text -i "error" || true )"
echo "$checkOutput"
#errorOutput="$( echo "${checkOutput}" | grep --binary-files=text -i "error" || true )"
#echo "$errorOutput"
fi
#echo "$checkOutput"
}
# Check the currently logged in user
@@ -295,7 +295,7 @@ fi
# Install software using Installomator with valuesfromarguments
cmdOutput="$(${destFile} valuesfromarguments LOGO=$LOGO \
name=${name} \
name=\"${name}\" \
type=${type} \
packageID=${packageID} \
downloadURL=\"$downloadURL\" \
@@ -304,7 +304,7 @@ cmdOutput="$(${destFile} valuesfromarguments LOGO=$LOGO \
expectedTeamID=${expectedTeamID} \
${installomatorOptions} ${installomatorNotify} || true)"
checkCmdOutput $cmdOutput
checkCmdOutput "${cmdOutput}"
# Mark: dockutil stuff
if [[ $addToDock -eq 1 ]]; then
@@ -323,9 +323,7 @@ else
fi
# Mark: Ending
if [[ $installomatorVersion -lt 10 ]]; then
echo "Again skipping Dialog stuff."
else
if [[ $installomatorVersion -ge 10 ]] && [[ $(sw_vers -buildVersion) >= "20" ]]; then
# close and quit dialog
dialogUpdate "progress: complete"
dialogUpdate "progresstext: Done"