Remove unnecessary returns

* remove duplicated xtrace
* remove some unnecessary return

Change-Id: If9e0a979e0bd5a334e82d42572ac0b149de341d7
This commit is contained in:
Attila Fazekas 2012-12-16 15:05:44 +01:00
parent b0d8a8288b
commit 251d3b5fbc

View File

@ -73,7 +73,6 @@ function die_if_not_set() {
set +o xtrace
local evar=$1; shift
if ! is_set $evar || [ $exitcode != 0 ]; then
set +o xtrace
echo $@
exit -1
fi
@ -650,10 +649,8 @@ function is_package_installed() {
if [[ "$os_PACKAGE" = "deb" ]]; then
dpkg -l "$@" > /dev/null
return $?
elif [[ "$os_PACKAGE" = "rpm" ]]; then
rpm --quiet -q "$@"
return $?
else
exit_distro_not_supported "finding if a package is installed"
fi
@ -664,10 +661,7 @@ function is_package_installed() {
# is_set env-var
function is_set() {
local var=\$"$1"
if eval "[ -z \"$var\" ]"; then
return 1
fi
return 0
eval "[ -n \"$var\" ]" # For ex.: sh -c "[ -n \"$var\" ]" would be better, but several exercises depends on this
}
@ -973,11 +967,9 @@ function use_database {
if [[ -z "$DATABASE_BACKENDS" ]]; then
# The backends haven't initialized yet, just save the selection for now
DATABASE_TYPE=$1
return
else
use_exclusive_service DATABASE_BACKENDS DATABASE_TYPE $1
fi
use_exclusive_service DATABASE_BACKENDS DATABASE_TYPE $1 && return 0
ret=$?
return $ret
}
# Toggle enable/disable_service for services that must run exclusive of each other
@ -1133,7 +1125,6 @@ function qpid_is_supported() {
# Qpid was introduced to Ubuntu in precise, disallow it on oneiric; it is
# not in openSUSE either right now.
( ! ([[ "$DISTRO" = "oneiric" ]] || is_suse) )
return $?
}
# Restore xtrace