github.com/cloud-foundations/dominator@v0.0.0-20221004181915-6e4fee580046/scripts/image-pusher/push-to-seed (about)

     1  #! /bin/bash --posix
     2  #
     3  # push-to-seed sub image image_server
     4  #
     5  # Push an image to a sub which is running a seed image designed for importing
     6  # an image. The seed image should implement the make-bootable service such that
     7  # the command "service make-bootable-start" will make the parent block device
     8  # of the destination file-system bootable.
     9  # The following parameters are required:
    10  #   sub:          the hostname of the sub
    11  #   image:        the image to push
    12  #   image_server: the hostname of the image server
    13  
    14  set -o nounset
    15  
    16  if [ "$#" -ne 3 ]; then
    17      echo "Usage: push-to-seed sub image image_server"
    18      exit 1
    19  fi
    20  
    21  readonly sub="$1"
    22  readonly image="$2"
    23  readonly image_server="$3"
    24  
    25  echo 'Pushing image content'
    26  subtool -subHostname="$sub" \
    27          -deleteBeforeFetch=true \
    28          -filterFile=/dev/null \
    29          -imageServerHostname="$image_server" \
    30          -showTimes=true \
    31          -triggersString='[]' \
    32    push-image "$image" || exit
    33  
    34  echo 'Making bootable'
    35  subtool -subHostname="$sub" \
    36          -showTimes=true \
    37          -triggersString='[{"MatchLines":[".*"],"Service":"make-bootable"}]' \
    38    push-file "$HOME/etc/make-bootable" /make-bootable