由于MDS部署后,不知道为什么WiFi无法连上,也就导致Intel App无法安装了。 在参考了hexnode的脚本后发现,安装Rosetta依然显示连不上网,于是稍微修改了脚本。 需要注意的是,当同一个Workflow有packages以及script的时候,需要将脚本的顺序修改为”After macOS Install, but before packages install”
# Determine WiFi is Connected wifi_status=$(ifconfig en0 |grep "status: active") wifi_network=$(networksetup -getairportnetwork en0 | awk -F': ' '/Current Wi-Fi Network/{print $2}') if [ -z "$wifi_status" ]; then echo "WiFi is not Connected. Setting to AppleWiFi..." # Set Wi-Fi networksetup -setairportnetwork en0 AppleWiFi sleep 5 else echo "WiFi is already connected to $wifi_network" fi # Determine the architecture of the macOS device processorBrand=$(/usr/sbin/sysctl -n machdep.cpu.brand_string) if [[ "${processorBrand}" = *"Apple"* ]]; then echo "Apple Processor is present." else echo "Apple Processor is not present. Rosetta not required." exit 0 fi # Check if Rosetta is installed checkRosettaStatus=$(/bin/launchctl list | /usr/bin/grep "com.apple.oahd-root-helper") RosettaFolder="/Library/Apple/usr/share/rosetta" if [[ -e "${RosettaFolder}" && "${checkRosettaStatus}" != "" ]]; then echo "Rosetta Folder exists and Rosetta Service is running. Exiting..." exit 0 else echo "Rosetta Folder does not exist or Rosetta service is not running. Installing Rosetta..." fi # Install Rosetta with WIFI check if [ -z "$wifi_status" ]; then echo "Rosetta - WiFi is not Connected. Setting to AppleWiFi..." # Set Wi-Fi networksetup -setairportnetwork en0 AppleWiFi sleep 5 echo "Starting to Install Rosetta - Setting WiFi Done" /usr/sbin/softwareupdate --install-rosetta --agree-to-license else echo "Rosetta - WiFi is already connected to $wifi_network" echo "Starting to Install Rosetta - Detected WiFi" /usr/sbin/softwareupdate --install-rosetta --agree-to-license fi # /usr/sbin/softwareupdate --install-rosetta --agree-to-license # Check the result of Rosetta install command if [[ $? -eq 0 ]]; then echo "Rosetta installed successfully." exit 0 else echo "Rosetta installation failed." exit 1