From b8b4eaae8df303448725a8b26b38b92316e9335b Mon Sep 17 00:00:00 2001 From: Henric Andersson Date: Tue, 20 May 2014 14:41:57 -0700 Subject: [PATCH] Added support for redhat based distros Script now autodetects redhat based distributions and download the correct file. Can also install using the autoinstall option. NOTE! Not as well tested as Debian based systems, since I don't run any redhat distro myself. Please provide feedback if you have issues. --- plexupdate.sh | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/plexupdate.sh b/plexupdate.sh index c0cacce..1ec1be7 100755 --- a/plexupdate.sh +++ b/plexupdate.sh @@ -34,7 +34,8 @@ # modify this script. # 2.4 Added support for the public versions of PMS # 2.5 Supports autoinstall if root and given the option - +# 2.6 Support for redhat derived distributions +# ################################################################# # Set these two to what you need, or create a .plexupdate file # in your home directory with these two (avoids changing this) @@ -95,6 +96,15 @@ if [ "${AUTOINSTALL}" == "yes" ]; then fi fi +# Detect if we're running on redhat instead of ubuntu +REDHAT=no; +PKGEXT='.deb' + +if [ -f /etc/redhat-release ]; then + REDHAT=yes; + PKGEXT='.rpm' +fi + # Useful functions rawurlencode() { local string="${1}" @@ -179,7 +189,8 @@ fi # Extract the URL for our release echo -n "Finding download URL for ${RELEASE}..." -DOWNLOAD=$(wget --load-cookies /tmp/kaka --save-cookies /tmp/kaka --keep-session-cookies "${URL_DOWNLOAD}" -O - 2>/dev/null | grep ".deb" | grep "${RELEASE}" | sed "s/.*href=\"\([^\"]*\.deb\)\"[^>]*>${RELEASE}.*/\1/") + +DOWNLOAD=$(wget --load-cookies /tmp/kaka --save-cookies /tmp/kaka --keep-session-cookies "${URL_DOWNLOAD}" -O - 2>/dev/null | grep "${PKGEXT}" | grep -m 1 "${RELEASE}" | sed "s/.*href=\"\([^\"]*\\${PKGEXT}\)\"[^>]*>${RELEASE}.*/\1/" ) echo -e "OK" if [ "${DOWNLOAD}" == "" ]; then @@ -208,7 +219,11 @@ fi echo "OK" if [ "${AUTOINSTALL}" == "yes" ]; then - dpkg -i "${FILENAME}" + if [ "${REDHAT}" == "yes" ]; then + rpm -i "${FILENAME}" + else + dpkg -i "${FILENAME}" + fi fi exit 0