#!/bin/bash
#
sudo killall -9 "Weixin"
sudo rm -Rf "/Applications/Weixin.app/"
/bin/mkdir -p "${HOME}/Desktop/downloadfromjamf"
cd "${HOME}/Desktop/downloadfromjamf"
chmod -R 777 "${HOME}/Desktop/downloadfromjamf"
sysctl -n machdep.cpu.brand_string | grep -i Intel
if [ $? = 0 ];then
unzip -o "./WeChatMac_x86_64.dmg.zip"
hdiutil attach "./WeChatMac_x86_64.dmg"
sudo /bin/cp -a "/Volumes/微信 WeChat/Weixin.app" /Applications/
hdiutil detach "/Volumes/微信 WeChat/"
else
unzip -o "./WeChatMac_arm64.dmg.zip"
hdiutil attach "./WeChatMac_arm64.dmg"
sudo /bin/cp -a "/Volumes/微信 WeChat/Weixin.app" /Applications/
hdiutil detach "/Volumes/微信 WeChat/"
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