summaryrefslogtreecommitdiffstats
path: root/minikrebs/upgrade
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2013-01-14 14:46:22 +0100
committermakefu <github@syntax-fehler.de>2013-01-14 14:46:22 +0100
commitdbe2d838ba6834788265029162b2dd7d82473335 (patch)
treea4eb38f7fc91d91269b6f83453de62242c6ddc23 /minikrebs/upgrade
parent5a782f6c8f7923f9f415afd504ce6e71acbc7fef (diff)
parentabf9916bc1add17888308877fa4eb9da330297ef (diff)
Merge branch 'master' of github.com:krebscode/painload
Conflicts: god/temper/Makefile god/temper/collectd-temper.sh
Diffstat (limited to 'minikrebs/upgrade')
-rwxr-xr-xminikrebs/upgrade31
1 files changed, 31 insertions, 0 deletions
diff --git a/minikrebs/upgrade b/minikrebs/upgrade
new file mode 100755
index 00000000..36ef91cc
--- /dev/null
+++ b/minikrebs/upgrade
@@ -0,0 +1,31 @@
+#!/bin/bash
+OWN_ADDR=${OWN_ADDR:-192.168.0.1}
+PORT=8080
+IMAGE=${IMAGE:-openwrt-ar71xx-generic-tl-wr703n-v1-squashfs-factory.bin}
+cd $(dirname $(readlink -f $0))
+if [ x"${1:-}" == x ];then
+ echo "usage: $0 ADDRESS"
+ echo
+ echo "ENVIRONMENT:"
+ echo " OWN_ADDR (currently $OWN_ADDR)"
+ echo " IMAGE (currently $IMAGE)"
+ echo " PORT (currently $PORT)"
+
+ exit 1
+fi
+
+IP=$1
+cd builder/bin/ar71xx/
+
+if [ -e "$IMAGE" ];then
+ python2 -m SimpleHTTPServer $PORT &
+ sleep 1
+ SERVER_PID=$!
+ ssh root@$IP "wget -O /tmp/firmware.bin http://${OWN_ADDR}:${PORT}/${IMAGE} \
+ && /sbin/mtd write /tmp/firmware.bin firmware \
+ && /sbin/reboot"
+ kill $SERVER_PID
+else
+ echo "cannot find ar71xx build, aborting"
+ exit 1
+fi