Skip to content

Commit 6834880

Browse files
committed
Add path via etc profiles
1 parent 902983c commit 6834880

5 files changed

Lines changed: 16 additions & 49 deletions

File tree

.devcontainer.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@
2121
"ghcr.io/devcontainers/features/common-utils:1": {},
2222
"ghcr.io/devcontainers/features/docker-in-docker:2": {}
2323
},
24-
"remoteEnv": {
25-
"PATH": "${containerEnv:PATH}:~/.fuelup/bin"
26-
},
2724
"remoteUser": "node",
2825
"postCreateCommand": "npm install -g @devcontainers/cli"
2926
}

README.md

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,11 @@ Running `fuelup` inside the built container will install `fuelup` and the specif
1818
- beta-3
1919
- nightly
2020

21-
For convience, it's recommended to add the .fuelup directory to the remote user's path in the config:
22-
2321
```jsonc
2422
{
2523
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
2624
"features": {
2725
"ghcr.io/FuelLabs/devcontainer-features/fuelup:1": {}
28-
},
29-
"remoteEnv": {
30-
"PATH": "${containerEnv:PATH}:~/.fuelup/bin"
3126
}
3227
}
3328
```
@@ -41,9 +36,6 @@ is equivalent to:
4136
"ghcr.io/FuelLabs/devcontainer-features/fuelup:1": {
4237
"toolchain": "latest"
4338
}
44-
},
45-
"remoteEnv": {
46-
"PATH": "${containerEnv:PATH}:~/.fuelup/bin"
4739
}
4840
}
4941
```

src/fuelup/install.sh

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
11
#!/bin/sh
2-
set -x
2+
set -e
33

44
echo "Installing fuelup with provided toolchain: ${TOOLCHAIN}"
55

66
export DEBIAN_FRONTEND=noninteractive
7+
export PATH=$HOME/.fuelup/bin:$PATH
8+
9+
if [ "$(id -u)" -ne 0 ]; then
10+
echo -e 'Script must be run as root. Use sudo, su, or add "USER root" to your Dockerfile before running this script.'
11+
exit 1
12+
fi
13+
14+
# Add fuelup the the path for all new login shells.
15+
echo "export PATH=\$PATH:\$HOME/.fuelup/bin" > /etc/profile.d/00-fuelup.sh
16+
chmod +x /etc/profile.d/00-fuelup.sh
717

818
# Updates apt-get if the cache is empty.
919
apt_get_update()
@@ -28,22 +38,18 @@ check_packages curl git-all sudo
2838
# Install fuelup.
2939
curl --proto '=https' --tlsv1.2 -sSf https://install.fuel.network/fuelup-init.sh | sh -s -- --no-modify-path
3040

31-
printenv
32-
33-
# If the remote user is a different user, copy the fuelup directory to the remote user's home.
34-
if [ "$HOME" != "$_REMOTE_USER_HOME" ]; then
35-
sudo cp -r $HOME/.fuelup $_REMOTE_USER_HOME/.fuelup
36-
fi
37-
38-
export PATH=$HOME/.fuelup/bin:$PATH
39-
4041
# The latest toolchain is installed by default. If a specific toolchain is requested, install it and
4142
# set it as the default.
4243
if [ "${TOOLCHAIN}" != "latest" ]; then
4344
fuelup toolchain install ${TOOLCHAIN}
4445
fuelup default ${TOOLCHAIN}
4546
fi
4647

48+
# If the remote user is a different user, copy the fuelup directory to the remote user's home.
49+
if [ "$HOME" != "$_REMOTE_USER_HOME" ]; then
50+
sudo cp -r $HOME/.fuelup $_REMOTE_USER_HOME/.fuelup
51+
fi
52+
4753
# Ensure fuelup and forc are installed.
4854
fuelup --version
4955
forc --version

test/fuelup/scenarios.json

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
"features": {
55
"ghcr.io/devcontainers/features/common-utils:1": {},
66
"fuelup": {}
7-
},
8-
"remoteEnv": {
9-
"PATH": "${containerEnv:PATH}:~/.fuelup/bin"
107
}
118
},
129
"root": {
@@ -15,9 +12,6 @@
1512
"ghcr.io/devcontainers/features/common-utils:1": {},
1613
"fuelup": {}
1714
},
18-
"remoteEnv": {
19-
"PATH": "${containerEnv:PATH}:~/.fuelup/bin"
20-
},
2115
"remoteUser": "root"
2216
},
2317
"vscode": {
@@ -26,9 +20,6 @@
2620
"ghcr.io/devcontainers/features/common-utils:1": {},
2721
"fuelup": {}
2822
},
29-
"remoteEnv": {
30-
"PATH": "${containerEnv:PATH}:~/.fuelup/bin"
31-
},
3223
"remoteUser": "vscode"
3324
},
3425
"nightly": {
@@ -38,9 +29,6 @@
3829
"fuelup": {
3930
"toolchain": "nightly"
4031
}
41-
},
42-
"remoteEnv": {
43-
"PATH": "${containerEnv:PATH}:~/.fuelup/bin"
4432
}
4533
},
4634
"latest": {
@@ -50,9 +38,6 @@
5038
"fuelup": {
5139
"toolchain": "latest"
5240
}
53-
},
54-
"remoteEnv": {
55-
"PATH": "${containerEnv:PATH}:~/.fuelup/bin"
5641
}
5742
},
5843
"beta-1": {
@@ -62,9 +47,6 @@
6247
"fuelup": {
6348
"toolchain": "beta-1"
6449
}
65-
},
66-
"remoteEnv": {
67-
"PATH": "${containerEnv:PATH}:~/.fuelup/bin"
6850
}
6951
},
7052
"beta-2": {
@@ -74,9 +56,6 @@
7456
"fuelup": {
7557
"toolchain": "beta-2"
7658
}
77-
},
78-
"remoteEnv": {
79-
"PATH": "${containerEnv:PATH}:~/.fuelup/bin"
8059
}
8160
},
8261
"beta-3": {
@@ -86,9 +65,6 @@
8665
"fuelup": {
8766
"toolchain": "beta-3"
8867
}
89-
},
90-
"remoteEnv": {
91-
"PATH": "${containerEnv:PATH}:~/.fuelup/bin"
9268
}
9369
}
9470
}

test/fuelup/test.sh

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@ set -e
2424
# Provides the 'check' and 'reportResults' commands.
2525
source dev-container-features-test-lib
2626

27-
# Add the fuelup bin directory to the PATH, since this is not being done in the default
28-
# devcontainer.json.
29-
export PATH=$HOME/.fuelup/bin:$PATH
30-
3127
# Feature-specific tests
3228
# The 'check' command comes from the dev-container-features-test-lib.
3329
check "execute command" fuelup --version | grep 'fuelup'

0 commit comments

Comments
 (0)