Skip to content
Snippets Groups Projects
Verified Commit 43bfcd17 authored by Olivier Benz's avatar Olivier Benz
Browse files

Fix script 12-mojo.sh

parent 9576a875
No related branches found
No related tags found
No related merge requests found
......@@ -5,30 +5,59 @@
set -e
# Append the user's modular bin dir to PATH
if ! grep -q "user's modular bin dir" "$HOME/.bashrc"; then
curl -ssL https://magic.modular.com | grep '^MODULAR_HOME\|^BIN_DIR' \
> /tmp/magicenv
sed -i 's/\$HOME/\\$HOME/g' /tmp/magicenv
. /tmp/magicenv
echo -e "\n# Append the user's modular bin dir to PATH\nif [[ \"\$PATH\" != *\"${BIN_DIR}\"* ]] ; then\n PATH=\"\$PATH:${BIN_DIR}\"\nfi" >> "$HOME/.bashrc"
rm /tmp/magicenv
fi
if ! grep -q "user's modular bin dir" "$HOME/.zshrc"; then
curl -ssL https://magic.modular.com | grep '^MODULAR_HOME\|^BIN_DIR' \
> /tmp/magicenv
sed -i 's/\$HOME/\\$HOME/g' /tmp/magicenv
. /tmp/magicenv
echo -e "\n# Append the user's modular bin dir to PATH\nif [[ \"\$PATH\" != *\"${BIN_DIR}\"* ]] ; then\n PATH=\"\$PATH:${BIN_DIR}\"\nfi" >> "$HOME/.zshrc"
rm /tmp/magicenv
if [ "$(id -u)" == 0 ] ; then
if ! grep -q "user's modular bin dir" "/home/$NB_USER${DOMAIN:+@$DOMAIN}/.bashrc"; then
curl -ssL https://magic.modular.com | grep '^MODULAR_HOME\|^BIN_DIR' \
> /tmp/magicenv
sed -i 's/\$HOME/\\$HOME/g' /tmp/magicenv
. /tmp/magicenv
echo -e "\n# Append the user's modular bin dir to PATH\nif [[ \"\$PATH\" != *\"${BIN_DIR}\"* ]] ; then\n PATH=\"\$PATH:${BIN_DIR}\"\nfi" >> "/home/$NB_USER${DOMAIN:+@$DOMAIN}/.bashrc"
rm /tmp/magicenv
fi
if ! grep -q "user's modular bin dir" "/home/$NB_USER${DOMAIN:+@$DOMAIN}/.zshrc"; then
curl -ssL https://magic.modular.com | grep '^MODULAR_HOME\|^BIN_DIR' \
> /tmp/magicenv
sed -i 's/\$HOME/\\$HOME/g' /tmp/magicenv
. /tmp/magicenv
echo -e "\n# Append the user's modular bin dir to PATH\nif [[ \"\$PATH\" != *\"${BIN_DIR}\"* ]] ; then\n PATH=\"\$PATH:${BIN_DIR}\"\nfi" >> "/home/$NB_USER${DOMAIN:+@$DOMAIN}/.zshrc"
rm /tmp/magicenv
fi
else
if ! grep -q "user's modular bin dir" "$HOME/.bashrc"; then
curl -ssL https://magic.modular.com | grep '^MODULAR_HOME\|^BIN_DIR' \
> /tmp/magicenv
sed -i 's/\$HOME/\\$HOME/g' /tmp/magicenv
. /tmp/magicenv
echo -e "\n# Append the user's modular bin dir to PATH\nif [[ \"\$PATH\" != *\"${BIN_DIR}\"* ]] ; then\n PATH=\"\$PATH:${BIN_DIR}\"\nfi" >> "$HOME/.bashrc"
rm /tmp/magicenv
fi
if ! grep -q "user's modular bin dir" "$HOME/.zshrc"; then
curl -ssL https://magic.modular.com | grep '^MODULAR_HOME\|^BIN_DIR' \
> /tmp/magicenv
sed -i 's/\$HOME/\\$HOME/g' /tmp/magicenv
. /tmp/magicenv
echo -e "\n# Append the user's modular bin dir to PATH\nif [[ \"\$PATH\" != *\"${BIN_DIR}\"* ]] ; then\n PATH=\"\$PATH:${BIN_DIR}\"\nfi" >> "$HOME/.zshrc"
rm /tmp/magicenv
fi
fi
# MAX SDK: Evaluate and set version
if [ "${MOJO_VERSION}" = "nightly" ]; then
extDataDir=/home/$NB_USER${DOMAIN:+@$DOMAIN}/.local/share/code-server/User/globalStorage/modular-mojotools.vscode-mojo-nightly
sdkVersion=$(jq -r '.sdkVersion' /opt/code-server/lib/vscode/extensions/modular-mojotools.vscode-mojo*/package.json)
if [ "$(id -u)" == 0 ] ; then
if [ "${MOJO_VERSION}" = "nightly" ]; then
extDataDir=/home/$NB_USER${DOMAIN:+@$DOMAIN}/.local/share/code-server/User/globalStorage/modular-mojotools.vscode-mojo-nightly
sdkVersion=$(jq -r '.sdkVersion' /opt/code-server/lib/vscode/extensions/modular-mojotools.vscode-mojo*/package.json)
else
extDataDir=/home/$NB_USER${DOMAIN:+@$DOMAIN}/.local/share/code-server/User/globalStorage/modular-mojotools.vscode-mojo
sdkVersion=$MOJO_VERSION
fi
else
extDataDir=/home/$NB_USER${DOMAIN:+@$DOMAIN}/.local/share/code-server/User/globalStorage/modular-mojotools.vscode-mojo
sdkVersion=$MOJO_VERSION
if [ "${MOJO_VERSION}" = "nightly" ]; then
extDataDir=$HOME/.local/share/code-server/User/globalStorage/modular-mojotools.vscode-mojo-nightly
sdkVersion=$(jq -r '.sdkVersion' /opt/code-server/lib/vscode/extensions/modular-mojotools.vscode-mojo*/package.json)
else
extDataDir=$HOME/.local/share/code-server/User/globalStorage/modular-mojotools.vscode-mojo
sdkVersion=$MOJO_VERSION
fi
fi
# MAX SDK: Create symlink to /opt/modular
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment