mirror of
https://github.com/mtan93/Installomator.git
synced 2026-03-08 05:31:53 +00:00
CLIInstaller included
and a few other displaylog lines changed
This commit is contained in:
10
CHANGELOG.md
10
CHANGELOG.md
@@ -8,9 +8,15 @@
|
||||
- Added variable `SYSTEMOWNER` that is used when copying files when installing. Default `0` is to change owner of the app to the current user on the Mac, like this user was installing this app themselves. When using `1` we will put “root:wheel” on the app, which can be useful for shared machines.
|
||||
|
||||
Big changes to logging:
|
||||
- Logging levels as DEBUG 0 INFO 1 WARN 2 ERROR 3 REQ 4
|
||||
- Introducing variable `LOGGING`, that can be either of the logging levels
|
||||
- Logging levels:
|
||||
0: DEBUG Everything is logged
|
||||
1: INFO Normal logging behavior
|
||||
2: WARN
|
||||
3: ERROR
|
||||
4: REQ
|
||||
- External logging to Datadog
|
||||
- A function to shorten duplicate lines in installation logs
|
||||
- A function to shorten duplicate lines in installation logs or output of longer commands
|
||||
- Ability to extract install.log in the time when Installomator was running, if further investigations needs to be done to logs
|
||||
|
||||
## v8.0
|
||||
|
||||
@@ -415,7 +415,7 @@ reopenClosedProcess() {
|
||||
processuser=$(ps aux | grep -i "${appName}" | grep -vi "grep" | awk '{print $1}')
|
||||
printlog "Reopened ${appName} as $processuser"
|
||||
else
|
||||
printlog "App not closed, so no reopen."
|
||||
printlog "App not closed, so no reopen." DEBUG
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -434,12 +434,12 @@ installAppWithPath() { # $1: path to app to install in $targetDir
|
||||
appVerifyStatus=$(echo $?)
|
||||
teamID=$(echo $appVerify | awk '/origin=/ {print $NF }' | tr -d '()' )
|
||||
deduplicatelogs "$appVerify"
|
||||
printlog "Debugging enabled, App Verification output was: $logoutput" DEBUG
|
||||
|
||||
|
||||
if [[ $appVerifyStatus -ne 0 ]] ; then
|
||||
#if ! teamID=$(spctl -a -vv "$appPath" 2>&1 | awk '/origin=/ {print $NF }' | tr -d '()' ); then
|
||||
cleanupAndExit 4 "Error verifying $appPath error: $logoutput" ERROR
|
||||
fi
|
||||
printlog "Debugging enabled, App Verification output was: $logoutput" DEBUG
|
||||
printlog "Team ID matching: $teamID (expected: $expectedTeamID )" INFO
|
||||
|
||||
if [ "$expectedTeamID" != "$teamID" ]; then
|
||||
@@ -511,24 +511,24 @@ installAppWithPath() { # $1: path to app to install in $targetDir
|
||||
printlog "Changing owner to $currentUser"
|
||||
chown -R "$currentUser" "$targetDir/$appName"
|
||||
else
|
||||
printlog "No user logged in or SYSTEMOWNER=1, setting owner to root:wheel"
|
||||
printlog "No user logged in or SYSTEMOWNER=1, setting owner to root:wheel"
|
||||
chown -R root:wheel "$targetDir/$appName"
|
||||
fi
|
||||
|
||||
elif [[ ! -z $CLIInstaller ]]; then
|
||||
mountname=$(dirname $appPath)
|
||||
printlog "CLIInstaller exists, running installer command $mountname/$CLIInstaller $CLIArguments" #INFO
|
||||
printlog "CLIInstaller exists, running installer command $mountname/$CLIInstaller $CLIArguments" INFO
|
||||
|
||||
CLIoutput=$("$mountname/$CLIInstaller" "${CLIArguments[@]}" 2>&1)
|
||||
CLIstatus=$(echo $?)
|
||||
logoutput="$CLIoutput" # dedupliatelogs "$CLIoutput"
|
||||
dedupliatelogs "$CLIoutput"
|
||||
|
||||
if [ $CLIstatus -ne 0 ] ; then
|
||||
cleanupAndExit 3 "Error installing $mountname/$CLIInstaller $CLIArguments error:\n$logoutput" #ERROR
|
||||
cleanupAndExit 3 "Error installing $mountname/$CLIInstaller $CLIArguments error: $logoutput" ERROR
|
||||
else
|
||||
printlog "Succesfully ran $mountname/$CLIInstaller $CLIArguments"
|
||||
printlog "Succesfully ran $mountname/$CLIInstaller $CLIArguments" INFO
|
||||
fi
|
||||
printlog "Debugging enabled, update tool output was:\n$logoutput" #DEBUG
|
||||
printlog "Debugging enabled, update tool output was: $logoutput" DEBUG
|
||||
fi
|
||||
|
||||
}
|
||||
@@ -537,16 +537,22 @@ mountDMG() {
|
||||
# mount the dmg
|
||||
printlog "Mounting $tmpDir/$archiveName"
|
||||
# always pipe 'Y\n' in case the dmg requires an agreement
|
||||
if ! dmgmount=$(echo 'Y'$'\n' | hdiutil attach "$tmpDir/$archiveName" -nobrowse -readonly | tail -n 1 | cut -c 54- ); then
|
||||
cleanupAndExit 3 "Error mounting $tmpDir/$archiveName"
|
||||
dmgmountOut=$(echo 'Y'$'\n' | hdiutil attach "$tmpDir/$archiveName" -nobrowse -readonly )
|
||||
dmgmountStatus=$(echo $?)
|
||||
dmgmount=$(echo $dmgmountOut | tail -n 1 | cut -c 54- )
|
||||
printlog "dmgmountOut is $dmgmountOut" DEBUG
|
||||
deduplicatelogs "$dmgmountOut"
|
||||
|
||||
if [[ $dmgmountStatus -ne 0 ]] ; then
|
||||
#if ! dmgmount=$(echo 'Y'$'\n' | hdiutil attach "$tmpDir/$archiveName" -nobrowse -readonly | tail -n 1 | cut -c 54- ); then
|
||||
cleanupAndExit 3 "Error mounting $tmpDir/$archiveName error: $logoutput" ERROR
|
||||
fi
|
||||
|
||||
if [[ ! -e $dmgmount ]]; then
|
||||
printlog "Error mounting $tmpDir/$archiveName"
|
||||
cleanupAndExit 3
|
||||
cleanupAndExit 3 "Error accessing mountpoint for $tmpDir/$archiveName error: $logoutput" ERROR
|
||||
fi
|
||||
|
||||
printlog "Mounted: $dmgmount"
|
||||
printlog "Debugging enabled, installer output was: $logoutput" DEBUG
|
||||
|
||||
printlog "Mounted: $dmgmount" INFO
|
||||
}
|
||||
|
||||
installFromDMG() {
|
||||
@@ -562,7 +568,7 @@ installFromPKG() {
|
||||
spctlStatus=$(echo $?)
|
||||
printlog "spctlOut is $spctlOut" DEBUG
|
||||
teamID=$(echo $spctlOut | awk -F '(' '/origin=/ {print $2 }' | tr -d '()' )
|
||||
deduplicatelogs "$spctlOut" # Why this?
|
||||
deduplicatelogs "$spctlOut"
|
||||
|
||||
if [[ $spctlStatus -ne 0 ]] ; then
|
||||
#if ! spctlout=$(spctl -a -vv -t install "$archiveName" 2>&1 ); then
|
||||
@@ -636,7 +642,6 @@ installFromPKG() {
|
||||
if [ $pkginstallstatus -ne 0 ] ; then
|
||||
#if ! installer -pkg "$archiveName" -tgt "$targetDir" ; then
|
||||
cleanupAndExit 9 "Error installing $archiveName error: $logoutput" ERROR
|
||||
|
||||
fi
|
||||
printlog "Debugging enabled, installer output was: $logoutput" DEBUG
|
||||
}
|
||||
|
||||
@@ -255,7 +255,7 @@ MDMProfileName=""
|
||||
# - MDM Profile Addigy has this name on the profile
|
||||
# - Mosyle Corporation MDM Mosyle uses this name on the profile
|
||||
# From the LOGO variable we can know if Addigy og Mosyle is used, so if that variable
|
||||
# is either of these, and this variable is empty, then we can will auto detect this.
|
||||
# is either of these, and this variable is empty, then we will auto detect this.
|
||||
|
||||
# Datadog logging used
|
||||
datadogAPI=""
|
||||
|
||||
@@ -172,7 +172,7 @@ if [ -f "$archiveName" ] && [ "$DEBUG" -eq 1 ]; then
|
||||
printlog "$archiveName exists and DEBUG mode 1 enabled, skipping download"
|
||||
else
|
||||
# download the dmg
|
||||
printlog "Downloading $downloadURL to $archiveName"
|
||||
printlog "Downloading $downloadURL to $archiveName" REQ
|
||||
if [[ $currentUser != "loginwindow" && $NOTIFY == "all" ]]; then
|
||||
printlog "notifying"
|
||||
if [[ $updateDetected == "YES" ]]; then
|
||||
@@ -181,7 +181,7 @@ else
|
||||
displaynotification "Downloading new $name" "Download in progress …"
|
||||
fi
|
||||
fi
|
||||
curlDownload=$(curl -v -fsL --show-error "$downloadURL" -o "$archiveName" 2>&1)
|
||||
curlDownload=$(curl -v -fsL --show-error ${curlOptions} "$downloadURL" -o "$archiveName" 2>&1)
|
||||
curlDownloadStatus=$(echo $?)
|
||||
deduplicatelogs "$curlDownload"
|
||||
printlog "curl output was: $logoutput" DEBUG
|
||||
@@ -192,9 +192,9 @@ else
|
||||
if [[ $currentUser != "loginwindow" && $NOTIFY == "all" ]]; then
|
||||
printlog "notifying"
|
||||
if [[ $updateDetected == "YES" ]]; then
|
||||
displaynotification "$message" "Error updating $name"
|
||||
displaynotification "$message" "Error updating $name" ERROR
|
||||
else
|
||||
displaynotification "$message" "Error installing $name"
|
||||
displaynotification "$message" "Error installing $name" ERROR
|
||||
fi
|
||||
fi
|
||||
cleanupAndExit 2 "Error downloading $downloadURL error: $logoutput" ERROR
|
||||
@@ -215,7 +215,7 @@ else
|
||||
fi
|
||||
|
||||
# MARK: install the download
|
||||
printlog "Installing $name"
|
||||
printlog "Installing $name" REQ
|
||||
if [[ $currentUser != "loginwindow" && $NOTIFY == "all" ]]; then
|
||||
printlog "notifying"
|
||||
if [[ $updateDetected == "YES" ]]; then
|
||||
@@ -227,7 +227,7 @@ fi
|
||||
|
||||
if [ -n "$installerTool" ]; then
|
||||
# installerTool defined, and we use that for installation
|
||||
printlog "installerTool used: $installerTool"
|
||||
printlog "installerTool used: $installerTool" REQ
|
||||
appName="$installerTool"
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user