Merge "Remove unnecessary returns"
This commit is contained in:
commit
4159e6066d
15
functions
15
functions
@ -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
|
||||
@ -1141,7 +1133,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
|
||||
|
Loading…
Reference in New Issue
Block a user