Skip to content

Commit

Permalink
[r-apt]: If R is already installed the installation should fail (#204)
Browse files Browse the repository at this point in the history
This PR also tweaks installation on Debian. (Related to
#173 (comment))
  • Loading branch information
eitsupi committed Oct 8, 2023
1 parent 6959850 commit 6833d03
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/r-apt/NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

If the `useTesting` is `true`, `linux/arm64` platform `debian` also supported.

Note that this Feature only supports non-R images. If R is already installed, installation will be failed.

## R package installation

### Binary installation via apt
Expand Down
2 changes: 1 addition & 1 deletion src/r-apt/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "R (via apt)",
"id": "r-apt",
"version": "0.4.0",
"version": "0.4.1",
"description": "Installs the latest R, some R packages, and needed dependencies. Note: May require source code compilation for some R packages.",
"documentationURL": "https://github.com/rocker-org/devcontainer-features/tree/main/src/r-apt",
"options": {
Expand Down
10 changes: 8 additions & 2 deletions src/r-apt/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ PIP_PACKAGES=()

set -e

if R --version >/dev/null 2>&1 && dpkg -s r-base >/dev/null 2>&1; then
echo "(!) R has already been installed via a non-apt method."
echo " This script is designed only for non-R Debian and Ubuntu."
exit 1
fi

# Clean up
rm -rf /var/lib/apt/lists/*

Expand Down Expand Up @@ -156,8 +162,8 @@ elif [ "${ID}" = "debian" ]; then
if [ "${USE_TESTING}" = "true" ]; then
echo "Set up Debian testing..."
echo "deb http://http.debian.net/debian testing main" >/etc/apt/sources.list.d/debian-testing.list
echo "deb http://http.debian.net/debian-security testing-security main" >>/etc/apt/sources.list.d/debian-testing.list
echo "deb http://http.debian.net/debian unstable main" >/etc/apt/sources.list.d/debian-unstable.list
echo 'APT::Default-Release "testing";' >/etc/apt/apt.conf.d/default
else
echo "Set up for Debian ${VERSION_CODENAME}..."
curl -fsSL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x95c0faf38db3ccad0c080a7bdc78b2ddeabc47b7" | tee -a /etc/apt/trusted.gpg.d/cran_debian_key.asc >/dev/null
Expand Down Expand Up @@ -218,7 +224,7 @@ fi
if [ "${ID}" = "debian" ] && [ "${install_httpgd}" = "true" ]; then
check_packages \
g++ make r-cran-later r-cran-systemfonts r-cran-bh \
libxml2-dev libicu-dev libcairo2-dev libfontconfig1-dev libfreetype6-dev libpng-dev
libxml2-dev libicu-dev libcairo2-dev libfontconfig1-dev libfreetype-dev libpng-dev
R -q -e 'install.packages("httpgd")'
fi

Expand Down

0 comments on commit 6833d03

Please sign in to comment.