@@ -5,7 +5,7 @@ USERNAME="${USERNAME:-"${_REMOTE_USER:-"automatic"}"}"
55
66apt-get update -y
77apt-get -y install --no-install-recommends git curl ca-certificates libssl-dev libreadline-dev zlib1g-dev autoconf bison build-essential \
8- libyaml-dev libncurses5-dev libffi-dev libgdbm-dev libxml2-dev rustc
8+ libyaml-dev libncurses5-dev libffi-dev libgdbm-dev libxml2-dev rustc
99
1010git clone https://github.com/rbenv/rbenv.git /usr/local/share/rbenv
1111git clone https://github.com/rbenv/ruby-build.git /usr/local/share/ruby-build
@@ -14,20 +14,23 @@ mkdir -p /root/.rbenv/plugins
1414ln -s /usr/local/share/ruby-build /root/.rbenv/plugins/ruby-build
1515
1616if [ " ${USERNAME} " != " root" ]; then
17- mkdir -p /home/${USERNAME} /.rbenv/plugins
18- ln -s /usr/local/share/ruby-build /home/${USERNAME} /.rbenv/plugins/ruby-build
17+ user_home=" /home/${USERNAME} "
18+ mkdir -p " ${user_home} /.rbenv/plugins"
19+ ln -s /usr/local/share/ruby-build " ${user_home} /.rbenv/plugins/ruby-build"
1920
20- chown -R " ${USERNAME} " " /home/ ${USERNAME } /.rbenv/"
21- chmod -R g+r+w " /home/ ${USERNAME } /.rbenv"
21+ chown -R " ${USERNAME} " " ${user_home } /.rbenv/"
22+ chmod -R g+r+w " ${user_home } /.rbenv"
2223
23- echo ' eval "$(rbenv init -)"' >> /home/${USERNAME} /.bashrc
24+ # shellcheck disable=SC2016
25+ echo ' eval "$(rbenv init -)"' >> " ${user_home} /.bashrc"
2426
25- if [ -f /home/${USERNAME} /.zshrc ]; then
26- echo ' eval "$(rbenv init -)"' >> /home/${USERNAME} /.zshrc
27+ if [ -f " ${user_home} /.zshrc" ]; then
28+ # shellcheck disable=SC2016
29+ echo ' eval "$(rbenv init -)"' >> " ${user_home} /.zshrc"
2730 fi
2831fi
2932
30- su ${USERNAME} -c " /usr/local/share/rbenv/bin/rbenv install $VERSION "
31- su ${USERNAME} -c " /usr/local/share/rbenv/bin/rbenv global $VERSION "
33+ su " ${USERNAME} " -c " /usr/local/share/rbenv/bin/rbenv install $VERSION "
34+ su " ${USERNAME} " -c " /usr/local/share/rbenv/bin/rbenv global $VERSION "
3235
3336rm -rf /var/lib/apt/lists/*
0 commit comments