Ignore:
Timestamp:
Apr 26, 2012, 3:11:58 PM (13 years ago)
Author:
rick
Message:

I also like to use it for deployments.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/releng-9.0/nanobsd/tools/image

    r10591 r10592  
    1717#
    1818# Arguments:
    19 # build              - Build NanoBSD parts which are not build yet
    20 # build force kernel - Build NanoBSD and force rebuilding the kernel
    21 # build force world  - Build NanoBSD and force rebuilding world
    22 # rebuild            - Rebuild NanoBSD (aka force rebuilding all)
     19# build                         - Build NanoBSD parts which are not build yet
     20# build force kernel            - Build NanoBSD and force rebuilding the kernel
     21# build force world             - Build NanoBSD and force rebuilding world
     22# rebuild                       - Rebuild NanoBSD (aka force rebuilding all)
     23# deploy on <node> [and reboot] - Deploy the image on node and reboot if needed
    2324EOF
    2425}
     
    4546  FORCE_KERNEL="yes"
    4647  FORCE_WORLD="yes"
     48elif [ "$1" = "deploy" -a "$2" = "on" ]; then
     49  if [ -z "$3" ]; then
     50      echo "Argument Error - '$3'"; exit 128
     51  fi
     52  host=$3
     53  do_reboot=false
     54  if [ -n "$4" -o -n "$5" ]; then
     55    if [ "$4" = "and" -a "$5" = "reboot" ]; then
     56      do_reboot=true
     57    else
     58      echo "Argument Error - '$4 $5'"; exit 128
     59    fi
     60  fi
     61 
     62  # Find object directory
     63  img=${OBJDIR}/_.disk.image
     64
     65  if [ ! -r "$img" ]; then
     66    p_err Source $img does not exists
     67    exit 1
     68  fi
     69
     70  prompt_timeout=5
     71  p_warn "Going to DEPLOY $img to $host"
     72  $do_reboot && p_warn "AND will REBOOT the $host"
     73  p_warn "Press CTRL+C in $prompt_timeout seconds to CANCEL"
     74  sleep $prompt_timeout
     75
     76  ssh $host mount || exit 1
     77  cat $img | ssh $host /tools/update || exit 1
     78  if do_reboot; then
     79    ssh $host reboot
     80    exit 0
     81  fi
    4782else
    4883  echo "Argument Error - '$1'"; exit 128
Note: See TracChangeset for help on using the changeset viewer.