fetchUpstream.sh 1.35 KB
Newer Older
James Goppert's avatar
James Goppert committed
1
#!/bin/bash
2
QSERIAL_TAG=004e3de552fe25fee593dfcb03e2ffa82cb0b152
3
MAVLINK_VERSION=1.0.0
James Goppert's avatar
James Goppert committed
4

5 6 7
libList="mavlink qserialport"

topDir=$PWD
James Goppert's avatar
James Goppert committed
8

9 10

function fetch_git
James Goppert's avatar
James Goppert committed
11
{
12 13 14 15 16 17 18 19 20 21 22
    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
James Goppert's avatar
James Goppert committed
23 24
}

25 26 27 28
function processLib
{
    lib=$1
    case $lib in
James Goppert's avatar
James Goppert committed
29
		"qserialport")
30
            fetch_git qserialport git://gitorious.org/inbiza-labs/qserialport.git master $QSERIAL_TAG
James Goppert's avatar
James Goppert committed
31 32
			;;
		"mavlink") 
33 34 35 36 37 38 39
            rm -rf mavlink
            mavlinkName=mavlink-$MAVLINK_VERSION-Linux
            wget https://github.com/downloads/mavlink/mavlink/$mavlinkName.tar.gz
            tar -xzvf $mavlinkName.tar.gz
            mv  $mavlinkName/usr/local/include/mavlink mavlink
            rm -rf $mavlinkName
            rm -rf $mavlinkName.tar.gz
James Goppert's avatar
James Goppert committed
40 41
			;;
		"all")
42 43 44 45
            for lib in $libList
            do
                $0 $lib
            done
James Goppert's avatar
James Goppert committed
46 47 48 49 50 51
			exit 0
			;;
		"exit")
			exit 0
			;;
		*)
52
			echo unknown lib, possiblities are: $libList
James Goppert's avatar
James Goppert committed
53 54
			exit 1
	esac
55 56
}

James Goppert's avatar
James Goppert committed
57

58 59
if [ $# == 0 ]
then
James Goppert's avatar
James Goppert committed
60

61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
    #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