Skip to content

Commit b539324

Browse files
authored
Merge pull request #298 from nmfs-opensci/copilot/fix-unbound-variable-error
Fix R_HOME unbound variable in install-r-packages.sh
2 parents bb70616 + 18f174d commit b539324

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

scripts/install-r-packages.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ fi
1818
# Main script execution as NB_USER
1919
echo "Running install-r-packages.sh as ${NB_USER}"
2020

21+
# Get R_HOME from R itself if not already set
22+
if [[ -z "${R_HOME:-}" ]]; then
23+
export R_HOME="$(R RHOME)"
24+
echo " R_HOME set to: ${R_HOME}"
25+
fi
26+
2127
# Make sure we install to the site-library
2228
echo ".libPaths('${R_HOME}/site-library')" > /tmp/rprofile.site
2329
export R_PROFILE=/tmp/rprofile.site

0 commit comments

Comments
 (0)