class Vmdktool < Formula desc "Converts raw filesystems to VMDK files and vice versa" homepage "http://manned.org/vmdktool" url "https://people.freebsd.org/~brian/vmdktool/vmdktool-1.4.tar.gz" sha256 "981eb43d3db172144f2344886040424ef525e15c85f84023a7502b238aa7b89c" bottle do cellar :any_skip_relocation sha256 "3fa294be9d6e9e6b56435526520262aaa86f5909cc10b9ccf9d9670ae3ac0e3c" => :sierra sha256 "8604a90f9ad0f3b04767c021a4d24dacdcabd788767df56a45e3913231d4336e" => :el_capitan sha256 "f19ae3ac92ae4400c7139771f3a5ec07d32bf2e3ed49bfa7add445f8a680ef0c" => :yosemite end def install system "make", "CFLAGS='-D_GNU_SOURCE -g -O -pipe'" # The vmdktool Makefile isn't as well-behaved as we'd like: # 1) It defaults to man page installation in $PREFIX/man instead of # $PREFIX/share/man, and doesn't recognize '$MANDIR' as a way to # override this default. # 2) It doesn't do 'install -d' to create directories before installing # to them. # The maintainer (Brian Somers, brian@awfulhak.org) has been notified # of these issues as of 2017-01-25 but no fix is yet forthcoming. # There is no public issue tracker for vmdktool that we know of. # In the meantime, we can work around these issues as follows: bin.mkpath man8.mkpath inreplace "Makefile", "man/man8", "share/man/man8" system "make", "install", "PREFIX=#{prefix}" end test do # Create a blank disk image in raw format system "dd", "if=/dev/zero", "of=blank.raw", "bs=512", "count=20480" # Use vmdktool to convert to streamOptimized VMDK file system "#{bin}/vmdktool", "-v", "blank.vmdk", "blank.raw" # Inspect the VMDK with vmdktool output = shell_output("#{bin}/vmdktool -i blank.vmdk") assert_match "RDONLY 20480 SPARSE", output assert_match "streamOptimized", output end end