2024-06-12 13:02:54 +02:00

27 lines
887 B
Bash

#!/usr/bin/env bash
if [ -f ~/.homestead-features/wsl_user_name ]; then
WSL_USER_NAME="$(cat ~/.homestead-features/wsl_user_name)"
WSL_USER_GROUP="$(cat ~/.homestead-features/wsl_user_group)"
else
WSL_USER_NAME=vagrant
WSL_USER_GROUP=vagrant
fi
export DEBIAN_FRONTEND=noninteractive
if [ -f /home/$WSL_USER_NAME/.homestead-features/r-base ]
then
echo "r-base already installed."
exit 0
fi
touch /home/$WSL_USER_NAME/.homestead-features/r-base
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features
wget -qO- https://cloud.r-project.org/bin/linux/ubuntu/marutter_pubkey.asc | sudo gpg --dearmor -o /etc/apt/keyrings/r-project.gpg
echo "deb [signed-by=/etc/apt/keyrings/r-project.gpg] https://cloud.r-project.org/bin/linux/ubuntu jammy-cran40/" | sudo tee /etc/apt/sources.list.d/r-project.list
apt-get update
apt install -y r-base