Two bugs found by the first real build:
- 'R --version | head -1' aborted the script with exit 141 under
'set -o pipefail': head closes the pipe and R dies of SIGPIPE. Use
'sed -n 1p', which consumes all input.
- R installed to lib64/R, not the lib/R the script assumed. Pin --libdir
and ask 'R RHOME' for the real path instead of guessing.
Also stop exporting R_HOME. R.cmake warns that a set R_HOME makes R emit
'WARNING: ignoring environment value of R_HOME', which corrupts the output
cmake parses; CUSTOM_R_PATH is the supported way to select an R.