Skip to content

Instantly share code, notes, and snippets.

@steigr
Last active May 27, 2020 05:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save steigr/7bb7d6831bddcd4e463e79cfefb86fb4 to your computer and use it in GitHub Desktop.
Save steigr/7bb7d6831bddcd4e463e79cfefb86fb4 to your computer and use it in GitHub Desktop.
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