Skip to content
Snippets Groups Projects
fetchUpstream 1.39 KiB
Newer Older
  • Learn to ignore specific revisions
  • James Goppert's avatar
    James Goppert committed
    #!/bin/bash
    
    QSERIAL_TAG=004e3de552fe25fee593dfcb03e2ffa82cb0b152
    
    MAVLINK_VERSION=1.0.6
    
    James Goppert's avatar
    James Goppert committed
    
    
    libList="mavlink qserialport"
    
    topDir=$PWD
    
    James Goppert's avatar
    James Goppert committed
    
    
    
    function fetch_git
    
    James Goppert's avatar
    James Goppert committed
    {
    
        name=$1
        url=$2
        tag=$4
    
        echo
        echo updating: $name @ $url to tag $tag
        cd $topDir
    	rm -rf $name
    	git clone $url
        cd $name && git checkout $tag && rm -rf .git
        cd $topDir
    
    function processLib
    {
        lib=$1
        case $lib in
    
    James Goppert's avatar
    James Goppert committed
    		"qserialport")
    
                fetch_git qserialport git://gitorious.org/inbiza-labs/qserialport.git master $QSERIAL_TAG
    
    James Goppert's avatar
    James Goppert committed
    			;;
    		"mavlink") 
    
                cd $topDir/mavlink
                rm -rf  VERSION mavlink* include lib share *.zip
                wget https://github.com/downloads/mavlink/mavlink/mavlink-${MAVLINK_VERSION}.zip
                unzip mavlink-${MAVLINK_VERSION}.zip
                mv mavlink-${MAVLINK_VERSION}/* .
                rm -rf  mavlink*
                echo $MAVLINK_VERSION > VERSION
                cd $topDir
    
    James Goppert's avatar
    James Goppert committed
    			;;
    		"all")
    
                for lib in $libList
                do
                    $0 $lib
                done
    
    James Goppert's avatar
    James Goppert committed
    			exit 0
    			;;
    		"exit")
    			exit 0
    			;;
    		*)
    
    			echo unknown lib, possiblities are: $libList
    
    James Goppert's avatar
    James Goppert committed
    			exit 1
    	esac
    
    James Goppert's avatar
    James Goppert committed
    
    
    if [ $# == 0 ]
    then
    
    James Goppert's avatar
    James Goppert committed
    
    
        #menu 
        echo This script grabs upstream releases.
        PS3='Please enter your choice: '
        select OPT in $libList all exit
        do
            processLib $OPT
        done
    
    elif [ $# == 1 ]
    then
        lib=$1
        processLib $lib
    else
        echo usage: $0 lib
    fi