forked from ungleich-public/cdist
Minor fixes
Fixed pkgng_exists explorer (can't reference $__global) Fixed logic in __package/pkgng_freebsd/gencode-remote Wasn't installing package if it already exists, but after explorer execution
This commit is contained in:
parent
e87b26f2de
commit
37a8b4af2b
2 changed files with 9 additions and 2 deletions
|
@ -21,7 +21,9 @@
|
||||||
# Retrieve the status of a package - parsed dpkg output
|
# Retrieve the status of a package - parsed dpkg output
|
||||||
#
|
#
|
||||||
|
|
||||||
if [ "$(cat "$__global/explorer/os")" = "freebsd" ]; then
|
# Can't access $__global/explorer/os from here, so recreate the functionality
|
||||||
|
# because there's no point in executing this explorer on non-FreeBSD targets.
|
||||||
|
if [ $(uname) = "FreeBSD" ]; then
|
||||||
if command -v pkg >&-; then
|
if command -v pkg >&-; then
|
||||||
printf "pkg-ng installed"
|
printf "pkg-ng installed"
|
||||||
else
|
else
|
||||||
|
|
|
@ -99,15 +99,20 @@ if [ -n "$curr_version" ]; then # PKG *is* installed
|
||||||
if [ -n "$flavor" ]; then
|
if [ -n "$flavor" ]; then
|
||||||
cmd="${cmd}-${flavor}"
|
cmd="${cmd}-${flavor}"
|
||||||
fi
|
fi
|
||||||
|
# PKG is supposed to be removed
|
||||||
if [ "$state" = "absent" ]; then
|
if [ "$state" = "absent" ]; then
|
||||||
execcmd "rm" "${cmd}"
|
execcmd "rm" "${cmd}"
|
||||||
elif [ "$version" != "$curr_version" ]; then
|
# PKG is supposed to be installed to a particular version
|
||||||
|
elif [ -n "$version" ] && [ "$version" != "$curr_version" ]; then
|
||||||
if [ "$upgrade" = "true" ]; then
|
if [ "$upgrade" = "true" ]; then
|
||||||
execcmd "upg" "${cmd}"
|
execcmd "upg" "${cmd}"
|
||||||
else
|
else
|
||||||
printf "Version %s is already installed and pkg-ng can't upgrade directly to version %s.\nTo upgrade to the latest version, use the --upgrade flag.\n" "$curr_version" "$version" >&2
|
printf "Version %s is already installed and pkg-ng can't upgrade directly to version %s.\nTo upgrade to the latest version, use the --upgrade flag.\n" "$curr_version" "$version" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
# PKG is supposed to be installed to the latest version
|
||||||
|
else
|
||||||
|
: # Do nothing.
|
||||||
fi
|
fi
|
||||||
else # PKG *isn't* installed
|
else # PKG *isn't* installed
|
||||||
if [ "$state" = "absent" ]; then # Shouldn't be installed
|
if [ "$state" = "absent" ]; then # Shouldn't be installed
|
||||||
|
|
Loading…
Reference in a new issue