Skip to content

Instantly share code, notes, and snippets.

@steigr steigr/com.docker.hyperkit
Last active May 27, 2020

Embed
What would you like to do?
Second disk for Docker-for-Desktop
#!/usr/bin/env ruby
newDiskName = "ZFS.raw"
newDiskSize = "20g"
args ||= []
diskArg = ""
ARGV.size.times do |idx|
if ARGV[idx] =~ /Docker\.raw$/
diskArg = ARGV[idx]
diskPath = diskArg.split(",").last
newDisk = diskPath.sub("Docker.raw",newDiskName)
`truncate -s '#{newDiskSize}' '#{newDisk}'` unless File.exist?(newDisk)
args << ARGV[idx].sub(diskPath,newDisk)
else
args << ARGV[idx]
end
end
args << "-s"
args << "8" + diskArg[1..-1]
exec(__FILE__ + ".orig",*args)
#!sh
# move the original hyperkit binary to a known path:
BASE_PATH=/Applications/Docker.app/Contents/Resources/bin
mv ${BASE_PATH}/com.docker.hyperkit ${BASE_PATH}/com.docker.hyperkit.orig
# now place the wrapper
cat > ${BASE_PATH}/com.docker.hyperkit <<'EOF'
# contents of com.docker.hyperkit gist from https://gist.github.com/steigr/7bb7d6831bddcd4e463e79cfefb86fb4
EOF
# ... and make it executable
chmod 0755 ${BASE_PATH}/com.docker.hyperkit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.