shellcheck: SC2236: use -n instead of ! -z

This commit is contained in:
Darko Poljak 2019-02-15 20:40:12 +01:00
parent 51fa8af6b7
commit 867b9cb102
3 changed files with 5 additions and 5 deletions

View file

@ -58,7 +58,7 @@ fi
# Exit if nothing is needed to be done
[ "$state_is" = "$state_should" ] && { [ -z "$version" ] || [ "$installed_version" = "$version" ]; } && exit 0
[ "$state_should" = "absent" ] && [ ! -z "$version" ] && [ "$installed_version" != "$version" ] && exit 0
[ "$state_should" = "absent" ] && [ -n "$version" ] && [ "$installed_version" != "$version" ] && exit 0
case "$state_should" in

View file

@ -23,7 +23,7 @@ state=$(cat "${__object}/parameter/state")
current_enablement_state=$(cat "${__object}/explorer/enablement-state")
if [ "${state}" = "absent" ]; then
if [ ! -z "${current_enablement_state}" ]; then
if [ -n "${current_enablement_state}" ]; then
echo "systemctl --now disable ${name}"
echo "rm -f /etc/systemd/system/${name}"
echo "systemctl daemon-reload"

View file

@ -74,19 +74,19 @@ case "$state" in
fi
;;
absent)
if [ ! -z "$act_id" ]; then
if [ -n "$act_id" ]; then
# Repo present (act_id not ""), so we ned to delete it
echo "zypper $zypper_def_opts removerepo $act_id"
fi
;;
enabled)
if [ ! -z "$act_id" ] && [ "$repostate" = "disabled" ]; then
if [ -n "$act_id" ] && [ "$repostate" = "disabled" ]; then
# Repo present (act_id not "") and repostate not enabled, so a enable call is needed
echo "zypper $zypper_def_opts modifyrepo -e $act_id"
fi
;;
disabled)
if [ ! -z "$act_id" ] && [ "$repostate" = "enabled" ]; then
if [ -n "$act_id" ] && [ "$repostate" = "enabled" ]; then
# Repo present (act_id not "") and repostate enabled, so a disable call is needed
echo "zypper $zypper_def_opts modifyrepo -d $act_id"
fi