Skip to content

Commit 2d3dccf

Browse files
committed
Enhance error management
1 parent 689d2b2 commit 2d3dccf

2 files changed

Lines changed: 28 additions & 20 deletions

File tree

ubuntu1404/builder.sh

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
# specific language governing permissions and limitations
1717
# under the License.
1818

19+
set -e
20+
1921
# Adjust user and group provided by host
2022
adjust_owner() {
2123
# if both set then change the owner
@@ -36,18 +38,20 @@ if [ ! -f "/mnt/build/cloudstack/packaging/build-deb.sh" ]; then
3638
exit 1
3739
fi
3840

39-
# do the packaging
40-
bash -x /mnt/build/cloudstack/packaging/build-deb.sh $@
41+
{
42+
# do the packaging
43+
bash -x /mnt/build/cloudstack/packaging/build-deb.sh $@ && {
44+
mkdir -p /mnt/build/cloudstack/dist/debbuild/DEBS
4145

42-
if [ $? -eq 0 ]; then
43-
mkdir -p /mnt/build/cloudstack/dist/debbuild/DEBS
46+
cp /mnt/build/cloudstack-*.deb /mnt/build/cloudstack/dist/debbuild/DEBS
47+
cp /mnt/build/cloudstack_*.changes /mnt/build/cloudstack/dist/debbuild/DEBS
4448

45-
cp /mnt/build/cloudstack-*.deb /mnt/build/cloudstack/dist/debbuild/DEBS
46-
cp /mnt/build/cloudstack_*.changes /mnt/build/cloudstack/dist/debbuild/DEBS
49+
adjust_owner
50+
}
51+
} || {
52+
status=$?
4753

4854
adjust_owner
49-
else
50-
adjust_owner
5155
echo "Packaging DEB failed"
52-
exit $?
53-
fi
56+
exit $status
57+
}

ubuntu1604/builder.sh

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
# specific language governing permissions and limitations
1717
# under the License.
1818

19+
set -e
20+
1921
# Adjust user and group provided by host
2022
adjust_owner() {
2123
# if both set then change the owner
@@ -36,18 +38,20 @@ if [ ! -f "/mnt/build/cloudstack/packaging/build-deb.sh" ]; then
3638
exit 1
3739
fi
3840

39-
# do the packaging
40-
bash -x /mnt/build/cloudstack/packaging/build-deb.sh $@
41+
{
42+
# do the packaging
43+
bash -x /mnt/build/cloudstack/packaging/build-deb.sh $@ && {
44+
mkdir -p /mnt/build/cloudstack/dist/debbuild/DEBS
4145

42-
if [ $? -eq 0 ]; then
43-
mkdir -p /mnt/build/cloudstack/dist/debbuild/DEBS
46+
cp /mnt/build/cloudstack-*.deb /mnt/build/cloudstack/dist/debbuild/DEBS
47+
cp /mnt/build/cloudstack_*.changes /mnt/build/cloudstack/dist/debbuild/DEBS
4448

45-
cp /mnt/build/cloudstack-*.deb /mnt/build/cloudstack/dist/debbuild/DEBS
46-
cp /mnt/build/cloudstack_*.changes /mnt/build/cloudstack/dist/debbuild/DEBS
49+
adjust_owner
50+
}
51+
} || {
52+
status=$?
4753

4854
adjust_owner
49-
else
50-
adjust_owner
5155
echo "Packaging DEB failed"
52-
exit $?
53-
fi
56+
exit $status
57+
}

0 commit comments

Comments
 (0)