source: hybrid/branches/releng-10/nanobsd/tools/upload-image.sh@ 13423

Last change on this file since 13423 was 13423, checked in by rick, 9 years ago

Using unbound from ports allows clear design.

The local_unbound scripts are really messy and not tailored towards our needs,
moving to the port version which is less intrusive and does not try to be 'smart'.

While here include dnsmasq and nsd (again) allowing us to toy around with autoritive nameservers.

  • Property svn:executable set to *
File size: 1.3 KB
Line 
1#!/bin/sh
2#
3# Upload image to the 'distribution' server. First try WL network,
4# else use inet as last resort. Need to have shell access to distribution server.
5#
6# XXX: Needs Type and such as well properly
7#
8# Rick van der Zwet <info@rickvanderzwet.nl>
9
10SERVERS="sunfire.wleiden.net sunfire.wirelessleiden.nl"
11TIMESTAMP=`date "+%Y%m%d-%H%M"`
12BASEDIR=`dirname $0`
13SSH_USER=${SSH_USER:-$USER}
14TYPE="$1"
15RELEASE="$2"
16
17. $BASEDIR/package-build.inc.sh
18
19if [ -z "$RELEASE" ]; then
20 echo "Usage: $0 <full|image> <release_name>"
21 exit 1
22fi
23
24# Make sure we find the right image
25if [ "$TYPE" = "full" ]; then
26 find_disk_full ""
27elif [ "$TYPE" = "image" ]; then
28 find_disk_image ""
29else
30 echo "Usage: $0 <full|image> <release_name>"
31 exit 1
32fi
33
34check_reachable() {
35 ping -c 2 -t 1 -q $1 1>/dev/null 2>/dev/null
36 return $?
37}
38
39# XXX: Hack this should actually be done during building phase
40echo "# Compressing image '$IMG'"
41gzip -v -k -f $IMG
42IMG="$IMG.gz"
43
44echo "# Trying to upload to server, alarm messages are normal"
45# Upload the image to the defined place
46for SERVER in $SERVERS; do
47 if check_reachable $SERVER; then
48 TARGET="$SSH_USER@$SERVER:/usr/local/www/images/$RELEASE/node-$TYPE-$TIMESTAMP.img.gz"
49 echo "# Source: $IMG"
50 echo "# Target: $TARGET"
51 echo "# To cancel, please CTRL+C within 3 seconds"
52 sleep 3
53 scp $IMG $TARGET
54 exit $?
55 fi
56done
57
Note: See TracBrowser for help on using the repository browser.