Skip to content

Commit

Permalink
fix(rstudio): fix permission of rstudio's user config file
Browse files Browse the repository at this point in the history
  • Loading branch information
avouacr committed May 31, 2024
1 parent 88d09e4 commit 2fa9b6c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
10 changes: 7 additions & 3 deletions rstudio/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ LABEL maintainer="InseeFrLab <[email protected]>"
ENV DEFAULT_USER=${USERNAME}
ENV USERID=${UID}
ENV GROUPID=${GID}
ARG RSTUDIO_CONF_FILE="/etc/rstudio/rsession.conf"
ARG RSTUDIO_SYSTEM_CONF_FILE="/etc/rstudio/rsession.conf"
ARG RSTUDIO_USER_CONF_FILE="${HOME}/.config/rstudio/rstudio-prefs.json"
ENV PATH="/usr/lib/rstudio-server/bin:${PATH}"

USER root
Expand All @@ -16,8 +17,11 @@ USER root
RUN /rocker_scripts/install_rstudio.sh && \
/rocker_scripts/install_pandoc.sh && \
# Set default working directory for R sessions and R projects
echo "session-default-working-dir=${WORKSPACE_DIR}" >> ${RSTUDIO_CONF_FILE} && \
echo "session-default-new-project-dir=${WORKSPACE_DIR}" >> ${RSTUDIO_CONF_FILE} && \
echo "session-default-working-dir=${WORKSPACE_DIR}" >> ${RSTUDIO_SYSTEM_CONF_FILE} && \
echo "session-default-new-project-dir=${WORKSPACE_DIR}" >> ${RSTUDIO_SYSTEM_CONF_FILE} && \
# Initialize RStudio's user config file
mkdir -p "$(dirname $RSTUDIO_USER_CONF_FILE)" && \
echo '{}' > $RSTUDIO_USER_CONF_FILE && \
# Fix permissions
chown -R ${USERNAME}:${GROUPNAME} ${HOME} && \
# Clean
Expand Down
5 changes: 2 additions & 3 deletions scripts/onyxia-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,10 @@ if [[ "$DARK_MODE" == "true" ]]; then
echo "{\"@jupyterlab/apputils-extension:themes\": {\"theme\": \"JupyterLab Dark\"}}" > ${MAMBA_DIR}/share/jupyter/lab/settings/overrides.json;
fi
if command -v code-server; then
jq '. + {"workbench.colorTheme": "Default Dark Modern" }' ${HOME}/.local/share/code-server/User/settings.json > ${HOME}/tmp.settings.json && mv ${HOME}/tmp.settings.json ${HOME}/.local/share/code-server/User/settings.json
jq '. + {"workbench.colorTheme": "Default Dark Modern"}' ${HOME}/.local/share/code-server/User/settings.json > ${HOME}/tmp.settings.json && mv ${HOME}/tmp.settings.json ${HOME}/.local/share/code-server/User/settings.json
fi
if command -v rstudio-server; then
mkdir -p ${HOME}/.config/rstudio/
echo "{\"editor_theme\": \"Vibrant Ink\" }" > ${HOME}/.config/rstudio/rstudio-prefs.json
jq '. + {"editor_theme": "Vibrant Ink"}' ${HOME}/.config/rstudio/rstudio-prefs.json > ${HOME}/tmp.settings.json && mv ${HOME}/tmp.settings.json ${HOME}/.config/rstudio/rstudio-prefs.json
fi
fi

Expand Down

0 comments on commit 2fa9b6c

Please sign in to comment.