Skip to content

Commit 8465aef

Browse files
committed
allow installer to update
1 parent ba75ccf commit 8465aef

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

installer.sh

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,23 @@ _install_pkgx() {
8181
unset tmpdir pipe
8282
}
8383

84+
_should_install_pkgx() {
85+
if ! command -v pkgx >/dev/null 2>&1; then
86+
return 0
87+
elif [ $(/usr/bin/which pkgx) != /usr/local/bin/pkgx ]; then
88+
# if pkgx is not installed to /usr/local/bin then we’re not getting involved
89+
return 1
90+
fi
91+
92+
# if the installed version is less than the available version then upgrade
93+
pkgx --silent semverator lt \
94+
$(curl -Ssf https://pkgx.sh/VERSION) \
95+
$(/usr/local/bin/pkgx --version | awk '{print $2}') >/dev/null 2>&1
96+
}
97+
8498
########################################################################### meat
8599

86-
if ! command -v pkgx >/dev/null 2>&1; then
100+
if _should_install_pkgx; then
87101
_install_pkgx "$@"
88102
fi
89103

0 commit comments

Comments
 (0)