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

Update script 12-mojo.sh

- Fallback to backup file when offline
parent 424fc4a0
No related branches found
No related tags found
No related merge requests found
......@@ -9,8 +9,8 @@ MODULAR_HOME_BAK="$MODULAR_HOME"
# Append the user's modular bin dir to PATH
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
(curl -ssL https://magic.modular.com || cat /var/tmp/magicenv.bak) \
| grep '^MODULAR_HOME\|^BIN_DIR' | tee /tmp/magicenv > /dev/null
. <(sed 's|\$HOME|/home/\$NB_USER\${DOMAIN:+@\$DOMAIN}|g' /tmp/magicenv)
run_user_group mkdir -p "${BIN_DIR}"
sed -i 's/\$HOME/\\$HOME/g' /tmp/magicenv
......@@ -19,8 +19,8 @@ if [ "$(id -u)" == 0 ] ; then
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
(curl -ssL https://magic.modular.com || cat /var/tmp/magicenv.bak) \
| grep '^MODULAR_HOME\|^BIN_DIR' | tee /tmp/magicenv > /dev/null
. <(sed 's|\$HOME|/home/\$NB_USER\${DOMAIN:+@\$DOMAIN}|g' /tmp/magicenv)
run_user_group mkdir -p "${BIN_DIR}"
sed -i 's/\$HOME/\\$HOME/g' /tmp/magicenv
......@@ -30,8 +30,8 @@ if [ "$(id -u)" == 0 ] ; then
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
(curl -ssL https://magic.modular.com || cat /var/tmp/magicenv.bak) \
| grep '^MODULAR_HOME\|^BIN_DIR' | tee /tmp/magicenv > /dev/null
. /tmp/magicenv
mkdir -p "${BIN_DIR}"
sed -i 's/\$HOME/\\$HOME/g' /tmp/magicenv
......@@ -40,8 +40,8 @@ else
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
(curl -ssL https://magic.modular.com || cat /var/tmp/magicenv.bak) \
| grep '^MODULAR_HOME\|^BIN_DIR' | tee /tmp/magicenv > /dev/null
. /tmp/magicenv
mkdir -p "${BIN_DIR}"
sed -i 's/\$HOME/\\$HOME/g' /tmp/magicenv
......
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