欢迎各位兄弟 发布技术文章

这里的技术是共享的

You are here

自己亲自做的 安装 appleconnect 有大用 有大大用

#!/bin/bash
#

sudo killall -9 "AppleConnect"
/bin/mkdir -p "${HOME}/Desktop/downloadfromjamf"
cd  "${HOME}/Desktop/downloadfromjamf"
#/usr/local/bin/appleconnect u   #卸载
current_user=${HOME##*/}
/usr/bin/expect <<EOF    
spawn sudo -u $current_user /usr/local/bin/appleconnect u    
set timeout 60    
expect {    
 "uninstall" { send "y\r" }    
}      
expect eof    
EOF
sudo rm -Rf "/Applications/AppleConnect.app/" 2>/dev/null
ver=`sw_vers -productVersion | cut -d'.' -f1`
#ver2=`sw_vers -productVersion | cut -d'.' -f2`
let ver="$ver"      #大版本
#let ver2="$ver2"     #小版本
if [ $ver -ge 13 ];then
   /usr/bin/curl -o "./AppleConnectInstaller6-1.dmg.zip"  http://aaaa.com/util/software/AppleConnectInstaller6-1.dmg.zip  #新版 12 及以上
   unzip -o "./AppleConnectInstaller6-1.dmg.zip"
   hdiutil attach "./AppleConnectInstaller6-1.dmg"
   sudo installer -pkg /Volumes/AppleConnect/AppleConnect.pkg -target /
   hdiutil detach /Volumes/AppleConnect  
 elif  [ $ver -ge 11 ];then
   /usr/bin/curl -o "./AppleConnectInstaller5-5.dmg.zip"  http://aaaa.com/util/software/AppleConnectInstaller5-5.dmg.zip  #旧版 11
   unzip -o "./AppleConnectInstaller5-5.dmg.zip"
   hdiutil attach "./AppleConnectInstaller5-5.dmg"
   sudo installer -pkg /Volumes/AppleConnect/AppleConnect.pkg -target /
   hdiutil detach /Volumes/AppleConnect  
 else
   /usr/bin/curl -o "./AppleConnect5.2.pkg.zip"  http://aaaa.com/util/software/AppleConnect5.2.pkg.zip  #旧版 10及以下
   unzip -o "./AppleConnect5.2.pkg.zip"
   sudo installer -pkg "${HOME}/Desktop/downloadfromjamf/AppleConnect5.2.pkg" -target /
fi

(/usr/bin/osascript -e  'display dialog "成功安装AppleConnect,您可以删除桌面上的downloadfromjamf目录,如果打开AppleConnect出现错误,请重启电脑!" buttons {"OK"}   default button "OK"')

#把文件夹权限置为 777  ,让所有人可以删
sudo chmod -R 777 "${HOME}/Desktop/downloadfromjamf/"
#cd ../
#rm -Rf "${HOME}/Desktop/downloadfromjamf"
exit 0


普通分类: