gdp / adm / gdp-debbuild.sh @ master
History | View | Annotate | Download (2.67 KB)
1 | 385d4794 | Eric Allman | #!/bin/sh |
---|---|---|---|
2 | |||
3 | 0a49de71 | Eric Allman | # |
4 | # This script assumes you have installed the following packages: |
||
5 | # build-essential |
||
6 | # devscripts |
||
7 | # debhelper |
||
8 | # |
||
9 | |||
10 | 385d4794 | Eric Allman | # 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 | 0ed4b4e5 | Eric Allman | Reset='[0m' # Text Reset |
25 | 385d4794 | Eric Allman | |
26 | # Regular Bold Underline High Intensity BoldHigh Intens Background High Intensity Backgrounds |
||
27 | 0ed4b4e5 | Eric Allman | Bla='[0;30m'; BBla='[1;30m'; UBla='[4;30m'; IBla='[0;90m'; BIBla='[1;90m'; On_Bla='[40m'; On_IBla='[0;100m'; |
28 | Red='[0;31m'; BRed='[1;31m'; URed='[4;31m'; IRed='[0;91m'; BIRed='[1;91m'; On_Red='[41m'; On_IRed='[0;101m'; |
||
29 | Gre='[0;32m'; BGre='[1;32m'; UGre='[4;32m'; IGre='[0;92m'; BIGre='[1;92m'; On_Gre='[42m'; On_IGre='[0;102m'; |
||
30 | Yel='[0;33m'; BYel='[1;33m'; UYel='[4;33m'; IYel='[0;93m'; BIYel='[1;93m'; On_Yel='[43m'; On_IYel='[0;103m'; |
||
31 | Blu='[0;34m'; BBlu='[1;34m'; UBlu='[4;34m'; IBlu='[0;94m'; BIBlu='[1;94m'; On_Blu='[44m'; On_IBlu='[0;104m'; |
||
32 | Pur='[0;35m'; BPur='[1;35m'; UPur='[4;35m'; IPur='[0;95m'; BIPur='[1;95m'; On_Pur='[45m'; On_IPur='[0;105m'; |
||
33 | Cya='[0;36m'; BCya='[1;36m'; UCya='[4;36m'; ICya='[0;96m'; BICya='[1;96m'; On_Cya='[46m'; On_ICya='[0;106m'; |
||
34 | Whi='[0;37m'; BWhi='[1;37m'; UWhi='[4;37m'; IWhi='[0;97m'; BIWhi='[1;97m'; On_Whi='[47m'; On_IWhi='[0;107m'; |
||
35 | 385d4794 | Eric Allman | |
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 | 6dd8873a | Eric Allman | while true |
62 | 385d4794 | Eric Allman | do |
63 | 6dd8873a | Eric Allman | case "$1" in |
64 | 385d4794 | Eric Allman | -e) |
65 | email=$2 |
||
66 | shift 2;; |
||
67 | -r) |
||
68 | root=$2 |
||
69 | shift 2;; |
||
70 | -v) |
||
71 | ver=$2 |
||
72 | shift 2;; |
||
73 | 6dd8873a | Eric Allman | --) |
74 | shift |
||
75 | break;; |
||
76 | 385d4794 | Eric Allman | 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 |