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.
This commit is contained in:
Henric Andersson 2014-05-20 14:41:57 -07:00
commit b8b4eaae8d

View file

@ -34,7 +34,8 @@
# modify this script. # modify this script.
# 2.4 Added support for the public versions of PMS # 2.4 Added support for the public versions of PMS
# 2.5 Supports autoinstall if root and given the option # 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 # Set these two to what you need, or create a .plexupdate file
# in your home directory with these two (avoids changing this) # in your home directory with these two (avoids changing this)
@ -95,6 +96,15 @@ if [ "${AUTOINSTALL}" == "yes" ]; then
fi fi
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 # Useful functions
rawurlencode() { rawurlencode() {
local string="${1}" local string="${1}"
@ -179,7 +189,8 @@ fi
# Extract the URL for our release # Extract the URL for our release
echo -n "Finding download URL for ${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" echo -e "OK"
if [ "${DOWNLOAD}" == "" ]; then if [ "${DOWNLOAD}" == "" ]; then
@ -208,7 +219,11 @@ fi
echo "OK" echo "OK"
if [ "${AUTOINSTALL}" == "yes" ]; then if [ "${AUTOINSTALL}" == "yes" ]; then
dpkg -i "${FILENAME}" if [ "${REDHAT}" == "yes" ]; then
rpm -i "${FILENAME}"
else
dpkg -i "${FILENAME}"
fi
fi fi
exit 0 exit 0