From 891dab08d4708288e8dfe557cb8aaa4046e9142c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Theilgaard?= Date: Mon, 15 Nov 2021 14:25:57 +0100 Subject: [PATCH] `installerTool` implemented --- CHANGELOG.md | 2 +- README.md | 10 ++++++--- fragments/functions.sh | 6 +---- fragments/header.sh | 22 ++++++++++++------- fragments/labels/adobecreativeclouddesktop.sh | 1 + fragments/labels/forticlientvpn.sh | 11 ++++++++++ fragments/main.sh | 6 +++++ 7 files changed, 41 insertions(+), 17 deletions(-) create mode 100644 fragments/labels/forticlientvpn.sh diff --git a/CHANGELOG.md b/CHANGELOG.md index 3cd6d80..26959a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ ## v0.8 -- New variables for labels that should be installaed using CLI: `CLIInstaller` and `CLIArguments`. See the label __adobecreativeclouddesktop__ to see it's use. +- New variables for labels that should be installaed using CLI: `CLIInstaller` and `CLIArguments`. If the installer app is named differently thatn the installed app, then the variable `installerTool` can be use to name the app that should be located in the DMG or zip. See the label __adobecreativeclouddesktop__ to see it’s use. ## v0.7 diff --git a/README.md b/README.md index 6ae7225..b387170 100644 --- a/README.md +++ b/README.md @@ -379,13 +379,17 @@ Depending on the application or pkg there are a few more variables you can or ne - `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 `appName` for the installer binary. So Installomator will add the path to the folder of this binary, and it will be called like this: + 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` - So for most installations `CLIInstaller` should contain the `appName` for the CLI call (if it’s the same). + For most installations `CLIInstaller` should contain the `installerTool` for the CLI call (if it’s 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: diff --git a/fragments/functions.sh b/fragments/functions.sh index 48246fa..a810830 100644 --- a/fragments/functions.sh +++ b/fragments/functions.sh @@ -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." @@ -428,11 +428,7 @@ mountDMG() { installFromDMG() { mountDMG - if [[ -z $CLIInstaller ]]; then installAppWithPath "$dmgmount/$appName" - else - installAppWithPath "$dmgmount/$CLIInstaller" - fi } installFromPKG() { diff --git a/fragments/header.sh b/fragments/header.sh index e1dbace..357077d 100644 --- a/fragments/header.sh +++ b/fragments/header.sh @@ -205,14 +205,20 @@ REOPEN="yes" # # - 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 `appName` for the installer binary. So Installomator will add the path to the -# folder of this binary, and it will be called like this: -# $CLIInstaller $CLIArguments -# So for most installations `CLIInstaller` should contain the `appName` for the CLI -# call (if it’s the same). +# 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 it’s 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 +# diff --git a/fragments/labels/adobecreativeclouddesktop.sh b/fragments/labels/adobecreativeclouddesktop.sh index ee94acc..7445443 100644 --- a/fragments/labels/adobecreativeclouddesktop.sh +++ b/fragments/labels/adobecreativeclouddesktop.sh @@ -9,6 +9,7 @@ adobecreativeclouddesktop) 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" diff --git a/fragments/labels/forticlientvpn.sh b/fragments/labels/forticlientvpn.sh new file mode 100644 index 0000000..949a97d --- /dev/null +++ b/fragments/labels/forticlientvpn.sh @@ -0,0 +1,11 @@ +forticlientvpn) + name="FortiClientUpdate" + type="dmg" + # This version of the installer only downloads another installer + downloadURL="https://links.fortinet.com/forticlient/mac/vpnagent" + appNewVersion="" + installerTool="FortiClientUpdate.app" + CLIInstaller="FortiClientUpdate.app/Contents/MacOS/FortiClientUpdate" + CLIArguments=( ) + expectedTeamID="AH4XFXJ7DK" + ;; diff --git a/fragments/main.sh b/fragments/main.sh index dfba2c9..e69f099 100644 --- a/fragments/main.sh +++ b/fragments/main.sh @@ -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