github.com/vmware/govmomi@v0.37.2/govc/test/images/update.sh (about)

     1  #!/bin/bash
     2  
     3  pushd $(dirname $0)
     4  
     5  # Sadly, the ttylinux project was abandoned in late 2015.
     6  # But this release still serves us well.
     7  base_url=https://github.com/dougm/packer-ttylinux/releases/download/16.1u2
     8  ttylinux="ttylinux-pc_i486-16.1"
     9  files="${ttylinux}.iso ${ttylinux}-live.ova ${ttylinux}.ova"
    10  tarbin="tar"
    11  if [ "$(uname)" = "Darwin" ]; then
    12    # macOS BSD tar creates additional entries that govc tar archive reader
    13    # chokes on (instead of ignoring). Use GNU tar instead.
    14    tarbin="gtar"
    15  fi
    16  
    17  for name in $files ; do
    18    wget -qO $name $base_url/$name
    19  done
    20  
    21  wget -qN https://github.com/icebreaker/floppybird/raw/master/build/floppybird.img
    22  
    23  # extract ova so we can also use the .vmdk and .ovf files directly
    24  $tarbin -xvf ${ttylinux}.ova
    25  
    26  # create an ova with "bad" checksum in manifest by
    27  # modifying/replacing .mf in copy of ${ttylinux}.ova
    28  mkdir -p "$(pwd)/tmp"
    29  $tarbin xv -C "$(pwd)/tmp" -f ${ttylinux}.ova
    30  pushd "$(pwd)/tmp"
    31  sed 's/=.*$/= 5e82716003a1bff5b1d27bbd7d1e83addc881503/g' < ${ttylinux}.mf > ${ttylinux}-bad-checksum.mf
    32  mv ${ttylinux}-bad-checksum.mf ${ttylinux}.mf
    33  popd
    34  $tarbin cv -C "$(pwd)/tmp" -f ${ttylinux}-bad-checksum.ova .
    35  rm -fr "$(pwd)/tmp"
    36  
    37  popd