diff --git a/scripts/install_R_deps.sh b/scripts/install_R_deps.sh new file mode 100755 index 00000000..2ec1c144 --- /dev/null +++ b/scripts/install_R_deps.sh @@ -0,0 +1,62 @@ +#!/bin/bash + + +set -e + +R_VERSION=${1:-${R_VERSION:-"latest"}} + +# shellcheck source=/dev/null +source /etc/os-release + +apt-get update +apt-get -y install locales + +## Configure default locale +LANG=${LANG:-"en_US.UTF-8"} +/usr/sbin/locale-gen --lang "${LANG}" +/usr/sbin/update-locale --reset LANG="${LANG}" + +export DEBIAN_FRONTEND=noninteractive + +R_HOME=${R_HOME:-"/usr/local/lib/R"} + +READLINE_VERSION=8 +if [ "${UBUNTU_CODENAME}" == "bionic" ]; then + READLINE_VERSION=7 +fi + +apt-get install -y --no-install-recommends \ + bash-completion \ + ca-certificates \ + file \ + fonts-texgyre \ + g++ \ + gfortran \ + gsfonts \ + libblas-dev \ + libbz2-* \ + libcurl4 \ + "libicu[0-9][0-9]" \ + liblapack-dev \ + libpcre2* \ + libjpeg-turbo* \ + libpangocairo-* \ + libpng16* \ + "libreadline${READLINE_VERSION}" \ + libtiff* \ + liblzma* \ + make \ + tzdata \ + unzip \ + zip \ + zlib1g + + +mkdir -p "${R_HOME}/site-library" +chown root:staff "${R_HOME}/site-library" +chmod g+ws "${R_HOME}/site-library" +echo "R_LIBS=\${R_LIBS-'${R_HOME}/site-library:${R_HOME}/library'}" >>"${R_HOME}/etc/Renviron.site" + +echo "PATH=${PATH}" >>"${R_HOME}/etc/Renviron.site" + + diff --git a/scripts/setup_R.sh b/scripts/setup_R.sh index df02a859..cba9a35f 100755 --- a/scripts/setup_R.sh +++ b/scripts/setup_R.sh @@ -70,7 +70,7 @@ if [ ! -x "$(command -v r)" ]; then # Clean up # shellcheck disable=SC2086 - # apt-get remove --purge -y ${BUILDDEPS} + apt-get remove --purge -y ${BUILDDEPS} apt-get autoremove -y apt-get autoclean -y fi