We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ba75ccf commit 8465aefCopy full SHA for 8465aef
1 file changed
installer.sh
@@ -81,9 +81,23 @@ _install_pkgx() {
81
unset tmpdir pipe
82
}
83
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
98
########################################################################### meat
99
-if ! command -v pkgx >/dev/null 2>&1; then
100
+if _should_install_pkgx; then
101
_install_pkgx "$@"
102
fi
103
0 commit comments