Remove unnecessary returns
* remove duplicated xtrace * remove some unnecessary return Change-Id: If9e0a979e0bd5a334e82d42572ac0b149de341d7
This commit is contained in:
parent
b0d8a8288b
commit
251d3b5fbc
15
functions
15
functions
@ -73,7 +73,6 @@ function die_if_not_set() {
|
|||||||
set +o xtrace
|
set +o xtrace
|
||||||
local evar=$1; shift
|
local evar=$1; shift
|
||||||
if ! is_set $evar || [ $exitcode != 0 ]; then
|
if ! is_set $evar || [ $exitcode != 0 ]; then
|
||||||
set +o xtrace
|
|
||||||
echo $@
|
echo $@
|
||||||
exit -1
|
exit -1
|
||||||
fi
|
fi
|
||||||
@ -650,10 +649,8 @@ function is_package_installed() {
|
|||||||
|
|
||||||
if [[ "$os_PACKAGE" = "deb" ]]; then
|
if [[ "$os_PACKAGE" = "deb" ]]; then
|
||||||
dpkg -l "$@" > /dev/null
|
dpkg -l "$@" > /dev/null
|
||||||
return $?
|
|
||||||
elif [[ "$os_PACKAGE" = "rpm" ]]; then
|
elif [[ "$os_PACKAGE" = "rpm" ]]; then
|
||||||
rpm --quiet -q "$@"
|
rpm --quiet -q "$@"
|
||||||
return $?
|
|
||||||
else
|
else
|
||||||
exit_distro_not_supported "finding if a package is installed"
|
exit_distro_not_supported "finding if a package is installed"
|
||||||
fi
|
fi
|
||||||
@ -664,10 +661,7 @@ function is_package_installed() {
|
|||||||
# is_set env-var
|
# is_set env-var
|
||||||
function is_set() {
|
function is_set() {
|
||||||
local var=\$"$1"
|
local var=\$"$1"
|
||||||
if eval "[ -z \"$var\" ]"; then
|
eval "[ -n \"$var\" ]" # For ex.: sh -c "[ -n \"$var\" ]" would be better, but several exercises depends on this
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
return 0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -973,11 +967,9 @@ function use_database {
|
|||||||
if [[ -z "$DATABASE_BACKENDS" ]]; then
|
if [[ -z "$DATABASE_BACKENDS" ]]; then
|
||||||
# The backends haven't initialized yet, just save the selection for now
|
# The backends haven't initialized yet, just save the selection for now
|
||||||
DATABASE_TYPE=$1
|
DATABASE_TYPE=$1
|
||||||
return
|
else
|
||||||
|
use_exclusive_service DATABASE_BACKENDS DATABASE_TYPE $1
|
||||||
fi
|
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
|
# 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
|
# Qpid was introduced to Ubuntu in precise, disallow it on oneiric; it is
|
||||||
# not in openSUSE either right now.
|
# not in openSUSE either right now.
|
||||||
( ! ([[ "$DISTRO" = "oneiric" ]] || is_suse) )
|
( ! ([[ "$DISTRO" = "oneiric" ]] || is_suse) )
|
||||||
return $?
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Restore xtrace
|
# Restore xtrace
|
||||||
|
Loading…
x
Reference in New Issue
Block a user