Skip to content

Commit c8aae16

Browse files
authored
Merge pull request #5452 from spandan541/devbox-envsubstr-fix
🌱 Fix envsubstr installation in Devbox
2 parents 5f50101 + 500643d commit c8aae16

File tree

2 files changed

+9
-24
lines changed

2 files changed

+9
-24
lines changed

devbox.json

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
],
1616
"shell": {
1717
"init_hook": [
18+
"export PATH=$PWD/bin:$PATH",
1819
"./scripts/devbox-init-hook.sh"
1920
],
2021
"scripts": {

scripts/devbox-init-hook.sh

+8-24
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,13 @@ DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
33
SRC_DIR="$(dirname $DIR)"
44

55
# Set install path
6-
INSTALL_DIR="$HOME/.local/bin"
6+
INSTALL_DIR="$SRC_DIR/bin"
77
mkdir -p "$INSTALL_DIR"
88

9-
# Check if envsubst.old exists
10-
if [[ ! -f "/usr/bin/envsubst.old" ]]; then
11-
echo "envsubst.old does not exist. Proceeding with installation..."
12-
13-
ENVSUBST_VERSION="v1.4.3"
14-
URL="https://github.com/a8m/envsubst/releases/download/$ENVSUBST_VERSION/envsubst-$(uname -s)-$(uname -m)"
15-
echo "Downloading: $URL"
16-
17-
curl -sL $URL -o $INSTALL_DIR/envsubst
18-
chmod +x "$INSTALL_DIR/envsubst"
19-
20-
# Replace existing envsubst if present
21-
if [[ -f "/usr/bin/envsubst" ]]; then
22-
sudo mv /usr/bin/envsubst /usr/bin/envsubst.old
23-
sudo ln -s "$INSTALL_DIR/envsubst" /usr/bin/envsubst
24-
echo "Replaced existing envsubst with the new one at /usr/bin/envsubst"
25-
else
26-
touch /usr/bin/envsubst.old
27-
fi
9+
if [[ ! -f "$INSTALL_DIR/envsubst" ]]; then
10+
echo "Installing github.com/a8m/envsubst into bin"
11+
make -C "$SRC_DIR/hack/tools" bin/envsubst
12+
ln -s "$SRC_DIR/hack/tools/bin/envsubst" "$INSTALL_DIR/envsubst"
2813

2914
# Verify installation
3015
if ! command -v envsubst &>/dev/null; then
@@ -34,8 +19,7 @@ if [[ ! -f "/usr/bin/envsubst.old" ]]; then
3419
fi
3520

3621
# Use build location by default
37-
if [[ ! -e "$INSTALL_DIR/clusterawsadm" ]]; then
38-
echo "Linking [$SRC_DIR/bin/clusterawsadm] [$INSTALL_DIR/clusterawsadm]"
39-
mkdir -p "$INSTALL_DIR"
40-
ln -s "$SRC_DIR/bin/clusterawsadm" $INSTALL_DIR/clusterawsadm
22+
if [[ ! -f "$INSTALL_DIR/clusterawsadm" ]]; then
23+
echo "Installing clusterawsadm into bin"
24+
make -C "$SRC_DIR" clusterawsadm
4125
fi

0 commit comments

Comments
 (0)