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:
Jake Guffey 2014-09-10 15:54:13 -04:00
parent e87b26f2de
commit 37a8b4af2b
2 changed files with 9 additions and 2 deletions

View File

@ -21,7 +21,9 @@
# 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
printf "pkg-ng installed"
else

View File

@ -99,15 +99,20 @@ if [ -n "$curr_version" ]; then # PKG *is* installed
if [ -n "$flavor" ]; then
cmd="${cmd}-${flavor}"
fi
# PKG is supposed to be removed
if [ "$state" = "absent" ]; then
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
execcmd "upg" "${cmd}"
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
exit 1
fi
# PKG is supposed to be installed to the latest version
else
: # Do nothing.
fi
else # PKG *isn't* installed
if [ "$state" = "absent" ]; then # Shouldn't be installed