From 4c84d995cf0f325dd20a850bdffc2ac36f2e5401 Mon Sep 17 00:00:00 2001 From: Bryan Roessler Date: Mon, 6 Dec 2021 12:41:00 -0500 Subject: [PATCH] Add script-system-update-r --- script-system-update-r | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 script-system-update-r 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