11#! /bin/sh
2- set -x
2+ set -e
33
44echo " Installing fuelup with provided toolchain: ${TOOLCHAIN} "
55
66export 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.
919apt_get_update ()
@@ -28,22 +38,18 @@ check_packages curl git-all sudo
2838# Install fuelup.
2939curl --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.
4243if [ " ${TOOLCHAIN} " != " latest" ]; then
4344 fuelup toolchain install ${TOOLCHAIN}
4445 fuelup default ${TOOLCHAIN}
4546fi
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.
4854fuelup --version
4955forc --version
0 commit comments