Merge pull request #107 from rstudio/deth-update-r-install
add amazon linux 2, alma linux, and rocky linux to r-install script
This commit is contained in:
commit
61a6299168
1 changed files with 39 additions and 6 deletions
45
install.sh
45
install.sh
|
|
@ -75,9 +75,22 @@ detect_os () {
|
||||||
then
|
then
|
||||||
distro="LEAP15"
|
distro="LEAP15"
|
||||||
fi
|
fi
|
||||||
|
if [[ $(cat /etc/os-release | grep -e "^CPE_NAME\=*" | cut -f 2 -d '=') =~ cpe:2.3:o:amazon:amazon_linux:2 ]]
|
||||||
|
then
|
||||||
|
distro="Amazon"
|
||||||
|
fi
|
||||||
|
if [[ $(cat /etc/os-release | grep -e "^CPE_NAME\=*" | cut -f 2 -d '=') =~ cpe:/o:almalinux:almalinux:8::baseos ]]
|
||||||
|
then
|
||||||
|
distro="Alma"
|
||||||
|
fi
|
||||||
|
if [[ $(cat /etc/os-release | grep -e "^CPE_NAME\=*" | cut -f 2 -d '=') =~ cpe:/o:rocky:rocky:8.5:GA ]]
|
||||||
|
then
|
||||||
|
distro="Rocky"
|
||||||
|
fi
|
||||||
if [[ $(cat /etc/os-release | grep -e "^ID\=*" | cut -f 2 -d '=') == "debian" ]]; then
|
if [[ $(cat /etc/os-release | grep -e "^ID\=*" | cut -f 2 -d '=') == "debian" ]]; then
|
||||||
distro="Debian"
|
distro="Debian"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "${distro}"
|
echo "${distro}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -103,13 +116,21 @@ detect_os_version () {
|
||||||
if [[ "${os}" == "SLES15" ]] || [[ "${os}" == "LEAP15" ]]; then
|
if [[ "${os}" == "SLES15" ]] || [[ "${os}" == "LEAP15" ]]; then
|
||||||
cat /etc/os-release | grep -e "^VERSION_ID\=*" | cut -f 2 -d '=' | sed -e 's/[".]//g'
|
cat /etc/os-release | grep -e "^VERSION_ID\=*" | cut -f 2 -d '=' | sed -e 's/[".]//g'
|
||||||
fi
|
fi
|
||||||
|
# reuse rhel7 binaries for amazon
|
||||||
|
if [[ "${os}" == "Amazon" ]]; then
|
||||||
|
echo "7"
|
||||||
|
fi
|
||||||
|
# reuse rhel8 binaries for alma and rocky
|
||||||
|
if [[ "${os}" =~ ^(Alma|Rocky) ]]; then
|
||||||
|
echo "8"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Returns the installer type
|
# Returns the installer type
|
||||||
detect_installer_type () {
|
detect_installer_type () {
|
||||||
os=$1
|
os=$1
|
||||||
case $os in
|
case $os in
|
||||||
"RedHat" | "CentOS" | "LEAP12" | "LEAP15" | "SLES12" | "SLES15")
|
"RedHat" | "CentOS" | "LEAP12" | "LEAP15" | "SLES12" | "SLES15" | "Amazon" | "Alma" | "Rocky")
|
||||||
echo "rpm"
|
echo "rpm"
|
||||||
;;
|
;;
|
||||||
"Ubuntu" | "Debian")
|
"Ubuntu" | "Debian")
|
||||||
|
|
@ -139,7 +160,7 @@ download_name () {
|
||||||
os=$1
|
os=$1
|
||||||
version=$2
|
version=$2
|
||||||
case $os in
|
case $os in
|
||||||
"RedHat" | "CentOS")
|
"RedHat" | "CentOS" | "Amazon" | "Alma" | "Rocky")
|
||||||
echo "R-${version}-1-1.x86_64.rpm"
|
echo "R-${version}-1-1.x86_64.rpm"
|
||||||
;;
|
;;
|
||||||
"Ubuntu" | "Debian")
|
"Ubuntu" | "Debian")
|
||||||
|
|
@ -164,7 +185,7 @@ download_url () {
|
||||||
else
|
else
|
||||||
|
|
||||||
case $os in
|
case $os in
|
||||||
"RedHat" | "CentOS")
|
"RedHat" | "CentOS" | "Amazon" | "Alma" | "Rocky")
|
||||||
echo "${CDN_URL}/centos-${ver}/pkgs/${name}"
|
echo "${CDN_URL}/centos-${ver}/pkgs/${name}"
|
||||||
;;
|
;;
|
||||||
"Ubuntu")
|
"Ubuntu")
|
||||||
|
|
@ -276,7 +297,7 @@ install_rpm () {
|
||||||
yes="-y"
|
yes="-y"
|
||||||
fi
|
fi
|
||||||
case $os in
|
case $os in
|
||||||
"RedHat" | "CentOS")
|
"RedHat" | "CentOS" | "Amazon" | "Alma" | "Rocky")
|
||||||
if ! has_sudo "yum"; then
|
if ! has_sudo "yum"; then
|
||||||
echo "Must have sudo privileges to run yum"
|
echo "Must have sudo privileges to run yum"
|
||||||
exit 1
|
exit 1
|
||||||
|
|
@ -305,9 +326,12 @@ install_pre () {
|
||||||
ver=$2
|
ver=$2
|
||||||
|
|
||||||
case $os in
|
case $os in
|
||||||
"RedHat" | "CentOS")
|
"RedHat" | "CentOS" | "Alma" | "Rocky")
|
||||||
install_epel "${ver}"
|
install_epel "${ver}"
|
||||||
;;
|
;;
|
||||||
|
"Amazon")
|
||||||
|
install_epel_amzn
|
||||||
|
;;
|
||||||
"SLES12")
|
"SLES12")
|
||||||
install_python_backports
|
install_python_backports
|
||||||
;;
|
;;
|
||||||
|
|
@ -316,7 +340,16 @@ install_pre () {
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
# Installs EPEL for RHEL/CentOS
|
# Installs EPEL for Amazon Linux 2
|
||||||
|
install_epel_amzn () {
|
||||||
|
yes=
|
||||||
|
if [[ "${RUN_UNATTENDED}" -ne "0" ]]; then
|
||||||
|
yes="-y"
|
||||||
|
fi
|
||||||
|
${SUDO} amazon-linux-extras install epel ${yes}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Installs EPEL for RHEL/CentOS/Alma/Rocky
|
||||||
install_epel () {
|
install_epel () {
|
||||||
ver=$1
|
ver=$1
|
||||||
yes=
|
yes=
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue