ruby: fix permissions and ln for oryx (#43)
* ruby: fix permissions and ln for oryx * add sudo_if
This commit is contained in:
parent
a81ff33fda
commit
a71a223511
1 changed files with 13 additions and 1 deletions
|
@ -167,6 +167,14 @@ check_packages() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sudo_if() {
|
||||||
|
COMMAND="$*"
|
||||||
|
if [ "$(id -u)" -eq 0 ] && [ "$USERNAME" != "root" ]; then
|
||||||
|
su - "$USERNAME" -c "$COMMAND"
|
||||||
|
else
|
||||||
|
"$COMMAND"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# Ensure apt is in non-interactive to avoid prompts
|
# Ensure apt is in non-interactive to avoid prompts
|
||||||
export DEBIAN_FRONTEND=noninteractive
|
export DEBIAN_FRONTEND=noninteractive
|
||||||
|
@ -271,11 +279,15 @@ if [ "${SKIP_RBENV_RBUILD}" != "true" ]; then
|
||||||
|
|
||||||
if [ "${USERNAME}" != "root" ]; then
|
if [ "${USERNAME}" != "root" ]; then
|
||||||
mkdir -p /home/${USERNAME}/.rbenv/plugins
|
mkdir -p /home/${USERNAME}/.rbenv/plugins
|
||||||
chown -R ${USERNAME} /home/${USERNAME}/.rbenv
|
sudo_if chown -R ${USERNAME} /home/${USERNAME}/.rbenv
|
||||||
|
sudo_if chown -R ${USERNAME} /usr/local/rvm/
|
||||||
|
|
||||||
if [[ ! -d "/home/${USERNAME}/.rbenv/plugins/ruby-build" ]]; then
|
if [[ ! -d "/home/${USERNAME}/.rbenv/plugins/ruby-build" ]]; then
|
||||||
ln -s /usr/local/share/ruby-build /home/${USERNAME}/.rbenv/plugins/ruby-build
|
ln -s /usr/local/share/ruby-build /home/${USERNAME}/.rbenv/plugins/ruby-build
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
ln -s /usr/local/rvm/rubies/default/bin/ruby /usr/local/rvm/gems/default/bin
|
||||||
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue