diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2017-08-09 10:11:36 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2017-08-09 10:11:36 +0200 |
commit | 2fd87d0c656fb1806b33ef3fcec7e8c7f52779a4 (patch) | |
tree | ce96cc18bd0da66245c0b2a948ad43b71486abd4 | |
parent | 43dc85ba7873de02518d112ab2d2cb460654fa46 (diff) |
Add upload script
-rwxr-xr-x | upload | 29 |
1 files changed, 29 insertions, 0 deletions
@@ -0,0 +1,29 @@ +#! /usr/bin/env bash + +# Upload the Build OS images to a TFTP server. +# +# If the tftp server host is not specified, then build@build-cache is +# assumed. The images are uploaded to /var/lib/tftpboot/buildos/. +# +usage="usage: $0 [<user>@<host>]" + +owd="$(pwd)" +trap "{ cd '$owd'; exit 1; }" ERR +set -o errtrace # Trap in functions. + +function info () { echo "$*" 1>&2; } +function error () { info "$*"; exit 1; } + +if [ -z "$1" ]; then + host="build@build-cache" +else + host="$1" +fi + +# Use --delay-updates to make things a bit more atomic (we don't want to +# start rebooting before kernel/initrd are finished syncing). The cost +# is a bit more disk space used to temporarily hold copies. +# +rsync -v --progress -lpt -c --copy-unsafe-links --delay-updates \ + buildos-image buildos-initrd buildos-buildid \ + $host:/var/lib/tftpboot/buildos/ |