Sha256: 53daacd9cb7d4aa722162c5e66ce3940223e621386bd388906301d4b5ac165f6

Contents?: true

Size: 964 Bytes

Versions: 2

Compression:

Stored size: 964 Bytes

Contents

#!/usr/bin/env ruby

require 'hackmac'
include Hackmac
include Utils

$config = Hackmac::Config.load

dev = ARGV.shift or fail "need usb device"

mountpoint = '/Volumes/USB'
mountpoint_efi = '/Volumes/USB_EFI'

if File.directory?(mountpoint)
  puts " *** #{mountpoint} already mounted!".red
  exit 1
end

if File.directory?(mountpoint_efi)
  puts " *** #{mountpoint_efi} already mounted!".red
  exit 1
end

ask("Really erase #{dev.inspect} and install #{$config.usb.os.inspect}? (y/n) ") or exit

x %{diskutil partitionDisk #{dev.inspect} GPT JHFS+ "USB" 100%}

x %{sudo "#{$config.usb.os}/Contents/Resources/createinstallmedia" --volume #{mountpoint.inspect} --nointeraction}

x %{sudo mkdir -p #{mountpoint_efi.inspect}}
x %{sudo mount -t msdos #{('/dev/' + dev + 's1').inspect} #{mountpoint_efi.inspect}}
cd mountpoint_efi do
  x %{sudo chown $USER .}
  x %{git init}
  x %{git remote add origin #{$config.efi.source.inspect}}
  x %{git pull origin master}
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hackmac-1.1.0 bin/usb
hackmac-1.0.5 bin/usb