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

Support installing RStudio Server for Ubuntu 22.04 #435

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
32 changes: 24 additions & 8 deletions scripts/install_rstudio.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,18 @@ set -e
RSTUDIO_VERSION=${1:-${RSTUDIO_VERSION:-"stable"}}
DEFAULT_USER=${DEFAULT_USER:-"rstudio"}

ARCH=$(dpkg --print-architecture)

apt-get update
apt-get install -y --no-install-recommends \
# a function to install apt packages only if they are not installed
function apt_install() {
if ! dpkg -s "$@" >/dev/null 2>&1; then
if [ "$(find /var/lib/apt/lists/* | wc -l)" = "0" ]; then
apt-get update
fi
apt-get install -y --no-install-recommends "$@"
fi
}

apt_install \
lsb-release \
file \
git \
libapparmor1 \
Expand All @@ -31,7 +39,8 @@ apt-get install -y --no-install-recommends \
sudo \
wget

rm -rf /var/lib/apt/lists/*
ARCH=$(dpkg --print-architecture)
UBUNTU_VERSION=$(lsb_release -sc)

# install s6 supervisor
/rocker_scripts/install_s6init.sh
Expand All @@ -43,11 +52,15 @@ if [ "$RSTUDIO_VERSION" = "latest" ]; then
RSTUDIO_VERSION="stable"
fi

if [ "$UBUNTU_VERSION" = "focal" ]; then
UBUNTU_VERSION="bionic"
fi

if [ "$RSTUDIO_VERSION" = "stable" ] || [ "$RSTUDIO_VERSION" = "preview" ] || [ "$RSTUDIO_VERSION" = "daily" ]; then
wget "https://rstudio.org/download/latest/${RSTUDIO_VERSION}/server/bionic/rstudio-server-latest-${ARCH}.deb" -O "$DOWNLOAD_FILE"
wget "https://rstudio.org/download/latest/${RSTUDIO_VERSION}/server/${UBUNTU_VERSION}/rstudio-server-latest-${ARCH}.deb" -O "$DOWNLOAD_FILE"
else
wget "https://download2.rstudio.org/server/bionic/${ARCH}/rstudio-server-${RSTUDIO_VERSION/"+"/"-"}-${ARCH}.deb" -O "$DOWNLOAD_FILE" ||
wget "https://s3.amazonaws.com/rstudio-ide-build/server/bionic/${ARCH}/rstudio-server-${RSTUDIO_VERSION/"+"/"-"}-${ARCH}.deb" -O "$DOWNLOAD_FILE"
wget "https://download2.rstudio.org/server/${UBUNTU_VERSION}/${ARCH}/rstudio-server-${RSTUDIO_VERSION/"+"/"-"}-${ARCH}.deb" -O "$DOWNLOAD_FILE" ||
wget "https://s3.amazonaws.com/rstudio-ide-build/server/${UBUNTU_VERSION}/${ARCH}/rstudio-server-${RSTUDIO_VERSION/"+"/"-"}-${ARCH}.deb" -O "$DOWNLOAD_FILE"
fi

dpkg -i "$DOWNLOAD_FILE"
Expand Down Expand Up @@ -109,6 +122,9 @@ cp /rocker_scripts/init_set_env.sh /etc/cont-init.d/01_set_env
cp /rocker_scripts/init_userconf.sh /etc/cont-init.d/02_userconf
cp /rocker_scripts/pam-helper.sh /usr/lib/rstudio-server/bin/pam-helper

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

# Check the RStudio Server version
echo -e "Check the RStudio Server version...\n"

Expand Down
6 changes: 6 additions & 0 deletions tests/rocker_scripts/matrix.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@
"script_name": "install_rstudio.sh",
"script_arg": "1.3.959"
},
{
"base_image": "rocker/r-ver",
"tag": "devel",
"script_name": "install_rstudio.sh",
"script_arg": "daily"
},
{
"base_image": "rocker/r-ver",
"tag": "latest",
Expand Down