Skip to content

Commit

Permalink
Merge pull request #435 from eitsupi/rstudio-for-jammy
Browse files Browse the repository at this point in the history
  • Loading branch information
eitsupi committed May 3, 2022
2 parents a3289e3 + 9d49cd0 commit 6a5c26a
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 8 deletions.
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

0 comments on commit 6a5c26a

Please sign in to comment.