Remove unnecessary returns
* remove duplicated xtrace
* remove some unnecessary return
Change-Id: If9e0a979e0bd5a334e82d42572ac0b149de341d7
diff --git a/functions b/functions
index 1b7d130..1d0a644 100644
--- a/functions
+++ b/functions
@@ -73,7 +73,6 @@
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 @@
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 @@
# 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 @@
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 @@
# 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