macos.json
{ "variables": { "macos_version": "catalina", "pvm_path": "iso/template1.pvm", "datemark": "{{timestamp}}", "install_user": "appveyor", "install_password": "appveyor", "appVeyorUrl": "https://ci.appveyor.com" }, "sensitive-variables": ["install_password", "template_password", "appleIdUser", "appleIdPasswd"], "provisioners": [ { "type": "shell", "inline": [ "/usr/bin/dscl -u \"{{user `template_user`}}\" -P \"{{user `template_password`}}\" . -passwd \"/Users/{{user `template_user`}}\" \"{{user `install_password`}}\"", "security set-keychain-password -o \"{{user `template_password`}}\" -p \"{{user `install_password`}}\" \"/Users/{{user `template_user`}}/Library/Keychains/login.keychain\"" ] }, { "type": "shell", "inline": [ "echo 'export PATH=\"$PATH:/usr/local/bin\"' >> $HOME/.bashrc", "echo '{{ user `install_password` }}' | sudo systemsetup -setcomputersleep Never", "echo '{{ user `install_password` }}' | CI=1 /bin/bash -c \"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)\"", "/usr/local/bin/brew install --cask powershell", "/usr/local/bin/brew install coreutils zlib p7zip" ] }, { "type": "shell", "environment_vars": [ "HOMEBREW_BUILD_AGENT_MODE=Parallels" ], "inline": [ "brew install appveyor/brew/appveyor-build-agent", "brew services restart appveyor/brew/appveyor-build-agent" ] }, { "type": "file", "source": "{{ template_dir }}/scripts/macos/custom-scripts", "destination": "./custom-scripts" }, { "type": "file", "source": "{{ template_dir }}/scripts/macos/", "destination": "./" }, { "type": "shell", "inline": [ "mkdir windows-scripts" ] }, { "type": "file", "source": "{{ template_dir }}/scripts/Windows/", "destination": "./windows-scripts/" }, { "type": "shell", "environment_vars": [ "APPLEID_USER={{user `appleIdUser`}}", "APPLEID_PWD={{user `appleIdPasswd`}}", "INSTALL_PASSWORD={{user `install_password`}}" ], "execute_command": "echo '{{ user `install_password` }}' | {{.Vars}} sudo -S -E bash -ex '{{.Path}}'", "scripts": [ "scripts/macos/basicconfig.sh" ] }, { "type": "shell", "scripts":[ "{{ template_dir }}/scripts/macos/run_custom_scripts.sh" ] }, { "type": "shell", "inline": [ "if [ -f .ssh/authorized_keys ]; then rm .ssh/authorized_keys; fi", "find . -maxdepth 1 -name 'script_*.sh-*.log' -delete" ] } ], "builders": [ { "type": "parallels-pvm", "parallels_tools_flavor": "mac", "source_path": "{{ user `pvm_path` }}", "ssh_username": "{{ user `template_user` }}", "ssh_password": "{{ user `template_password` }}", "ssh_timeout": "120s", "shutdown_command": "echo '{{ user `install_password` }}' | sudo -S shutdown -h now", "vm_name": "packer-{{user `macos_version`}}-{{user `datemark`}}", "skip_compaction": "false" }, { "type": "parallels-iso", "guest_os_type": "win-8", "parallels_tools_flavor": "mac", "boot_wait": "10s", "cpus": 2, "disk_size": 40960, "http_directory": "http", "iso_urls": [ "iso/Mojave.iso" ], "iso_checksum_type": "none", "ssh_username": "{{ user `install_user` }}", "ssh_password": "{{ user `install_password` }}", "ssh_port": 22, "ssh_wait_timeout": "10000s", "shutdown_command": "echo '{{ user `install_password` }}'|sudo -S shutdown -h now", "vm_name": "packer-{{user `macos_version`}}-{{user `datemark`}}", "prlctl": [ ["set", "{{.Name}}", "--memsize", "2048"], ["set", "{{.Name}}", "--memquota", "512:2048"], ["set", "{{.Name}}", "--cpus", "2"], ["set", "{{.Name}}", "--distribution", "macosx"], ["set", "{{.Name}}", "--3d-accelerate", "highest"], ["set", "{{.Name}}", "--high-resolution", "off"], ["set", "{{.Name}}", "--auto-share-camera", "off"], ["set", "{{.Name}}", "--auto-share-bluetooth", "off"], ["set", "{{.Name}}", "--on-window-close", "keep-running"], ["set", "{{.Name}}", "--shf-host", "off"] ] } ], "post-processors": [ { "type": "manifest", "output": "{{user `packer_manifest`}}", "strip_path": true } ] } |