Project

General

Profile

Statistics
| Branch: | Tag: | Revision:

gdp / adm / gdp-debbuild.sh @ master

History | View | Annotate | Download (2.67 KB)

1
#!/bin/sh
2

    
3
#
4
#  This script assumes you have installed the following packages:
5
#	build-essential
6
#	devscripts
7
#	debhelper
8
#
9

    
10
# staging area for building the package
11
stage=$HOME/gdp-stage
12

    
13
# email address for maintainer
14
email=$USER@cs.berkeley.edu
15

    
16
# address of repository
17
repo=repoman@repo.eecs.berkeley.edu:projects/swarmlab/gdp.git
18

    
19
# root of source tree
20
root=UNKNOWN
21

    
22

    
23

    
24
Reset=''    # Text Reset
25

    
26
# Regular             Bold                  Underline             High Intensity        BoldHigh Intens       Background            High Intensity Backgrounds
27
Bla='';     BBla='';    UBla='';    IBla='';    BIBla='';   On_Bla='';    On_IBla='';
28
Red='';     BRed='';    URed='';    IRed='';    BIRed='';   On_Red='';    On_IRed='';
29
Gre='';     BGre='';    UGre='';    IGre='';    BIGre='';   On_Gre='';    On_IGre='';
30
Yel='';     BYel='';    UYel='';    IYel='';    BIYel='';   On_Yel='';    On_IYel='';
31
Blu='';     BBlu='';    UBlu='';    IBlu='';    BIBlu='';   On_Blu='';    On_IBlu='';
32
Pur='';     BPur='';    UPur='';    IPur='';    BIPur='';   On_Pur='';    On_IPur='';
33
Cya='';     BCya='';    UCya='';    ICya='';    BICya='';   On_Cya='';    On_ICya='';
34
Whi='';     BWhi='';    UWhi='';    IWhi='';    BIWhi='';   On_Whi='';    On_IWhi='';
35

    
36
warning()
37
{
38
	echo "${Yel}${On_Bla}[W] $1${Reset}"
39
}
40

    
41
error()
42
{
43
	echo "${Cya}${On_bla}[E] $1${Reset}"
44
}
45

    
46
fatal()
47
{
48
	echo "${Red}${On_Whi}[F] $1${Reset}" >&2
49
	exit 1
50
}
51

    
52

    
53
args=`getopt e:r:v: $*`
54
if [ $? != 0 ]
55
then
56
	fatal "Usage: [-e email] -r srcroot -v version XXX"
57
fi
58
set -- $args
59

    
60
ver=UNKNOWN
61
while true
62
do
63
	case "$1" in
64
	   -e)
65
		email=$2
66
		shift 2;;
67
	   -r)
68
		root=$2
69
		shift 2;;
70
	   -v)
71
		ver=$2
72
		shift 2;;
73
	   --)
74
		shift
75
		break;;
76
	esac
77
done
78

    
79
echo email=$email
80
echo root=$root
81
echo stage=$stage
82
echo ver=$ver
83
if [ "$ver" = "UNKNOWN" ]
84
then
85
	fatal "-v (version) flag must be specified"
86
fi
87

    
88
if [ "$root" = "UNKNOWN" ]
89
then
90
	warning "using staging area as source root"
91

    
92
	[ -d $stage ] || mkdir $stage || fatal "cannot access $stage"
93
	root=$stage
94
	cd $stage
95
	[ -e gdp-$ver ] && rm -rf gdp-$ver
96
	git clone --depth 1 $repo gdp-$ver
97
	rm -rf gdp-$ver/.git*
98
else
99
	cd $root
100
	[ -d gdp ] || fatal "cannot find gdp source tree"
101
	[ -d gdp-$ver ] && rm gdp-$ver
102
	ln -s gdp gdp-$ver || fatal "cannot create gdp-$ver"
103
fi
104
tar czf gdp_$ver.orig.tar.gz --exclude '.git*' gdp-$ver
105
cd gdp-$ver
106
debuild -us -uc