diff --git a/script-system-update-r b/script-system-update-r new file mode 100755 index 00000000..9bba2ff2 --- /dev/null +++ b/script-system-update-r @@ -0,0 +1,24 @@ +#!/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 $? \ No newline at end of file