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

remotes/origin/4.10
Darko Poljak 6 years ago
parent 51fa8af6b7
commit 867b9cb102
  1. 2
      cdist/conf/type/__package_emerge/gencode-remote
  2. 2
      cdist/conf/type/__systemd_unit/gencode-remote
  3. 6
      cdist/conf/type/__zypper_repo/gencode-remote

@ -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

@ -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"

@ -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

Loading…
Cancel
Save