Skip to content

Commit

Permalink
fix and tweak update check
Browse files Browse the repository at this point in the history
  • Loading branch information
mxcl committed Nov 11, 2023
1 parent 82a6f59 commit d3ce626
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,13 @@ _install_pkgx() {
_should_install_pkgx() {
if [ ! -f /usr/local/bin/pkgx ]; then
return 0
elif /usr/local/bin/pkgx --silent semverator gt \
$(curl -Ssf https://pkgx.sh/VERSION) \
$(/usr/local/bin/pkgx --version | awk '{print $2}') >/dev/null 2>&1
then
return 0
else
# if the installed version is less than the available version then upgrade
/usr/local/bin/pkgx --silent semverator gt \
$(curl -Ssf https://pkgx.sh/VERSION) \
$(/usr/local/bin/pkgx --version | awk '{print $2}') >/dev/null 2>&1
return 1
fi
}

Expand All @@ -109,7 +111,7 @@ _should_install_pkgx() {
if _should_install_pkgx; then
_install_pkgx "$@"
elif [ $# -eq 0 ]; then
echo "pkgx already up-to-date" >&2
echo "$(pkgx --version) already installed" >&2
fi

if _is_ci; then
Expand Down

0 comments on commit d3ce626

Please sign in to comment.