Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[r-apt]: If R is already installed the installation should fail #204

Merged
merged 7 commits into from
Oct 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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