diff options
author | makefu <root@pigstarter.de> | 2013-01-07 12:06:33 +0000 |
---|---|---|
committer | makefu <root@pigstarter.de> | 2013-01-07 12:06:33 +0000 |
commit | ad376d1dab439f9d28bf7ff02bfa7afed7444037 (patch) | |
tree | f09e0ed2c0da0e5e467188bb88464d22e2d2c7a1 /minikrebs/upgrade | |
parent | b2df392966df95102bb8cf4ee3f043d4b6ed633f (diff) | |
parent | 6ea50f3c77350e715649aa45061beb1701ebaa95 (diff) |
Merge branch 'master' of https://github.com/krebscode/painload
Diffstat (limited to 'minikrebs/upgrade')
-rwxr-xr-x | minikrebs/upgrade | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/minikrebs/upgrade b/minikrebs/upgrade new file mode 100755 index 00000000..e36ed5ad --- /dev/null +++ b/minikrebs/upgrade @@ -0,0 +1,31 @@ +#!/bin/sh +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} \ + && mtd write /tmp/firmware.bin firmware \ + && reboot" + kill $SERVER_PID +else + echo "cannot find ar71xx build, aborting" + exit 1 +fi |