Skip to content

Commit 8111599

Browse files
authored
Merge pull request #338 from pkgxdev/libexec-find-pkgx
v2 moved pkgx's bin location. let's make brewkit smarter
2 parents 795fdc3 + 1ef5250 commit 8111599

File tree

13 files changed

+26
-107
lines changed

13 files changed

+26
-107
lines changed

libexec/.find-pkgx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/sh
2+
# shared pkgx resolution for libexec wrappers
3+
4+
if [ -n "$PKGX" ] && [ -x "$PKGX" ]; then
5+
pkgx="$PKGX"
6+
elif [ -x /usr/local/bin/pkgx ]; then
7+
pkgx=/usr/local/bin/pkgx
8+
elif [ -x "${PKGX_DIR:-$HOME/.pkgx}/bin/pkgx" ]; then
9+
pkgx="${PKGX_DIR:-$HOME/.pkgx}/bin/pkgx"
10+
elif command -v pkgx >/dev/null 2>&1; then
11+
pkgx="$(command -v pkgx)"
12+
else
13+
pkgx="$(ls -d ${PKGX_DIR:-$HOME/.pkgx}/pkgx.sh/v* 2>/dev/null | tail -1)/bin/pkgx"
14+
fi

libexec/autoconf

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
11
#!/bin/sh
2-
3-
if [ -x /usr/local/bin/pkgx ]; then
4-
# removed from PATH deliberately
5-
pkgx=/usr/local/bin/pkgx
6-
else
7-
# probs this is running in pkgx CI/CD
8-
pkgx="$(ls -d ${PKGX_DIR:-$HOME/.pkgx}/pkgx.sh/v* | tail -1)/bin/pkgx"
9-
fi
10-
2+
. "$(dirname "$0")/.find-pkgx"
113
exec "$pkgx" +gnu.org/autoconf -- autoconf "$@"

libexec/automake

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
11
#!/bin/sh
2-
3-
if [ -x /usr/local/bin/pkgx ]; then
4-
# removed from PATH deliberately
5-
pkgx=/usr/local/bin/pkgx
6-
else
7-
# probs this is running in pkgx CI/CD
8-
pkgx="$(ls -d ${PKGX_DIR:-$HOME/.pkgx}/pkgx.sh/v* | tail -1)/bin/pkgx"
9-
fi
10-
2+
. "$(dirname "$0")/.find-pkgx"
113
exec "$pkgx" +gnu.org/automake -- automake "$@"

libexec/curl

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
11
#!/bin/sh
2-
3-
if [ -x /usr/local/bin/pkgx ]; then
4-
# removed from PATH deliberately
5-
pkgx=/usr/local/bin/pkgx
6-
else
7-
# probs this is running in pkgx CI/CD
8-
pkgx="$(ls -d ${PKGX_DIR:-$HOME/.pkgx}/pkgx.sh/v* | tail -1)/bin/pkgx"
9-
fi
10-
2+
. "$(dirname "$0")/.find-pkgx"
113
exec "$pkgx" +curl.se -- curl "$@"

libexec/git

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
11
#!/bin/sh
2-
3-
if [ -x /usr/local/bin/pkgx ]; then
4-
# removed from PATH deliberately
5-
pkgx=/usr/local/bin/pkgx
6-
else
7-
# probs this is running in pkgx CI/CD
8-
pkgx="$(ls -d ${PKGX_DIR:-$HOME/.pkgx}/pkgx.sh/v* | tail -1)/bin/pkgx"
9-
fi
10-
2+
. "$(dirname "$0")/.find-pkgx"
113
exec "$pkgx" +git-scm.org -- git "$@"

libexec/install

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
11
#!/bin/sh
2-
3-
if [ -x /usr/local/bin/pkgx ]; then
4-
# removed from PATH deliberately
5-
pkgx=/usr/local/bin/pkgx
6-
else
7-
# probs this is running in pkgx CI/CD
8-
pkgx="$(ls -d ${PKGX_DIR:-$HOME/.pkgx}/pkgx.sh/v* | tail -1)/bin/pkgx"
9-
fi
10-
2+
. "$(dirname "$0")/.find-pkgx"
113
exec "$pkgx" +gnu.org/coreutils -- install "$@"

libexec/libtool

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,5 @@
44
if [ $(uname) = "Darwin" ]; then
55
exec /usr/bin/libtool "$@"
66
fi
7-
8-
if [ -x /usr/local/bin/pkgx ]; then
9-
# removed from PATH deliberately
10-
pkgx=/usr/local/bin/pkgx
11-
else
12-
# probs this is running in pkgx CI/CD
13-
pkgx="$(ls -d ${PKGX_DIR:-$HOME/.pkgx}/pkgx.sh/v* | tail -1)/bin/pkgx"
14-
fi
15-
7+
. "$(dirname "$0")/.find-pkgx"
168
exec "$pkgx" +gnu.org/libtool -- libtool "$@"

libexec/make

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
11
#!/bin/sh
2-
32
if [ $(uname) = Darwin ]; then
43
exec /usr/bin/make "$@"
5-
elif [ -x /usr/local/bin/pkgx ]; then
6-
# removed from PATH deliberately
7-
pkgx=/usr/local/bin/pkgx
8-
else
9-
# probs this is running in pkgx CI/CD
10-
pkgx="$(ls -d ${PKGX_DIR:-$HOME/.pkgx}/pkgx.sh/v* | tail -1)/bin/pkgx"
114
fi
12-
5+
. "$(dirname "$0")/.find-pkgx"
136
exec "$pkgx" +gnu.org/make -- make "$@"

libexec/patch

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
11
#!/bin/sh
2-
3-
if [ -x /usr/local/bin/pkgx ]; then
4-
# removed from PATH deliberately
5-
pkgx=/usr/local/bin/pkgx
6-
else
7-
# probs this is running in pkgx CI/CD
8-
pkgx="$(ls -d ${PKGX_DIR:-$HOME/.pkgx}/pkgx.sh/v* | tail -1)/bin/pkgx"
9-
fi
10-
2+
. "$(dirname "$0")/.find-pkgx"
113
exec "$pkgx" +gnu.org/patch -- patch "$@"

libexec/perl

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
11
#!/bin/sh
2-
3-
if [ -x /usr/local/bin/pkgx ]; then
4-
# removed from PATH deliberately
5-
pkgx=/usr/local/bin/pkgx
6-
else
7-
# probs this is running in pkgx CI/CD
8-
pkgx="$(ls -d ${PKGX_DIR:-$HOME/.pkgx}/pkgx.sh/v* | tail -1)/bin/pkgx"
9-
fi
10-
2+
. "$(dirname "$0")/.find-pkgx"
113
exec "$pkgx" +perl.org -- perl "$@"

0 commit comments

Comments
 (0)