-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path50-rstudio.sh
executable file
·35 lines (32 loc) · 1.1 KB
/
50-rstudio.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/bash
# Copyright (c) 2024 b-data GmbH.
# Distributed under the terms of the MIT License.
set -e
# Set environment variables in Renviron.site
exclude_vars="HOME LD_LIBRARY_PATH OLDPWD PATH PWD RSTUDIO_VERSION SHLVL"
for var in $(compgen -e); do
[[ ! $exclude_vars =~ $var ]] && echo "$var=${!var}" \
>> "$(R RHOME)/etc/Renviron.site"
done
if [ "$(id -u)" == 0 ]; then
RS_USD="/home/$NB_USER${DOMAIN:+@$DOMAIN}/.config/rstudio"
# Install RStudio settings
run_user_group mkdir -p "$RS_USD"
if [[ ! -f "$RS_USD/rstudio-prefs.json" ]]; then
run_user_group cp -a --no-preserve=ownership \
/var/backups/skel/.config/rstudio/rstudio-prefs.json \
"$RS_USD/rstudio-prefs.json"
fi
# Create user's working folder
run_user_group mkdir -p "/home/$NB_USER${DOMAIN:+@$DOMAIN}/working"
else
RS_USD="$HOME/.config/rstudio"
# Install RStudio settings
mkdir -p "$RS_USD"
if [[ ! -f "$RS_USD/rstudio-prefs.json" ]]; then
cp -a /var/backups/skel/.config/rstudio/rstudio-prefs.json \
"$RS_USD/rstudio-prefs.json"
fi
# Create user's working folder
mkdir -p "$HOME/working"
fi