lint/scripts/install-r-package-or-fail.R
Marco Ferrari 60983d395f
fix: fail if r package installation fails (#4994)
- Fail if the installation of a R package fails.
- Install the remotes package once during the image build, and not when we scan
  files at runtime.
- Reuse the default R library directory instead of moving it to /home/r-library
2023-12-21 20:52:57 +01:00

12 lines
391 B
R
Executable file

#!/usr/bin/env Rscript
# Based on: https://stackoverflow.com/questions/26244530/how-do-i-make-install-packages-return-an-error-if-an-r-package-cannot-be-install
packages = commandArgs(trailingOnly=TRUE)
for (l in packages) {
install.packages(l, repos='https://cloud.r-project.org/');
if ( ! library(l, character.only=TRUE, logical.return=TRUE) ) {
quit(status=1, save='no')
}
}