-
Notifications
You must be signed in to change notification settings - Fork 183
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #395 from eitsupi/refactoring/core-scripts
Refactoring core Rocker scripts
- Loading branch information
Showing
20 changed files
with
366 additions
and
370 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,31 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
if id -u "${user}" >/dev/null 2>&1; then | ||
echo 'rstudio user already exists' | ||
else | ||
## Need to configure non-root user for RStudio | ||
DEFAULT_USER=${1:-${DEFAULT_USER:-rstudio}} | ||
useradd -s /bin/bash -m $DEFAULT_USER | ||
echo "${DEFAULT_USER}:${DEFAULT_USER}" | chpasswd | ||
addgroup ${DEFAULT_USER} staff | ||
DEFAULT_USER=${1:-${DEFAULT_USER:-"rstudio"}} | ||
|
||
mkdir -p /home/${DEFAULT_USER}/.rstudio/monitored/user-settings | ||
echo "alwaysSaveHistory='0' \ | ||
\nloadRData='0' \ | ||
\nsaveAction='0'" \ | ||
> /home/${DEFAULT_USER}/.rstudio/monitored/user-settings/user-settings | ||
if id -u "${DEFAULT_USER}" >/dev/null 2>&1; then | ||
echo "User ${DEFAULT_USER} already exists" | ||
else | ||
## Need to configure non-root user for RStudio | ||
useradd -s /bin/bash -m "$DEFAULT_USER" | ||
echo "${DEFAULT_USER}:${DEFAULT_USER}" | chpasswd | ||
addgroup "${DEFAULT_USER}" staff | ||
|
||
chown -R "${DEFAULT_USER}:${DEFAULT_USER}" "/home/${DEFAULT_USER}" | ||
## Rocker's default RStudio settings, for better reproducibility | ||
mkdir -p "/home/${DEFAULT_USER}/.rstudio/monitored/user-settings" | ||
cat <<EOF >"/home/${DEFAULT_USER}/.rstudio/monitored/user-settings/user-settings" | ||
alwaysSaveHistory="0" | ||
loadRData="0" | ||
saveAction="0" | ||
EOF | ||
chown -R "${DEFAULT_USER}:${DEFAULT_USER}" "/home/${DEFAULT_USER}" | ||
fi | ||
|
||
# If shiny server installed, make the user part of the shiny group | ||
if [ -x "$(command -v shiny-server)" ]; then | ||
adduser ${DEFAULT_USER} shiny | ||
adduser "${DEFAULT_USER}" shiny | ||
fi | ||
|
||
## configure git not to request password each time | ||
git config --system credential.helper 'cache --timeout=3600' | ||
git config --system push.default simple | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.