Skip to content

Commit d322a65

Browse files
committed
feat: add additionalChannels
1 parent 36c5287 commit d322a65

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

src/julia/devcontainer-feature.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@
1313
],
1414
"default": "release",
1515
"description": "Select a Juliaup channel"
16+
},
17+
"additionalChannels": {
18+
"type": "string",
19+
"default": "",
20+
"description": "Additional Juliaup channels to install, separated by commas (e.g., 'nightly,1.10')"
1621
}
1722
},
1823
"installsAfter": [

src/julia/install.sh

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
#!/bin/bash
22

33
CHANNEL=${CHANNEL:-"release"}
4-
IFS=',' read -ra channels <<< "$CHANNEL"
5-
4+
IFS=',' read -ra channels <<< "$ADDITIONALCHANNELS"
65
USERNAME=${USERNAME:-${_REMOTE_USER:-"automatic"}}
76

87
set -e
@@ -29,6 +28,13 @@ elif [ "${USERNAME}" = "none" ] || ! id -u "${USERNAME}" >/dev/null 2>&1; then
2928
USERNAME=root
3029
fi
3130

31+
# Determine the home directory of the user
32+
if [ "${USERNAME}" = "root" ]; then
33+
REMOTE_USER_HOME=${_REMOTE_USER_HOME:-"/root"}
34+
else
35+
REMOTE_USER_HOME=${_REMOTE_USER_HOME:-"/home/${USERNAME}"}
36+
fi
37+
3238
cleanup_apt() {
3339
# shellcheck source=/dev/null
3440
source /etc/os-release
@@ -53,9 +59,12 @@ export DEBIAN_FRONTEND=noninteractive
5359
cleanup_apt
5460
check_packages curl ca-certificates
5561

56-
su ${USERNAME} -c 'curl -fsSL https://install.julialang.org | sh -s -- --yes'
62+
su ${USERNAME} -c "curl -fsSL https://install.julialang.org | sh -s -- --yes"
63+
64+
su ${USERNAME} -c "${REMOTE_USER_HOME}/.juliaup/bin/juliaup add ${CHANNEL}"
65+
5766
for channel in "${channels[@]}"; do
58-
su ${USERNAME} -c '$(getent passwd "$USERNAME" | cut -d: -f6)/.juliaup/bin/juliaup add $channel'
67+
su ${USERNAME} -c "${REMOTE_USER_HOME}/.juliaup/bin/juliaup add ${channel}"
5968
done
6069

6170
# Clean up

0 commit comments

Comments
 (0)