From 7366288c8ba76559eaefaf29f794eb9842d4a1e6 Mon Sep 17 00:00:00 2001 From: startergo <7897244+startergo@users.noreply.github.com> Date: Tue, 28 May 2024 08:42:51 -0400 Subject: [PATCH 1/3] Fixed PHP env Fixed PHP env. Fixed python env. Added iso_checksum. Fixed order in the example. Added quotes in variables declaration. --- README.md | 39 +++++++++++++++---------- packer/template.json | 8 ++--- prepare_iso/support/generate_shadowhash | 4 +-- scripts/support/arc4random.py | 2 ++ scripts/support/generatehash.py | 2 +- scripts/support/pbkdf2.py | 2 ++ scripts/support/plistutils.py | 2 ++ scripts/support/shadowhash.py | 2 ++ 8 files changed, 39 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 325021d..17ed001 100644 --- a/README.md +++ b/README.md @@ -63,7 +63,7 @@ Run the `prepare_iso.sh` script with two arguments: the path to an `Install OS X For example: -`sudo prepare_iso/prepare_iso.sh -u admin -p password -i /path/to/image.jpg "/Applications/Install OS X Mountain Lion.app" out` +`sudo prepare_iso/prepare_iso.sh "/Applications/Install OS X Mountain Lion.app" out -u admin -p password -i /path/to/image.jpg` Additionally, flags can be set to disable certain default configuration options. @@ -85,7 +85,7 @@ Given the above output, we could run then run packer: ```sh cd packer packer build \ - -var iso_url=../out/OSX_InstallESD_10.8.4_12E55.dmg \ + -var 'iso_url=../out/OSX_InstallESD_10.8.4_12E55.dmg' \ template.json ``` @@ -96,12 +96,21 @@ If you modified the name or password of the admin account in the `prepare_iso` s For example: ``` +packer build -var 'iso_url=../out/OSX_InstallESD_10.9.5_13F34.dmg' \ +-var 'username=admin' \ +-var 'password=password' \ +-var 'install_vagrant_keys=false' \ +-var 'autologin=true' \ +-var 'provisioning_delay=30' \ +-only=vmware-iso \ +template.json +======= packer build \ - -var iso_url=../out/OSX_InstallESD_10.8.4_12E55.dmg \ - -var username=youruser \ - -var password=yourpassword \ - -var install_vagrant_keys=false \ - template.json +-var iso_url=../out/OSX_InstallESD_10.8.4_12E55.dmg \ +-var username=youruser \ +-var password=yourpassword \ +-var install_vagrant_keys=false \ +template.json ``` ### Building to a device with more space @@ -138,19 +147,19 @@ By default, the packer template does not install the Chef or Puppet configuratio To install the latest version of Chef: ``` -packer build -var chef_version=latest template.json +packer build -var 'chef_version=latest' template.json ``` To install the last version of Puppet Agent: ``` -packer build -var pupet_agent_version=latest template.json +packer build -var 'pupet_agent_version=latest' template.json ``` To install the last versions of the deprecated standalone Puppet, Facter and Hiera packages: ``` -packer build -var puppet_version=latest facter_version=latest hiera_version=latest template.json +packer build -var 'puppet_version=latest' -var 'facter_version=latest' -var 'hiera_version=latest' template.json ``` ## Xcode Command Line Tools @@ -158,7 +167,7 @@ packer build -var puppet_version=latest facter_version=latest hiera_version=late The Xcode CLI tools are installed by the packer template by default. To disable the installation, set the `install_xcode_cli_tools` variable to `false`: ``` -packer build -var install_xcode_cli_tools=false template.json +packer build -var 'install_xcode_cli_tools=false' template.json ``` ## System updates @@ -166,7 +175,7 @@ packer build -var install_xcode_cli_tools=false template.json Packer will instruct the system to download and install all available OS X updates, if you want to disable this default behaviour, use `update_system` variable: ``` -packer build -var update_system=0 template.json +packer build -var 'update_system=0' template.json ``` ## Provisioning delay @@ -174,7 +183,7 @@ packer build -var update_system=0 template.json In some cases, it may be helpful to insert a delay into the beginning of the provisioning process. Adding a delay of about 30 seconds may help subsequent provisioning steps that install software from the internet complete successfully. By default, the delay is set to `0`, but you can change the delay by setting the `provisioning_delay` variable: ``` -packer build -var provisioning_delay=30 template.json` +packer build -var 'provisioning_delay=30' template.json` ``` ## VirtualBox support @@ -236,8 +245,8 @@ Finally the virtualbox-ovf allows to use the previously generated exported virtu ``` packer build \ - -var provisioning_delay=30 \ - -var source_path=macOS_10.12.ovf \ + -var 'provisioning_delay=30' \ + -var 'source_path=macOS_10.12.ovf' \ template.json ``` diff --git a/packer/template.json b/packer/template.json index 32796ee..3fa4352 100644 --- a/packer/template.json +++ b/packer/template.json @@ -4,7 +4,7 @@ "boot_wait": "5s", "disk_size": 40960, "guest_os_type": "win-8", - "iso_checksum_type": "none", + "iso_checksum": "{{user `iso_checksum`}}", "iso_url": "{{user `iso_url`}}", "output_directory": "{{user `output_directory`}}", "shutdown_command": "echo '{{user `username`}}'|sudo -S shutdown -h now", @@ -31,7 +31,7 @@ "boot_wait": "2s", "disk_size": 40960, "guest_os_type": "darwin12-64", - "iso_checksum_type": "none", + "iso_checksum": "{{user `iso_checksum`}}", "iso_url": "{{user `iso_url`}}", "output_directory": "{{user `output_directory`}}", "shutdown_command": "echo '{{user `username`}}'|sudo -S shutdown -h now", @@ -61,7 +61,7 @@ "guest_additions_mode": "disable", "guest_os_type": "MacOS1011_64", "hard_drive_interface": "sata", - "iso_checksum_type": "none", + "iso_checksum": "{{user `iso_checksum`}}", "iso_interface": "sata", "iso_url": "{{user `iso_url`}}", "output_directory": "{{user `output_directory`}}", @@ -172,4 +172,4 @@ "username": "vagrant", "vagrant_box_directory": "{{env `PACKER_VAGRANT_BOX_DIR`}}" } -} +} \ No newline at end of file diff --git a/prepare_iso/support/generate_shadowhash b/prepare_iso/support/generate_shadowhash index ad2b188..b231a1a 100755 --- a/prepare_iso/support/generate_shadowhash +++ b/prepare_iso/support/generate_shadowhash @@ -1,4 +1,4 @@ -#!/usr/bin/php +#!/usr/bin/env php \ No newline at end of file +?> diff --git a/scripts/support/arc4random.py b/scripts/support/arc4random.py index 252b373..acec9b3 100644 --- a/scripts/support/arc4random.py +++ b/scripts/support/arc4random.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python + '''py-arc4random Basic python 2.7/3 implementation of OpenBSDs arc4random PRNG. diff --git a/scripts/support/generatehash.py b/scripts/support/generatehash.py index 8d51885..8fd483c 100755 --- a/scripts/support/generatehash.py +++ b/scripts/support/generatehash.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python import sys import shadowhash diff --git a/scripts/support/pbkdf2.py b/scripts/support/pbkdf2.py index 979dcab..8c9676c 100644 --- a/scripts/support/pbkdf2.py +++ b/scripts/support/pbkdf2.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python + # -*- coding: utf-8 -*- """ pbkdf2 diff --git a/scripts/support/plistutils.py b/scripts/support/plistutils.py index 4a6e7c4..8ed9208 100644 --- a/scripts/support/plistutils.py +++ b/scripts/support/plistutils.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python + '''plist utility functions''' from Foundation import NSPropertyListSerialization diff --git a/scripts/support/shadowhash.py b/scripts/support/shadowhash.py index 5d53ac5..5777840 100644 --- a/scripts/support/shadowhash.py +++ b/scripts/support/shadowhash.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python + '''Functions for generating ShadowHashData''' import hashlib From 82841ac26d85edd8b206698ca3c81ab39057684c Mon Sep 17 00:00:00 2001 From: startergo <7897244+startergo@users.noreply.github.com> Date: Tue, 28 May 2024 12:27:23 -0400 Subject: [PATCH 2/3] Update README.md Update user-variables http link. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 17ed001..af65558 100644 --- a/README.md +++ b/README.md @@ -76,7 +76,7 @@ The `prepare_iso.sh` script needs the `support` directory and its content. In ot ## Use with Packer -The path can now be added to your Packer template or provided as [user variables](http://www.packer.io/docs/templates/user-variables.html). The `packer` directory contains a template that can be used with the `vmware-iso` and `virtualbox-iso` builders. The checksum does not need to be added because the `iso_checksum_type` has been set to "none". The `veewee` directory contains a definition, though as mentioned above it is not currently being maintained. +The path can now be added to your Packer template or provided as [user variables](https://developer.hashicorp.com/packer/docs/templates/legacy_json_templates/user-variables). The `packer` directory contains a template that can be used with the `vmware-iso` and `virtualbox-iso` builders. The checksum does not need to be added because the `iso_checksum_type` has been set to "none". The `veewee` directory contains a definition, though as mentioned above it is not currently being maintained. The Packer template adds some additional VM options required for OS X guests. Note that the paths given in the Packer template's `iso_url` builder key accepts file paths, both absolute and relative (to the current working directory). From ed826df614fa1b4693a6e74ee70fc00ade51c738 Mon Sep 17 00:00:00 2001 From: startergo <7897244+startergo@users.noreply.github.com> Date: Tue, 28 May 2024 12:38:10 -0400 Subject: [PATCH 3/3] Update README.md iso_checksum update. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index af65558..245da0d 100644 --- a/README.md +++ b/README.md @@ -76,7 +76,7 @@ The `prepare_iso.sh` script needs the `support` directory and its content. In ot ## Use with Packer -The path can now be added to your Packer template or provided as [user variables](https://developer.hashicorp.com/packer/docs/templates/legacy_json_templates/user-variables). The `packer` directory contains a template that can be used with the `vmware-iso` and `virtualbox-iso` builders. The checksum does not need to be added because the `iso_checksum_type` has been set to "none". The `veewee` directory contains a definition, though as mentioned above it is not currently being maintained. +The path can now be added to your Packer template or provided as [user variables](https://developer.hashicorp.com/packer/docs/templates/legacy_json_templates/user-variables). The `packer` directory contains a template that can be used with the `vmware-iso` and `virtualbox-iso` builders. The checksum needs to be added wih `iso_checksum` or set to "none". The `veewee` directory contains a definition, though as mentioned above it is not currently being maintained. The Packer template adds some additional VM options required for OS X guests. Note that the paths given in the Packer template's `iso_url` builder key accepts file paths, both absolute and relative (to the current working directory).