Roll RHEL into CentOS

This commit is contained in:
2022-03-09 09:56:21 -05:00
parent 86eb9dd8b4
commit 1c837f7dbb

View File

@@ -304,7 +304,7 @@ installPackage() {
install_flags+=(--allow-downgrades) install_flags+=(--allow-downgrades)
;; ;;
--nogpgcheck) --nogpgcheck)
if [[ "$ID" =~ ^(fedora|centos|rhel)$ ]]; then if [[ "$ID" =~ ^(fedora|centos)$ ]]; then
install_flags+=(--nogpgcheck) install_flags+=(--nogpgcheck)
elif [[ "$ID" == "suse" ]]; then elif [[ "$ID" == "suse" ]]; then
install_flags+=(--allow-unsigned-rpm) install_flags+=(--allow-unsigned-rpm)
@@ -370,7 +370,7 @@ addRepo() {
fi fi
echo "Adding JRiver repository to package manager" echo "Adding JRiver repository to package manager"
if [[ "$ID" =~ ^(fedora|centos|rhel)$ ]]; then if [[ "$ID" =~ ^(fedora|centos)$ ]]; then
declare sources_dir="/etc/yum.repos.d/" declare sources_dir="/etc/yum.repos.d/"
sudo bash -c "cat <<- EOF > $sources_dir/jriver.repo sudo bash -c "cat <<- EOF > $sources_dir/jriver.repo
[jriver] [jriver]
@@ -533,7 +533,7 @@ buildRPM() {
# Translate package names # Translate package names
case "$TARGET" in case "$TARGET" in
fedora|centos|rhel) fedora|centos)
requires=("${requires[@]/libc6/glibc}") requires=("${requires[@]/libc6/glibc}")
requires=("${requires[@]/libasound2/alsa-lib}") requires=("${requires[@]/libasound2/alsa-lib}")
requires=("${requires[@]/libuuid1/libuuid}") requires=("${requires[@]/libuuid1/libuuid}")
@@ -803,7 +803,7 @@ openFirewall() {
fi fi
# Open the ports # Open the ports
if [[ "$ID" =~ ^(fedora|centos|rhel|suse)$ ]]; then if [[ "$ID" =~ ^(fedora|centos|suse)$ ]]; then
hash firewall-cmd 2>/dev/null || installPackage firewalld hash firewall-cmd 2>/dev/null || installPackage firewalld
if ! firewall_cmd --get-services | grep -q "$1"; then if ! firewall_cmd --get-services | grep -q "$1"; then
firewall_cmd --permanent --new-service="$1" &>/dev/null firewall_cmd --permanent --new-service="$1" &>/dev/null
@@ -1360,7 +1360,7 @@ getOS() {
# Set package manager for RPM distros # Set package manager for RPM distros
case "$ID" in case "$ID" in
centos|fedora|rhel) centos|fedora)
if hash dnf &>/dev/null; then if hash dnf &>/dev/null; then
MGR="dnf" MGR="dnf"
elif hash yum &>/dev/null; then elif hash yum &>/dev/null; then
@@ -1488,7 +1488,7 @@ main() {
getOS getOS
# Distro-specific commands # Distro-specific commands
if [[ "$ID" =~ ^(fedora|centos|rhel)$ ]]; then if [[ "$ID" =~ ^(fedora|centos)$ ]]; then
pkg_install(){ sudo "$MGR" install -y "$@"; } pkg_install(){ sudo "$MGR" install -y "$@"; }
pkg_remove(){ sudo "$MGR" remove -y "$@"; } pkg_remove(){ sudo "$MGR" remove -y "$@"; }
pkg_update(){ sudo "$MGR" makecache; } pkg_update(){ sudo "$MGR" makecache; }
@@ -1519,7 +1519,7 @@ main() {
getVersion getVersion
# Set target package name # Set target package name
if [[ "$ID" =~ ^(fedora|centos|rhel|suse)$ ]]; then if [[ "$ID" =~ ^(fedora|centos|suse)$ ]]; then
MCPKG="MediaCenter" MCPKG="MediaCenter"
[[ "$VERSION_SOURCE" == "user input" ]] && MCPKG="$MCPKG-$MCVERSION" [[ "$VERSION_SOURCE" == "user input" ]] && MCPKG="$MCPKG-$MCVERSION"
elif [[ "$ID" =~ ^(debian|ubuntu)$ ]]; then elif [[ "$ID" =~ ^(debian|ubuntu)$ ]]; then
@@ -1540,11 +1540,9 @@ main() {
echo "Adding universe repository" echo "Adding universe repository"
sudo add-apt-repository universe sudo add-apt-repository universe
fi fi
elif [[ "$ID" =~ ^(centos|rhel)$ ]]; then elif [[ "$ID" =~ ^(centos)$ ]] && ! hash dpkg &>/dev/null; then
echo "Adding EPEL repository" echo "Adding EPEL repository"
installPackage epel-release installPackage epel-release
elif [[ "$ID" =~ ^(rhel)$ ]] && ! hash dpkg &>/dev/null; then
installPackage epel-release
fi fi
if (( REPO_INSTALL_SWITCH )); then if (( REPO_INSTALL_SWITCH )); then
@@ -1562,7 +1560,7 @@ main() {
if (( BUILD_SWITCH )); then if (( BUILD_SWITCH )); then
installPackage "wget" installPackage "wget"
acquireDeb acquireDeb
if [[ "$TARGET" =~ (centos|fedora|rhel|suse) ]]; then if [[ "$TARGET" =~ (centos|fedora|suse) ]]; then
installPackage "dpkg" "rpm-build" installPackage "dpkg" "rpm-build"
buildRPM buildRPM
fi fi
@@ -1570,7 +1568,7 @@ main() {
if (( LOCAL_INSTALL_SWITCH )); then if (( LOCAL_INSTALL_SWITCH )); then
if ([[ "$TARGET" =~ (debian|ubuntu) ]] && installMCDEB) || if ([[ "$TARGET" =~ (debian|ubuntu) ]] && installMCDEB) ||
([[ "$TARGET" =~ (fedora|centos|rhel|suse) ]] && ([[ "$TARGET" =~ (fedora|centos|suse) ]] &&
installPackage --skip-check-installed --nogpgcheck "$MCRPM") || installPackage --skip-check-installed --nogpgcheck "$MCRPM") ||
([[ "$TARGET" == "arch" ]] && installMCArch); then ([[ "$TARGET" == "arch" ]] && installMCArch); then
echo "JRiver Media Center installed successfully from local package" echo "JRiver Media Center installed successfully from local package"