shellcheck: SC2236: use -n instead of ! -z
This commit is contained in:
parent
51fa8af6b7
commit
867b9cb102
3 changed files with 5 additions and 5 deletions
|
@ -58,7 +58,7 @@ fi
|
||||||
|
|
||||||
# Exit if nothing is needed to be done
|
# Exit if nothing is needed to be done
|
||||||
[ "$state_is" = "$state_should" ] && { [ -z "$version" ] || [ "$installed_version" = "$version" ]; } && exit 0
|
[ "$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
|
case "$state_should" in
|
||||||
|
|
|
@ -23,7 +23,7 @@ state=$(cat "${__object}/parameter/state")
|
||||||
current_enablement_state=$(cat "${__object}/explorer/enablement-state")
|
current_enablement_state=$(cat "${__object}/explorer/enablement-state")
|
||||||
|
|
||||||
if [ "${state}" = "absent" ]; then
|
if [ "${state}" = "absent" ]; then
|
||||||
if [ ! -z "${current_enablement_state}" ]; then
|
if [ -n "${current_enablement_state}" ]; then
|
||||||
echo "systemctl --now disable ${name}"
|
echo "systemctl --now disable ${name}"
|
||||||
echo "rm -f /etc/systemd/system/${name}"
|
echo "rm -f /etc/systemd/system/${name}"
|
||||||
echo "systemctl daemon-reload"
|
echo "systemctl daemon-reload"
|
||||||
|
|
|
@ -74,19 +74,19 @@ case "$state" in
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
absent)
|
absent)
|
||||||
if [ ! -z "$act_id" ]; then
|
if [ -n "$act_id" ]; then
|
||||||
# Repo present (act_id not ""), so we ned to delete it
|
# Repo present (act_id not ""), so we ned to delete it
|
||||||
echo "zypper $zypper_def_opts removerepo $act_id"
|
echo "zypper $zypper_def_opts removerepo $act_id"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
enabled)
|
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
|
# Repo present (act_id not "") and repostate not enabled, so a enable call is needed
|
||||||
echo "zypper $zypper_def_opts modifyrepo -e $act_id"
|
echo "zypper $zypper_def_opts modifyrepo -e $act_id"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
disabled)
|
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
|
# Repo present (act_id not "") and repostate enabled, so a disable call is needed
|
||||||
echo "zypper $zypper_def_opts modifyrepo -d $act_id"
|
echo "zypper $zypper_def_opts modifyrepo -d $act_id"
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue