55 lines
1.6 KiB
Bash
Executable File
55 lines
1.6 KiB
Bash
Executable File
#!/bin/zsh
|
|
##########################################################################
|
|
# Shellscript : Install Zoom latest Version
|
|
# Autor : Andreas Vogel, NEXT Enterprise gmbh, 2021
|
|
##########################################################################
|
|
|
|
# set -x
|
|
|
|
##########################################################################
|
|
url="https://zoom.us/client/latest/Zoom.pkg"
|
|
appname="Zoom"
|
|
app="zoom.us.app"
|
|
processpath="/Applications/zoom.us.app/Contents/MacOS/zoom.us"
|
|
|
|
|
|
##################### create temporary working directory #################
|
|
echo "Creating working directory '$tempDirectory'"
|
|
#workDirectory=$( /usr/bin/basename $0 )
|
|
tempDirectory=$( /usr/bin/mktemp -d "/private/tmp/tmp.XXXXXX" )
|
|
echo "Changing directory to working directory '$tempDirectory'"
|
|
cd "$tempDirectory"
|
|
|
|
|
|
##################### Installation and cleanup ###########################
|
|
echo "Downloading package $appname.pkg"
|
|
/usr/bin/curl --location --silent "$url" -o "$appname.pkg"
|
|
|
|
sleep 5
|
|
|
|
if [[ -f "$tempDirectory/$appname.pkg" ]]
|
|
then
|
|
echo "download was successful. Start the installation"
|
|
|
|
if [[ -d "/Applications/$app" ]]; then
|
|
rm -rf "/Applications/$app"
|
|
echo "uninstall $app"
|
|
fi
|
|
|
|
if /usr/sbin/installer -pkg "$appname.pkg" -target /
|
|
then
|
|
echo "Package was installed successfully"
|
|
chown -R root:wheel "/Applications/$app"
|
|
exitCode=0
|
|
else
|
|
echo "Error"
|
|
exitCode=1
|
|
fi
|
|
else
|
|
echo "Package could not be found"
|
|
exitCode=1
|
|
fi
|
|
|
|
/bin/rm -Rf "$tempDirectory"
|
|
echo "Deleting working directory '$tempDirectory' and its contents"
|
|
exit $exitCode |