* remove duplicated xtrace
* remove some unnecessary return
Change-Id: If9e0a979e0bd5a334e82d42572ac0b149de341d7
| ... | ... |
@@ -73,7 +73,6 @@ function die_if_not_set() {
|
| 73 | 73 |
set +o xtrace |
| 74 | 74 |
local evar=$1; shift |
| 75 | 75 |
if ! is_set $evar || [ $exitcode != 0 ]; then |
| 76 |
- set +o xtrace |
|
| 77 | 76 |
echo $@ |
| 78 | 77 |
exit -1 |
| 79 | 78 |
fi |
| ... | ... |
@@ -650,10 +649,8 @@ function is_package_installed() {
|
| 650 | 650 |
|
| 651 | 651 |
if [[ "$os_PACKAGE" = "deb" ]]; then |
| 652 | 652 |
dpkg -l "$@" > /dev/null |
| 653 |
- return $? |
|
| 654 | 653 |
elif [[ "$os_PACKAGE" = "rpm" ]]; then |
| 655 | 654 |
rpm --quiet -q "$@" |
| 656 |
- return $? |
|
| 657 | 655 |
else |
| 658 | 656 |
exit_distro_not_supported "finding if a package is installed" |
| 659 | 657 |
fi |
| ... | ... |
@@ -664,10 +661,7 @@ function is_package_installed() {
|
| 664 | 664 |
# is_set env-var |
| 665 | 665 |
function is_set() {
|
| 666 | 666 |
local var=\$"$1" |
| 667 |
- if eval "[ -z \"$var\" ]"; then |
|
| 668 |
- return 1 |
|
| 669 |
- fi |
|
| 670 |
- return 0 |
|
| 667 |
+ eval "[ -n \"$var\" ]" # For ex.: sh -c "[ -n \"$var\" ]" would be better, but several exercises depends on this |
|
| 671 | 668 |
} |
| 672 | 669 |
|
| 673 | 670 |
|
| ... | ... |
@@ -973,11 +967,9 @@ function use_database {
|
| 973 | 973 |
if [[ -z "$DATABASE_BACKENDS" ]]; then |
| 974 | 974 |
# The backends haven't initialized yet, just save the selection for now |
| 975 | 975 |
DATABASE_TYPE=$1 |
| 976 |
- return |
|
| 976 |
+ else |
|
| 977 |
+ use_exclusive_service DATABASE_BACKENDS DATABASE_TYPE $1 |
|
| 977 | 978 |
fi |
| 978 |
- use_exclusive_service DATABASE_BACKENDS DATABASE_TYPE $1 && return 0 |
|
| 979 |
- ret=$? |
|
| 980 |
- return $ret |
|
| 981 | 979 |
} |
| 982 | 980 |
|
| 983 | 981 |
# Toggle enable/disable_service for services that must run exclusive of each other |
| ... | ... |
@@ -1133,7 +1125,6 @@ function qpid_is_supported() {
|
| 1133 | 1133 |
# Qpid was introduced to Ubuntu in precise, disallow it on oneiric; it is |
| 1134 | 1134 |
# not in openSUSE either right now. |
| 1135 | 1135 |
( ! ([[ "$DISTRO" = "oneiric" ]] || is_suse) ) |
| 1136 |
- return $? |
|
| 1137 | 1136 |
} |
| 1138 | 1137 |
|
| 1139 | 1138 |
# Restore xtrace |