Code Search for Developers
 
 
  

push-upgrade.sh from EmStar at Krugle


Show push-upgrade.sh syntax highlighted

#!/bin/bash

usage() {
        echo "push-upgrade.sh [--ip ADDRESS / --node NODE] <build tarfile>"
        echo
	echo "  Specify either IP address or node ID.  If node ID "
	echo "  is specified, assumes address is 192.168.11.<NODE>."
        echo 
        echo "  The build tarfile is assumed to have an intall script"
	echo "  in it, called ./tmp/UPGRADE.sh"
	echo
	echo "  This script will copy the tar file to /tmp on the node,"
	echo "  extract the upgrade script, and then execute the script."
	echo
	exit 1
} 

install() {
    if ! scp $1 root@$ADDR:/tmp/NEW_BUILD.tgz
	then
	echo "Unable to push upgrade file."
	exit 1
    fi
    if ! ssh root@$ADDR "tar -C / -xzvf /tmp/NEW_BUILD.tgz ./tmp/UPGRADE.sh"
	then
	echo "Unable to extract upgrade script file."
	echo "Make sure it is in archive as ./tmp/UPGRADE.sh"
	exit 1
    fi
    if ! ssh root@$ADDR "sh /tmp/UPGRADE.sh"
	then
	echo "*** WARNING *** upgrade appears to have FAILED"
	echo "CHECK NODE BEFORE POWERING OFF"
	exit 1
    fi
    echo "Success!"
    exit 0
}

NETWORK=192.168.11
ADDRSET=0

while [ $1 ] ; do 
    case "$1" in 
      -h)
	usage
	;;
      --help)
	usage
	;;
      -?)
	usage
	;;
      --ip)
        if [[ $ADDRSET == 1 ]]
	    then
	    echo "Set ip or node, not both." 
	    exit 1 
	fi
        ADDR=$2
	ADDRSET=1
        shift
	shift
	;;
      --node)
        if [[ $ADDRSET == 1 ]]
	    then 
	    echo "Set ip or node, not both." 
	    exit 1
	fi
        ADDR=$NETWORK.$2
	ADDRSET=1
        shift
	shift
	;;
      *)
        if [[ $ADDRSET == 0 ]]
	    then 
	    echo "Please provide ip or node id."
	    exit 1
	fi
        install $1
	;;
    esac
done

echo "No installation file specified?"
exit 1



See more files for this project here

EmStar

EmStar is a software system for developing and deploying wireless sensor networks involving Linux-based platforms. As the wireless sensor network community has attempted to deploy more complex designs---large-scale, long-lived systems that need self-organization and adaptivity---a number of difficult software design issues have arisen. Advances in software design have not kept pace with the capabilities of hardware. This is because designing for an adaptive, efficient, and useful sensor network has turned out to be surprisingly complex and difficult. EmStar is a Linux-based software framework, whose goal is to dramatically reduce this complexity, enabling work to be shared and reused, and simplifying and speeding the design of new sensor network applications.

Project homepage: http://cvs.cens.ucla.edu/emstar/
Programming language(s): C,Shell Script
License: other

  ceiling-install.pl
  component-paths.pl
  echoall.sh
  flashall
  push-upgrade.sh
  tosinstall
  tosinstall-jtag
  tosremake
  uisp-stargate
  uisp-ucb-20020626
  uisp-ucb-20031126