Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add High Sierra support to prepare_iso.sh #97

Closed

Conversation

americanhanko
Copy link

@americanhanko americanhanko commented Mar 14, 2018

This PR

  • adds support for High Sierra to prepare_iso.sh
  • Removes some whitespace, converts tabs to spaces
  • A few minor changes suggested by shellcheck
  • Sets checksum values to "none" since Packer warns if there is no checksum or checksum type specified

Why

  • Even though we can't install unsigned packages on anything beyond 10.12.3, I think having this script support High Sierra is still useful.

@clburlison
Copy link

For what it's worth I used this PR yesterday to build an iso with High Sierra 👍 . Might be nice to verify against an older OS version.

@tzeejay
Copy link

tzeejay commented Mar 22, 2018

@americanhanko Do I get it right that this is just "make this script understand the changes in the High Sierra" installer but outputs a non-bootable iso, because of the signing mess?

@tzeejay
Copy link

tzeejay commented Mar 22, 2018

If yes, I just got a little excited.

Thanks for you work anyways. Would like to see this merged

@camilamacedo86
Copy link

camilamacedo86 commented Jul 10, 2018

Following the test performed.

** prepare_iso = Worked OK

cmacedo@camilas-MBP ~/Desktop/osx-vm-templates (pr) $ sudo prepare_iso/prepare_iso.sh /Applications/Install\ macOS\ High\ Sierra.app/ out
-- Destination dir out doesn't exist, creating..
-- Attaching input OS X installer image with shadow file..
expected   CRC32 $0954E321
/dev/disk3          	GUID_partition_scheme          	
/dev/disk3s1        	EFI                            	
/dev/disk3s2        	Apple_HFS                      	/private/tmp/veewee-osx-esd.V2kM
-- Mounting BaseSystem..
Checksumming Protective Master Boot Record (MBR : 0)…
Protective Master Boot Record (MBR :: verified   CRC32 $FDC76543
Checksumming GPT Header (Primary GPT Header : 1)…
 GPT Header (Primary GPT Header : 1): verified   CRC32 $84AC1518
Checksumming GPT Partition Data (Primary GPT Table : 2)…
GPT Partition Data (Primary GPT Tabl: verified   CRC32 $EDA37B3F
Checksumming  (Apple_Free : 3)…
                    (Apple_Free : 3): verified   CRC32 $00000000
Checksumming disk image (Apple_HFS : 4)…
..........................................................................................................................................
          disk image (Apple_HFS : 4): verified   CRC32 $42F71E59
Checksumming  (Apple_Free : 5)…
...................................................................................................................................................
                    (Apple_Free : 5): verified   CRC32 $00000000
Checksumming GPT Partition Data (Backup GPT Table : 6)…
GPT Partition Data (Backup GPT Table: verified   CRC32 $EDA37B3F
Checksumming GPT Header (Backup GPT Header : 7)…
  GPT Header (Backup GPT Header : 7): verified   CRC32 $C66FDEB8
verified   CRC32 $C694E6B5
/dev/disk4          	GUID_partition_scheme          	
/dev/disk4s1        	Apple_HFS                      	/private/tmp/veewee-osx-basesystem.ut2J
-- OS X version detected: 10.13.4, build 17E199
-- Making firstboot installer pkg..
No log handling enabled - using stderr logging
Created directory: /var/db/net-snmp
Created directory: /var/db/net-snmp/mib_indexes
productbuild: Wrote product to /Users/cmacedo/Desktop/osx-vm-templates/prepare_iso/support/tmp/veewee-config.pkg
"disk4" unmounted.
"disk4" ejected.
-- Creating empty read-write DMG located at /tmp/veewee-osx-basesystem-rw.UIpI.dmg..
created: /tmp/veewee-osx-basesystem-rw.UIpI.dmg
/dev/disk4          	Apple_partition_scheme         	
/dev/disk4s1        	Apple_partition_map            	
/dev/disk4s2        	Apple_HFS                      	/private/tmp/veewee-osx-basesystem.ut2J
-- Restoring ('asr restore') the BaseSystem to the read-write DMG..
	Validating target...done
	Validating source...done
	Retrieving scan information...done
	Validating sizes...done
	Restoring  ....10....20....30....40....50....60....70....80....90....100
	Remounting target volume...done
-- Moving 'Packages' directory from the ESD to BaseSystem..
/tmp/veewee-osx-esd.V2kM/Packages -> /Volumes/OS X Base System/System/Installation/Packages
/tmp/veewee-osx-esd.V2kM/Packages/Core.pkg -> /Volumes/OS X Base System/System/Installation/Packages/Core.pkg
/tmp/veewee-osx-esd.V2kM/Packages/EmbeddedOSFirmware.pkg -> /Volumes/OS X Base System/System/Installation/Packages/EmbeddedOSFirmware.pkg
/tmp/veewee-osx-esd.V2kM/Packages/FirmwareUpdate.pkg -> /Volumes/OS X Base System/System/Installation/Packages/FirmwareUpdate.pkg
/tmp/veewee-osx-esd.V2kM/Packages/OSInstall.mpkg -> /Volumes/OS X Base System/System/Installation/Packages/OSInstall.mpkg
/tmp/veewee-osx-esd.V2kM/Packages/SecureBoot.pkg -> /Volumes/OS X Base System/System/Installation/Packages/SecureBoot.pkg
-- Copying in original BaseSystem dmg and chunklist..
-- Adding automated components..
-- Unmounting BaseSystem..
"disk4" unmounted.
"disk4" ejected.
-- Unmounting ESD..
"disk3" unmounted.
"disk3" ejected.
-- On Mavericks and later, the entire modified BaseSystem is our output dmg.
Preparing imaging engine…
Reading Driver Descriptor Map (DDM : 0)…
   (CRC32 $651204F3: Driver Descriptor Map (DDM : 0))
Reading Apple (Apple_partition_map : 1)…
   (CRC32 $D01936FD: Apple (Apple_partition_map : 1))
Reading disk image (Apple_HFS : 2)…
....................................................................................................................................................
   (CRC32 $B9E691B5: disk image (Apple_HFS : 2))
Adding resources…
....................................................................................................................................................
Elapsed Time: 44.270s
File size: 5725371873 bytes, Checksum: CRC32 $13B6715F
Sectors processed: 20971520, 13026129 compressed
Speed: 143.7Mbytes/sec
Savings: 46.7%
created: /Users/cmacedo/Desktop/osx-vm-templates/out/OSX_InstallESD_10.13.4_17E199.dmg
-- Fixing permissions..
-- Checksumming output image..
-- MD5: b4643fab138a5f4641b82c040aefd268
-- Done. Built image is located at out/OSX_InstallESD_10.13.4_17E199.dmg. Add this iso and its checksum to your template.
cmacedo@camilas-MBP ~/Desktop/osx-vm-templates (pr) $ 

** Using packer to build the image: ( errors were found in the template )

cmacedo@camilas-MBP ~/Desktop/bento (master) $ packer validate ../osx-vm-templates/packer/template.json 
Template validation failed. Errors are shown below.

Errors validating build 'parallels-iso'. 1 error(s) occurred:

* Bad source '../scripts/support/set_kcpassword.py': stat ../scripts/support/set_kcpassword.py: no such file or directory

Errors validating build 'virtualbox-iso'. 1 error(s) occurred:

* Bad source '../scripts/support/set_kcpassword.py': stat ../scripts/support/set_kcpassword.py: no such file or directory

Errors validating build 'virtualbox-ovf'. 1 error(s) occurred:

* source_path is required

Errors validating build 'vmware-iso'. 1 error(s) occurred:

* Bad source '../scripts/support/set_kcpassword.py': stat ../scripts/support/set_kcpassword.py: no such file or directory
cmacedo@camilas-MBP ~/Desktop/bento (master) $ 

After change the relative's paths to the places where the scripts are it is working, however, it stops in the ssh script.


cmacedo@camilas-MBP ~/Desktop/bento (master) $ packer build -only=virtualbox-iso -var 'iso_checksum=b4643fab138a5f4641b82c040aefd268' -var 'iso_url=/Users/cmacedo/Desktop/osx-vm-templates/out/OSX_InstallESD_10.13.4_17E199.dmg' macosx-10.13.json 
virtualbox-iso output will be in this color.

Warnings for build 'virtualbox-iso':

* A checksum type of 'none' was specified. Since ISO files are so big,
a checksum is highly recommended.

==> virtualbox-iso: Downloading or copying ISO
    virtualbox-iso: Downloading or copying: file:///Users/cmacedo/Desktop/osx-vm-templates/out/OSX_InstallESD_10.13.4_17E199.dmg
==> virtualbox-iso: Creating virtual machine...
==> virtualbox-iso: Creating hard drive...
==> virtualbox-iso: Creating forwarded port mapping for communicator (SSH, WinRM, etc) (host port 2308)
==> virtualbox-iso: Executing custom VBoxManage commands...
    virtualbox-iso: Executing: modifyvm packer-virtualbox-iso-1531211334 --audiocontroller hda
    virtualbox-iso: Executing: modifyvm packer-virtualbox-iso-1531211334 --boot1 dvd
    virtualbox-iso: Executing: modifyvm packer-virtualbox-iso-1531211334 --boot2 disk
    virtualbox-iso: Executing: modifyvm packer-virtualbox-iso-1531211334 --chipset ich9
    virtualbox-iso: Executing: modifyvm packer-virtualbox-iso-1531211334 --firmware efi
    virtualbox-iso: Executing: modifyvm packer-virtualbox-iso-1531211334 --hpet on
    virtualbox-iso: Executing: modifyvm packer-virtualbox-iso-1531211334 --keyboard usb
    virtualbox-iso: Executing: modifyvm packer-virtualbox-iso-1531211334 --memory 2048
    virtualbox-iso: Executing: modifyvm packer-virtualbox-iso-1531211334 --mouse usbtablet
    virtualbox-iso: Executing: modifyvm packer-virtualbox-iso-1531211334 --vram 128
    virtualbox-iso: Executing: storagectl packer-virtualbox-iso-1531211334 --name IDE Controller --remove
==> virtualbox-iso: Starting the virtual machine...
==> virtualbox-iso: Waiting 2s for boot...
==> virtualbox-iso: Typing the boot command...
==> virtualbox-iso: Waiting for SSH to become available...

@pietrocaselani
Copy link

Hi everyone!
Any updates here?
Do you consider merging this PR?

@egandro
Copy link

egandro commented Dec 19, 2018

Following the test performed.
==> virtualbox-iso: Waiting for SSH to become available...

Same issue here with 10.14.2.

No Idea how to fix this.

I played with the USB -> xhci and the mouse to be USB.

@itstehkman
Copy link

itstehkman commented Dec 24, 2018

@timsutton @americanhanko @tzeejay any updates on this PR? I am glad to help and review or make some PRs! think this is also a necessary patch in order to support Mojave as well (#99)

Can confirm that I am running into the same issue of waiting for SSH that @camilamacedo86 ran into, looking at the code to think about why that could be. Maybe the prepare_iso/support/pkg-postinstalll script doesnt setup sshd correctly for High Sierra, and maybe it is related to this comment about shadowhash not being interpreted correctly in High Sierra #82 (comment)

@jfpanisset
Copy link

Starting with 10.14/Mojave BaseSystem.dmg mounts as /Volumes/macOS Base System rather than /Volumes/OS X Base System

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants