Skip to content

Commit 810f226

Browse files
authored
Enhance R package installation script
Add temporary user profile for R library paths
1 parent 9ccb274 commit 810f226

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

scripts/install-r-packages.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,14 @@ fi
2828
#echo ".libPaths('${R_HOME}/site-library')" > /tmp/rprofile.site
2929
#export R_PROFILE=/tmp/rprofile.site
3030
# the ${R_HOME}/etc/R.profile has .libPaths(c(Sys.getenv("R_LIBS_USER"), .libPaths())), so we set R_LIBS_USER temporarily
31-
export R_LIBS_USER="${R_HOME}/site-library"
31+
#export R_LIBS_USER="${R_HOME}/site-library"
32+
SITE_LIB="${R_HOME}/site-library"
33+
# Add a per-run user profile (does NOT replace system Rprofile.site)
34+
TMP_PROFILE_USER="$(mktemp /tmp/Rprofile-user-XXXXXX.R)"
35+
cat > "$TMP_PROFILE_USER" <<EOF
36+
.libPaths(unique(c("${SITE_LIB}", .libPaths())))
37+
EOF
38+
export R_PROFILE_USER="$TMP_PROFILE_USER"
3239

3340
# Set the file variable to the provided argument
3441
INSTALL_FILE="$1"

0 commit comments

Comments
 (0)