-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
131 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: build-image | ||
|
||
on: | ||
push: | ||
|
||
jobs: | ||
build-darwin-aarch64-sequoia-15: | ||
name: Build darwin-aarch64-sequoia-15 | ||
runs-on: macos-15 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
sparse-checkout: | | ||
.github | ||
scripts | ||
- name: Install Dependencies | ||
run: | | ||
brew install cirruslabs/cli/tart packer | ||
- name: Build Image | ||
run: | | ||
packer init scripts/ci/darwin.pkr.hcl | ||
packer build scripts/ci/darwin.pkr.hcl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
packer { | ||
required_plugins { | ||
tart = { | ||
version = ">= 1.12.0" | ||
source = "github.com/cirruslabs/tart" | ||
} | ||
} | ||
} | ||
|
||
# https://ipsw.me/VirtualMac2,1 | ||
|
||
locals { | ||
sequoia = { | ||
tier = 1 | ||
release = "15" | ||
ipsw = "https://updates.cdn-apple.com/2024FallFCS/fullrestores/062-78489/BDA44327-C79E-4608-A7E0-455A7E91911F/UniversalMac_15.0_24A335_Restore.ipsw" | ||
} | ||
sonoma = { | ||
tier = 2 | ||
release = "14" | ||
ipsw = "https://updates.cdn-apple.com/2023FallFCS/fullrestores/042-54934/0E101AD6-3117-4B63-9BF1-143B6DB9270A/UniversalMac_14.0_23A344_Restore.ipsw" | ||
} | ||
ventura = { | ||
tier = 2 | ||
release = "13" | ||
ipsw = "https://updates.cdn-apple.com/2022FallFCS/fullrestores/012-92188/2C38BCD1-2BFF-4A10-B358-94E8E28BE805/UniversalMac_13.0_22A380_Restore.ipsw" | ||
} | ||
cpu_count = 2 | ||
memory_gb = 4 | ||
disk_size_gb = 20 | ||
ssh_username = "admin" | ||
ssh_password = "admin" | ||
ssh_timeout = "300s" | ||
create_grace_time = "30s" | ||
boot_command = [ | ||
"<wait60s><spacebar>", # hello, hola, bonjour, etc. | ||
"<wait30s>italiano<esc>english<enter>", # Select Your Country and Region | ||
"<wait30s>united states<leftShiftOn><tab><leftShiftOff><spacebar>", # Select Your Country and Region | ||
"<wait10s><leftShiftOn><tab><leftShiftOff><spacebar>", # Written and Spoken Languages | ||
"<wait10s><leftShiftOn><tab><leftShiftOff><spacebar>", # Accessibility | ||
"<wait10s><leftShiftOn><tab><leftShiftOff><spacebar>", # Data & Privacy | ||
"<wait10s><tab><tab><tab><spacebar>", # Migration Assistant | ||
"<wait10s><leftShiftOn><tab><leftShiftOff><leftShiftOn><tab><leftShiftOff><spacebar>", # Sign In with Your Apple ID | ||
"<wait10s><tab><spacebar>", # Are you sure you want to skip signing in with an Apple ID? | ||
"<wait10s><leftShiftOn><tab><leftShiftOff><spacebar>", # Terms and Conditions | ||
"<wait10s><tab><spacebar>", # I have read and agree to the macOS Software License Agreement | ||
"<wait10s>${local.ssh_username}<tab><tab>${local.ssh_password}<tab>${local.ssh_password}<tab><tab><tab><spacebar>", # Create a Computer Account | ||
"<wait120s><leftShiftOn><tab><leftShiftOff><spacebar>", # Enable Location Services | ||
"<wait10s><tab><spacebar>", # Are you sure you don't want to use Location Services? | ||
"<wait10s><tab>UTC<enter><leftShiftOn><tab><leftShiftOff><spacebar>", # Select Your Time Zone | ||
"<wait10s><leftShiftOn><tab><leftShiftOff><spacebar>", # Analytics | ||
"<wait10s><tab><spacebar>", # Screen Time | ||
"<wait10s><tab><spacebar><leftShiftOn><tab><leftShiftOff><spacebar>", # Siri | ||
"<wait10s><leftShiftOn><tab><leftShiftOff><spacebar>", # Choose Your Look | ||
"<wait10s><spacebar>", # Welcome to Mac | ||
"<wait10s><leftAltOn><spacebar><leftAltOff>Terminal<enter>", # Enable Keyboard navigation | ||
"<wait10s>defaults write NSGlobalDomain AppleKeyboardUIMode -int 3<enter>", | ||
"<wait10s><leftAltOn>q<leftAltOff>", | ||
"<wait10s><leftAltOn><spacebar><leftAltOff>System Settings<enter>", # Now that the installation is done, open "System Settings" | ||
"<wait10s><leftAltOn>f<leftAltOff>sharing<enter>", # Navigate to "Sharing" | ||
"<wait10s><tab><tab><tab><tab><tab><spacebar>", # Navigate to "Screen Sharing" and enable it | ||
"<wait10s><tab><tab><tab><tab><tab><tab><tab><tab><tab><tab><tab><tab><spacebar>", # Navigate to "Remote Login" and enable it | ||
"<wait10s><leftAltOn>q<leftAltOff>", # Quit System Settings | ||
] | ||
} | ||
|
||
source "tart-cli" "darwin-aarch64-sequoia-15" { | ||
vm_name = "bun-darwin-aarch64-sequoia-15" | ||
from_ipsw = local.sequoia.ipsw | ||
cpu_count = local.cpu_count | ||
memory_gb = local.memory_gb | ||
disk_size_gb = local.disk_size_gb | ||
ssh_username = local.ssh_username | ||
ssh_password = local.ssh_password | ||
ssh_timeout = local.ssh_timeout | ||
boot_command = local.boot_command | ||
create_grace_time = local.create_grace_time | ||
} | ||
|
||
build { | ||
sources = [ | ||
"source.tart-cli.darwin-aarch64-sequoia-15" | ||
] | ||
|
||
provisioner "shell" { | ||
inline = [ | ||
// Enable passwordless sudo | ||
"echo admin | sudo -S sh -c \"mkdir -p /etc/sudoers.d/; echo 'admin ALL=(ALL) NOPASSWD: ALL' | EDITOR=tee visudo /etc/sudoers.d/admin-nopasswd\"", | ||
// Enable auto-login | ||
// | ||
// See https://github.com/xfreebird/kcpassword for details. | ||
"echo '00000000: 1ced 3f4a bcbc ba2c caca 4e82' | sudo xxd -r - /etc/kcpassword", | ||
"sudo defaults write /Library/Preferences/com.apple.loginwindow autoLoginUser admin", | ||
// Disable screensaver at login screen | ||
"sudo defaults write /Library/Preferences/com.apple.screensaver loginWindowIdleTime 0", | ||
// Disable screensaver for admin user | ||
"defaults -currentHost write com.apple.screensaver idleTime 0", | ||
// Prevent the VM from sleeping | ||
"sudo systemsetup -setsleep Off 2>/dev/null", | ||
// Disable screen lock | ||
// | ||
// Note that this only works if the user is logged-in, | ||
// i.e. not on login screen. | ||
"sysadminctl -screenLock off -password admin", | ||
] | ||
# script = "scripts/bootstrap.sh" | ||
} | ||
} |