Merge pull request #315 from Installomator/CLIInstaller

CLI Installer
This commit is contained in:
Søren Theilgaard
2021-11-22 09:33:17 +01:00
committed by GitHub
6 changed files with 78 additions and 6 deletions

View File

@@ -1,5 +1,6 @@
## v0.8
- New variables for labels that should be installaed using CLI: `CLIInstaller` and `CLIArguments`. If the installer app is named differently than the installed app, then the variable `installerTool` should be use to name the app that should be located in the DMG or zip. See the label __adobecreativeclouddesktop__ to see its use.
- `buildLabel.sh` has been improved to build GitHub software labels much easier. In essense if the URL contains github.com, then it will try to find if it's the latest version or if variable `archiveName` is needed for finding the software. Also improved messaging throughout the script, as well as handling a situation where a pkg does not include a “DIstribution” file, but a “PackageInfo”.
## v0.7

View File

@@ -372,11 +372,24 @@ Depending on the application or pkg there are a few more variables you can or ne
`$updateTool $updateArguments`
Will be run instead of of downloading and installing a complete new version.
Use this when the `updateTool` does differential and optimized downloads.
e.g. `msupdate` (see microsoft installations)
e.g. `msupdate` (see various Microsoft installations).
- `updateToolRunAsCurrentUser`:
When this variable is set (any value), `$updateTool` will be run as the current user. Default is unset and
- `CLIInstaller`:
- `CLIArguments`:
If the downloaded dmg is actually an installer that we can call using CLI, we can use these two variables for what to call.
We need to define `name` for the installed app (to be version checked), as well as `installerTool` for the installer app (if named differently that `name`. Installomator will add the path to the folder/disk image with the binary, and it will be called like this:
`$CLIInstaller $CLIArguments`
For most installations `CLIInstaller` should contain the `installerTool` for the CLI call (if its the same).
We can support a whole range of other software titles by implementing this.
See label adobecreativeclouddesktop.
- `installerTool`:
Introduced as part of `CLIInstaller`. If the installer in the DMG or ZIP is named differently than the installed app, then this variable can be used to name the installer that should be located after mounting/expanding the downloaded archive.
See label adobecreativeclouddesktop
### Configuration from Arguments
You can provide a configuration variable, such as `DEBUG` or `NOTIFY` as an argument in the form `VAR=value`. For example:

View File

@@ -342,7 +342,7 @@ installAppWithPath() { # $1: path to app to install in $targetDir
# versioncheck
# credit: Søren Theilgaard (@theilgaard)
appNewVersion=$(defaults read $appPath/Contents/Info.plist $versionKey)
if [[ $appversion == $appNewVersion ]]; then
if [[ -n $appNewVersion && $appversion == $appNewVersion ]]; then
printlog "Downloaded version of $name is $appNewVersion, same as installed."
if [[ $INSTALL != "force" ]]; then
message="$name, version $appNewVersion, is the latest version."
@@ -369,7 +369,9 @@ installAppWithPath() { # $1: path to app to install in $targetDir
# not running as root
cleanupAndExit 6 "not running as root, exiting"
fi
# Test if variable CLIInstaller is set
if [[ -z $CLIInstaller ]]; then
# remove existing application
if [ -e "$targetDir/$appName" ]; then
printlog "Removing existing $targetDir/$appName"
@@ -382,7 +384,6 @@ installAppWithPath() { # $1: path to app to install in $targetDir
cleanupAndExit 7 "Error while copying"
fi
# set ownership to current user
if [ "$currentUser" != "loginwindow" ]; then
printlog "Changing owner to $currentUser"
@@ -391,6 +392,22 @@ installAppWithPath() { # $1: path to app to install in $targetDir
printlog "No user logged in, not changing user"
fi
elif [[ ! -z $CLIInstaller ]]; then
mountname=$(dirname $appPath)
printlog "CLIInstaller exists, running installer command $mountname/$CLIInstaller $CLIArguments" #INFO
CLIoutput=$("$mountname/$CLIInstaller" "${CLIArguments[@]}" 2>&1)
CLIstatus=$(echo $?)
logoutput="$CLIoutput" # dedupliatelogs "$CLIoutput"
if [ $CLIstatus -ne 0 ] ; then
cleanupAndExit 3 "Error installing $mountname/$CLIInstaller $CLIArguments error:\n$logoutput" #ERROR
else
printlog "Succesfully ran $mountname/$CLIInstaller $CLIArguments"
fi
printlog "Debugging enabled, update tool output was:\n$logoutput" #DEBUG
fi
}
mountDMG() {
@@ -411,7 +428,6 @@ mountDMG() {
installFromDMG() {
mountDMG
installAppWithPath "$dmgmount/$appName"
}

View File

@@ -198,8 +198,27 @@ REOPEN="yes"
# $updateTool $updateArguments
# Will be run instead of of downloading and installing a complete new version.
# Use this when the updateTool does differential and optimized downloads.
# e.g. msupdate
# e.g. msupdate on various Microsoft labels
#
# - updateToolRunAsCurrentUser:
# When this variable is set (any value), $updateTool will be run as the current user.
#
# - CLIInstaller:
# - CLIArguments:
# If the downloaded dmg is actually an installer that we can call using CLI, we can
# use these two variables for what to call.
# We need to define `name` for the installed app (to be version checked), as well as
# `installerTool` for the installer app (if named differently that `name`. Installomator
# will add the path to the folder/disk image with the binary, and it will be called like this:
`$CLIInstaller $CLIArguments`
# For most installations `CLIInstaller` should contain the `installerTool` for the CLI call
# (if its the same).
# We can support a whole range of other software titles by implementing this.
# See label adobecreativeclouddesktop
#
# - installerTool:
# Introduced as part of `CLIInstaller`. If the installer in the DMG or ZIP is named
# differently than the installed app, then this variable can be used to name the
# installer that should be located after mounting/expanding the downloaded archive.
# See label adobecreativeclouddesktop
#

View File

@@ -0,0 +1,17 @@
adobecreativeclouddesktop)
name="Adobe Creative Cloud"
#appName="Install.app"
type="dmg"
if [[ $(arch) == "arm64" ]]; then
downloadURL=$(curl -fs "https://helpx.adobe.com/download-install/kb/creative-cloud-desktop-app-download.html" | grep -o "https*.*macarm64.*dmg" | cut -d '"' -f1 | head -1)
elif [[ $(arch) == "i386" ]]; then
downloadURL=$(curl -fs "https://helpx.adobe.com/download-install/kb/creative-cloud-desktop-app-download.html" | grep -o "https*.*osx10.*dmg" | cut -d '"' -f1 | head -1)
fi
#downloadURL=$(curl -fs "https://helpx.adobe.com/download-install/kb/creative-cloud-desktop-app-download.html" | grep -o "https*.*dmg" | head -1)
appNewVersion=$(curl -fs "https://helpx.adobe.com/creative-cloud/release-note/cc-release-notes.html" | grep "mandatory" | head -1 | grep -o "Version *.* released" | cut -d " " -f2)
installerTool="Install.app"
CLIInstaller="Install.app/Contents/MacOS/Install"
CLIArguments=(--mode=silent)
expectedTeamID="JQ525L2MZD"
Company="Adobe"
;;

View File

@@ -202,6 +202,12 @@ if [[ $currentUser != "loginwindow" && $NOTIFY == "all" ]]; then
displaynotification "Installing $name" "Installation in progress …"
fi
if [ -n "$installerTool" ]; then
# installerTool defined, and we use that for installation
printlog "installerTool used: $installerTool"
appName="$installerTool"
fi
case $type in
dmg)
installFromDMG