Skip to content

Commit 99cb5c5

Browse files
committed
- refactor REPOS list and shared functions into a common include
- add new repos - add delete script to remove tags (branches todo) - add auto-confirm flag to apt-get installs in build.sh (closes #2)
1 parent 36005a0 commit 99cb5c5

9 files changed

Lines changed: 137 additions & 53 deletions

File tree

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,7 @@ RRLP
1212
smqueue
1313
sqlite3
1414
subscriberRegistry
15+
asterisk-config
16+
asterisk
17+
libsqliteodbc
18+
system-config

build.sh

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,13 @@
1717
# See the COPYING file in the main directory for details.
1818
#
1919

20-
sayAndDo () {
21-
echo $@
22-
eval $@
23-
if [ $? -ne 0 ]; then
24-
echo "# ERROR: command failed!"
25-
exit 1
26-
fi
27-
}
20+
source $(dirname $0)/common.source
2821

2922
installIfMissing () {
3023
dpkg -s $@ > /dev/null
3124
if [ $? -ne 0 ]; then
3225
echo "# - missing $@, installing dependency"
33-
sudo apt-get install $@
26+
sudo apt-get install $@ -y
3427
fi
3528
}
3629

clone.sh

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,9 @@
1717
# See the COPYING file in the main directory for details.
1818
#
1919

20-
sayAndDo () {
21-
echo $@
22-
eval $@
23-
if [ $? -ne 0 ]; then
24-
echo "# ERROR: command failed!"
25-
exit 1
26-
fi
27-
}
20+
source $(dirname $0)/common.source
2821

29-
for component in a53 CommonLibs libzmq NodeManager openbts RRLP smqueue sqlite3 subscriberRegistry
22+
for component in $REPOS
3023
do
3124
if [ ! -d $component ]; then
3225
echo "# cloning $component"

common.source

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#
2+
# Copyright 2014 Range Networks, Inc.
3+
#
4+
# This program is free software: you can redistribute it and/or modify
5+
# it under the terms of the GNU Affero General Public License as published by
6+
# the Free Software Foundation, either version 3 of the License, or
7+
# (at your option) any later version.
8+
#
9+
# This program is distributed in the hope that it will be useful,
10+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
# GNU Affero General Public License for more details.
13+
#
14+
# You should have received a copy of the GNU Affero General Public License
15+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
16+
# See the COPYING file in the main directory for details.
17+
#
18+
19+
sayAndDo () {
20+
echo $@
21+
eval $@
22+
if [ $? -ne 0 ]; then
23+
echo "# ERROR: command failed!"
24+
exit 1
25+
fi
26+
}
27+
28+
REPOS="\
29+
a53 \
30+
asterisk \
31+
asterisk-config \
32+
CommonLibs \
33+
libsqliteodbc \
34+
libzmq NodeManager \
35+
openbts \
36+
RRLP \
37+
smqueue \
38+
sqlite3 \
39+
subscriberRegistry \
40+
system-config \
41+
"

delete.sh

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
#!/bin/bash
2+
#
3+
# Copyright 2014 Range Networks, Inc.
4+
#
5+
# This program is free software: you can redistribute it and/or modify
6+
# it under the terms of the GNU Affero General Public License as published by
7+
# the Free Software Foundation, either version 3 of the License, or
8+
# (at your option) any later version.
9+
#
10+
# This program is distributed in the hope that it will be useful,
11+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
# GNU Affero General Public License for more details.
14+
#
15+
# You should have received a copy of the GNU Affero General Public License
16+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
17+
# See the COPYING file in the main directory for details.
18+
#
19+
20+
source $(dirname $0)/common.source
21+
22+
usage () {
23+
echo "# usage: ./delete.sh component-directory (tag/branch current-tag new-tag)"
24+
exit 1
25+
}
26+
27+
# What component do we want to manipulate?
28+
if [ -z "$1" ]; then
29+
usage
30+
elif [ ! -d $1 ]; then
31+
usage
32+
else
33+
COMPONENT=$1
34+
fi
35+
36+
# Are we deleting a tag or branch?
37+
if [ -z "$2" ]; then
38+
read -r -p "# Do you want to delete a tag or branch? " TYPE
39+
elif [ $2 == "tag" ]; then
40+
TYPE="tag"
41+
elif [ $2 == "branch" ]; then
42+
TYPE="branch"
43+
else
44+
usage
45+
fi
46+
47+
# Which one should be deleted?
48+
if [ -z "$3" ]; then
49+
echo "# Here are the valid choices for that component:"
50+
cd $COMPONENT
51+
if [ $TYPE == "tag" ]; then
52+
git tag
53+
elif [ $TYPE == "branch" ]; then
54+
git branch -a
55+
fi
56+
cd ..
57+
read -r -p "# Which $TYPE would you like to delete? " NAME
58+
else
59+
NAME=$3
60+
fi
61+
62+
# Really, truly? Alrighty, execute.
63+
read -r -p "# To delete $TYPE $NAME, answer \"yes\" " ANSWER
64+
if [ $ANSWER == "yes" ]; then
65+
cd $COMPONENT
66+
if [ $TYPE == "tag" ]; then
67+
echo "# - deleting..."
68+
sayAndDo git tag -d $NAME
69+
echo "# - pushing to origin..."
70+
sayAndDo git push origin :refs/tags/$NAME
71+
elif [ $TYPE == "branch" ]; then
72+
echo "# - Sorry, branch deletes haven't been tested. Bailing."
73+
exit 1
74+
#echo "# - deleting..."
75+
#sayAndDo git branch -d $NAME
76+
#echo "# - pushing to origin..."
77+
#sayAndDo git push origin :$NAME
78+
fi
79+
else
80+
echo "# - better safe than sorry, cancelling..."
81+
fi

pull.sh

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,9 @@
1717
# See the COPYING file in the main directory for details.
1818
#
1919

20-
sayAndDo () {
21-
echo $@
22-
eval $@
23-
if [ $? -ne 0 ]; then
24-
echo "# ERROR: command failed!"
25-
exit 1
26-
fi
27-
}
20+
source $(dirname $0)/common.source
2821

29-
for component in a53 CommonLibs libzmq NodeManager openbts RRLP smqueue sqlite3 subscriberRegistry
22+
for component in $REPOS
3023
do
3124
if [ -d $component ]; then
3225
echo "# pulling $component"

rename.sh

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,7 @@
1717
# See the COPYING file in the main directory for details.
1818
#
1919

20-
sayAndDo () {
21-
echo $@
22-
eval $@
23-
if [ $? -ne 0 ]; then
24-
echo "# ERROR: command failed!"
25-
exit 1
26-
fi
27-
}
20+
source $(dirname $0)/common.source
2821

2922
usage () {
3023
echo "# usage: ./rename.sh component-directory (tag/branch current-tag new-tag)"

state.sh

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,7 @@
1717
# See the COPYING file in the main directory for details.
1818
#
1919

20-
sayAndDo () {
21-
echo $@
22-
eval $@
23-
if [ $? -ne 0 ]; then
24-
echo "# ERROR: command failed!"
25-
exit 1
26-
fi
27-
}
20+
source $(dirname $0)/common.source
2821

2922
usage () {
3023
echo "# usage: ./state.sh (branches, tags)"
@@ -41,7 +34,7 @@ else
4134
usage
4235
fi
4336

44-
for component in a53 CommonLibs libzmq NodeManager openbts RRLP smqueue sqlite3 subscriberRegistry
37+
for component in $REPOS
4538
do
4639
if [ -d $component ]; then
4740
echo "########################################################################"

switchto.sh

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,7 @@
1717
# See the COPYING file in the main directory for details.
1818
#
1919

20-
sayAndDo () {
21-
echo $@
22-
eval $@
23-
if [ $? -ne 0 ]; then
24-
echo "# ERROR: command failed!"
25-
exit 1
26-
fi
27-
}
20+
source $(dirname $0)/common.source
2821

2922
usage () {
3023
echo "# usage: ./switchto.sh branch-name"
@@ -35,7 +28,7 @@ if [ -z "$1" ]; then
3528
usage
3629
fi
3730

38-
for component in a53 CommonLibs libzmq NodeManager openbts RRLP smqueue sqlite3 subscriberRegistry
31+
for component in $REPOS
3932
do
4033
if [ -d $component ]; then
4134
echo "########################################################################"

0 commit comments

Comments
 (0)