Files
hartman-server/script-system-update-r

24 lines
601 B
Bash
Executable File

#!/usr/bin/env bash
# Update the R binaries and RStudio-R4 application meny entry
# Copyright 2021 Bryan C. Roessler
parent="${BASH_SOURCE[0]}"
parent=${parent%/*}
[[ -f "$parent"/functions ]] && . "$parent"/functions || exit 1
is_root
[[ $# -ne 1 ]] && echo "Missing R version argument." && exit 1
ask_ok "RStudio-R4 to version $1?" || exit $?
sudo dnf install -y "https://cdn.rstudio.com/r/centos-7/pkgs/R-${1}-1-1.x86_64.rpm"
desktop_file="/usr/share/applications/rstudio-4.desktop"
[[ ! -f "$desktop_file" ]] && exit 1
sed -i "s|/opt/R/.*/bin/R|/opt/R/$1/bin/R|" "$desktop_file"
exit $?