2021-10-22 23:22:57 +00:00
|
|
|
#! /bin/bash
|
2023-03-08 18:45:39 +00:00
|
|
|
set -e
|
|
|
|
MACPORTS_VERSION=2.8.1
|
2021-10-22 23:22:57 +00:00
|
|
|
MACOS_VERSION=$(sw_vers -productVersion)
|
|
|
|
case $MACOS_VERSION in
|
2023-12-06 18:43:55 +00:00
|
|
|
14.*)
|
|
|
|
MACOS_NAME=14-Sonoma
|
|
|
|
;;
|
2023-03-08 18:45:39 +00:00
|
|
|
13.*)
|
|
|
|
MACOS_NAME=13-Ventura
|
|
|
|
;;
|
2021-10-26 16:25:40 +00:00
|
|
|
12.*)
|
|
|
|
MACOS_NAME=12-Monterey
|
|
|
|
;;
|
2021-10-22 23:22:57 +00:00
|
|
|
11.*)
|
|
|
|
MACOS_NAME=11-BigSur
|
|
|
|
;;
|
2021-10-26 16:25:40 +00:00
|
|
|
10.15.*)
|
|
|
|
MACOS_NAME=10.15-Catalina
|
|
|
|
;;
|
|
|
|
10.14.*)
|
|
|
|
MACOS_NAME=10.14-Mojave
|
|
|
|
;;
|
2021-10-22 23:22:57 +00:00
|
|
|
*)
|
|
|
|
error "Unknown MacOS Version"
|
|
|
|
esac
|
|
|
|
|
|
|
|
INSTALLER_NAME=MacPorts-${MACPORTS_VERSION}-${MACOS_NAME}.pkg
|
|
|
|
|
2021-10-23 01:02:21 +00:00
|
|
|
log "Download $INSTALLER_NAME"
|
|
|
|
curl -o "${PROJECT_DIR}/tmp/${INSTALLER_NAME}" -L "https://github.com/macports/macports-base/releases/download/v${MACPORTS_VERSION}/${INSTALLER_NAME}"
|
|
|
|
|
|
|
|
log "Install xcode tools"
|
2023-03-08 18:45:39 +00:00
|
|
|
xcode-select --install || true
|
2021-10-23 01:02:21 +00:00
|
|
|
|
|
|
|
log "Run macports installer"
|
2023-12-06 18:43:55 +00:00
|
|
|
sudo installer -pkg "${PROJECT_DIR}/tmp/${INSTALLER_NAME}" -target /
|