Fix explorer and globalopts issue in type __package_zypper
Fixes #215. Signed-off-by: Nico Schottelius <nico@bento.schottelius.org>
This commit is contained in:
parent
538a5b4964
commit
d074713b94
2 changed files with 10 additions and 3 deletions
2
cdist/conf/type/__package_zypper/explorer/pkg_version
Executable file → Normal file
2
cdist/conf/type/__package_zypper/explorer/pkg_version
Executable file → Normal file
|
@ -27,4 +27,4 @@ else
|
||||||
name="$__object_id"
|
name="$__object_id"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rpm -q --whatprovides "$name" 2>/dev/null || true
|
rpm -q --whatprovides "$name" | grep -v 'no package provides' || true
|
||||||
|
|
11
cdist/conf/type/__package_zypper/gencode-remote
Executable file → Normal file
11
cdist/conf/type/__package_zypper/gencode-remote
Executable file → Normal file
|
@ -39,15 +39,22 @@ else
|
||||||
state_should="present"
|
state_should="present"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
pkg_version="$(cat "$__object/explorer/pkg_version")"
|
||||||
|
if [ -z "$pkg_version" ]; then
|
||||||
|
state_is="absent"
|
||||||
|
else
|
||||||
|
state_is="present"
|
||||||
|
fi
|
||||||
|
|
||||||
# Exit if nothing is needed to be done
|
# Exit if nothing is needed to be done
|
||||||
[ "$state_is" = "$state_should" ] && exit 0
|
[ "$state_is" = "$state_should" ] && exit 0
|
||||||
|
|
||||||
case "$state_should" in
|
case "$state_should" in
|
||||||
present)
|
present)
|
||||||
echo zypper "$globalopts" install --auto-agree-with-licenses \"$name\"
|
echo zypper $globalopts install --auto-agree-with-licenses \"$name\" ">/dev/null"
|
||||||
;;
|
;;
|
||||||
absent)
|
absent)
|
||||||
echo pacman "$globalopts" remove \"$name\"
|
echo zypper $globalopts remove \"$name\" ">/dev/null"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Unknown state: $state_should" >&2
|
echo "Unknown state: $state_should" >&2
|
||||||
|
|
Loading…
Reference in a new issue