Skip to content

Commit 0a3846f

Browse files
committed
Support installing RStudio on distros without openssl1.1
1 parent 99125ab commit 0a3846f

File tree

1 file changed

+21
-7
lines changed

1 file changed

+21
-7
lines changed

repo2docker/buildpacks/_r_base.py

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,17 @@ def rstudio_base_scripts(r_version):
1414
shiny_proxy_version = "1.1"
1515
shiny_sha256sum = "80f1e48f6c824be7ef9c843bb7911d4981ac7e8a963e0eff823936a8b28476ee"
1616

17-
rstudio_url = "https://download2.rstudio.org/server/bionic/amd64/rstudio-server-2022.02.1-461-amd64.deb"
18-
rstudio_sha256sum = (
19-
"239e8d93e103872e7c6d827113d88871965f82ffb0397f5638025100520d8a54"
20-
)
17+
18+
# RStudio server has different builds based on wether OpenSSL 3 or 1.1 is available in the base
19+
# image. 3 is present Jammy+, 1.1 until then. Instead of hardcoding URLs based on distro, we actually
20+
# check for the dependency itself directly in the code below. You can find these URLs in
21+
# https://posit.co/download/rstudio-server/, toggling between Ubuntu 22 (for openssl3) vs earlier versions (openssl 1.1)
22+
# you may forget about openssl, but openssl never forgets you.
23+
rstudio_openssl3_url = 'https://download2.rstudio.org/server/jammy/amd64/rstudio-server-2022.12.0-353-amd64.deb'
24+
rstudio_openssl3_sha256sum = 'a5aa2202786f9017a6de368a410488ea2e4fc6c739f78998977af214df0d6288'
25+
26+
rstudio_openssl1_url = 'https://download2.rstudio.org/server/bionic/amd64/rstudio-server-2022.12.0-353-amd64.deb'
27+
rstudio_openssl1_sha256sum = 'bb88e37328c304881e60d6205d7dac145525a5c2aaaf9da26f1cb625b7d47e6e'
2128
rsession_proxy_version = "2.0.1"
2229

2330
return [
@@ -27,11 +34,18 @@ def rstudio_base_scripts(r_version):
2734
# but here it's important because these recommend r-base,
2835
# which will upgrade the installed version of R, undoing our pinned version
2936
rf"""
30-
curl --silent --location --fail {rstudio_url} > /tmp/rstudio.deb && \
37+
apt-get update > /dev/null && \
38+
if apt-cache search libssl3 > /dev/null; then \
39+
RSTUDIO_URL="{rstudio_openssl3_url}" ;\
40+
RSTUDIO_HASH="{rstudio_openssl3_sha256sum}" ;\
41+
else \
42+
RSTUDIO_URL="{rstudio_openssl1_url}" ;\
43+
RSTUDIO_HASH="{rstudio_openssl1_sha256sum}" ;\
44+
fi && \
45+
curl --silent --location --fail ${{RSTUDIO_URL}} > /tmp/rstudio.deb && \
3146
curl --silent --location --fail {shiny_server_url} > /tmp/shiny.deb && \
32-
echo '{rstudio_sha256sum} /tmp/rstudio.deb' | sha256sum -c - && \
47+
echo "${{RSTUDIO_HASH}} /tmp/rstudio.deb' | sha256sum -c - && \
3348
echo '{shiny_sha256sum} /tmp/shiny.deb' | sha256sum -c - && \
34-
apt-get update > /dev/null && \
3549
apt install -y --no-install-recommends /tmp/rstudio.deb /tmp/shiny.deb && \
3650
rm /tmp/*.deb && \
3751
apt-get -qq purge && \

0 commit comments

Comments
 (0)