mirror of
https://github.com/mtan93/Installomator.git
synced 2026-03-08 21:02:46 +00:00
MDM scripts
These scripts are great starting points for Mosyle and Addigy, and maybe other solutions as well.
This commit is contained in:
71
MDM/MDMAddigy CustomSoftware.sh
Executable file
71
MDM/MDMAddigy CustomSoftware.sh
Executable file
@@ -0,0 +1,71 @@
|
||||
#!/bin/zsh
|
||||
|
||||
# Specific settings in Addigy to configure Custom Software for installomator.
|
||||
# Addigy has 3 parts to fill out for this, Installation script, Conditions, and Removal steps.
|
||||
|
||||
# Mark: Installation script
|
||||
# Just click “Add” to the autogenerated script by clicking the “Add”-button next to the Installer PKG.
|
||||
|
||||
# Mark: Conditions
|
||||
# Remember to fill out the correct “TARGET_VERSION” and click "Install on succes".
|
||||
TARGET_VERSION="0.7.0"
|
||||
|
||||
APP="/usr/local/Installomator/Installomator.sh"
|
||||
if [ ! -f ${APP} ]; then
|
||||
echo "Does not exist: ${APP}"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
INSTALLED_VERSION="$(${APP} version | tail -1 | awk '{print $4}')"
|
||||
|
||||
vercomp () {
|
||||
if [[ $1 == $2 ]]
|
||||
then
|
||||
return 0
|
||||
fi
|
||||
local IFS=.
|
||||
local i ver1=($1) ver2=($2)
|
||||
# fill empty fields in ver1 with zeros
|
||||
for ((i=${#ver1[@]}; i<${#ver2[@]}; i++))
|
||||
do
|
||||
ver1[i]=0
|
||||
done
|
||||
for ((i=0; i<${#ver1[@]}; i++))
|
||||
do
|
||||
if [[ -z ${ver2[i]} ]]
|
||||
then
|
||||
# fill empty fields in ver2 with zeros
|
||||
ver2[i]=0
|
||||
fi
|
||||
if ((10#${ver1[i]} > 10#${ver2[i]}))
|
||||
then
|
||||
return 1
|
||||
fi
|
||||
if ((10#${ver1[i]} < 10#${ver2[i]}))
|
||||
then
|
||||
return 2
|
||||
fi
|
||||
done
|
||||
return 0
|
||||
}
|
||||
|
||||
echo "Current Version: ${INSTALLED_VERSION}"
|
||||
|
||||
vercomp ${TARGET_VERSION} ${INSTALLED_VERSION}
|
||||
COMP=$? # 0 means the same, 1 means TARGET is newer, 2 means INSTALLED is newer
|
||||
echo "COMPARISON: ${COMP}"
|
||||
|
||||
if [ "${COMP}" -eq 1 ]
|
||||
then
|
||||
echo "Installed version is older than ${TARGET_VERSION}."
|
||||
exit 0
|
||||
else
|
||||
echo "Installed version is the same or newer than ${TARGET_VERSION}."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Mark: Removal steps
|
||||
pkgutil --forget "dk.theilgaard.pkg.Installomator"
|
||||
rm /usr/local/bin/Installomator.sh
|
||||
rm /usr/local/bin/InstallomatorLabels.sh
|
||||
rm /usr/local/Installomator/Installomator.sh
|
||||
Reference in New Issue
Block a user