#!/bin/bash
#
sudo killall -9 "企业微信"
/bin/mkdir -p "${HOME}/Desktop/downloadfromjamf"
cd "${HOME}/Desktop/downloadfromjamf"
sudo rm -Rf "/Applications/企业微信.app/"
chmod -R 777 "${HOME}/Desktop/downloadfromjamf"
sysctl -n machdep.cpu.brand_string | grep -i Intel
if [ $? = 0 ];then
unzip -o "./WeCom_4.1.32.91011_Intel.dmg.zip"
hdiutil attach "./WeCom_4.1.32.91011_Intel.dmg"
sudo /bin/cp -a "/Volumes/WeCom_for_mac/企业微信.app" /Applications/
hdiutil detach "/Volumes/WeCom_for_mac/"
else
unzip -o "./WeCom_4.1.32.99555_Apple.dmg.zip"
hdiutil attach "./WeCom_4.1.32.99555_Apple.dmg"
sudo /bin/cp -a "/Volumes/WeCom_for_mac/企业微信.app" /Applications/
hdiutil detach "/Volumes/WeCom_for_mac/"
fi
(/usr/bin/osascript -e 'display dialog "成功安装企业微信,您可以删除桌面上的downloadfromjamf目录,如果打开企业微信出现错误,请重启电脑!" buttons {"OK"} default button "OK"')
#把文件夹权限置为 777 ,让所有人可以删
sudo chmod -R 777 "${HOME}/Desktop/downloadfromjamf/"
#cd ../
#rm -Rf "${HOME}/Desktop/downloadfromjamf"
exit 0