aboutsummaryrefslogtreecommitdiff
path: root/upload-os
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-10-07 14:14:43 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-10-07 14:14:43 +0200
commit47d3c19dda929d5c2591b868c25f1c0c740087c5 (patch)
tree1f31ec24f0b82d407d1dca8df85e47c979ec372f /upload-os
parenta32cc284d1c548dde24a1356887a25efb1583c7b (diff)
Rename upload to upload-os
Diffstat (limited to 'upload-os')
-rwxr-xr-xupload-os29
1 files changed, 29 insertions, 0 deletions
diff --git a/upload-os b/upload-os
new file mode 100755
index 0000000..b573806
--- /dev/null
+++ b/upload-os
@@ -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-devel/.
+#
+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-devel/