mirror of
https://github.com/mrworf/plexupdate.git
synced 2025-08-19 12:59:40 -07:00
Fix RPM version parsing
This commit is contained in:
parent
5067fc91dc
commit
ebd6a5876b
2 changed files with 10 additions and 2 deletions
|
@ -224,13 +224,21 @@ isNewerVersion() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
parseVersion() {
|
||||||
|
if [ "${REDHAT}" = "yes" ]; then
|
||||||
|
cut -f2- -d- <<< "$1" | cut -f1-4 -d.
|
||||||
|
else
|
||||||
|
cut -f2 -d_ <<< "$1"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
getPlexVersion() {
|
getPlexVersion() {
|
||||||
if [ "${REDHAT}" != "yes" ]; then
|
if [ "${REDHAT}" != "yes" ]; then
|
||||||
dpkg-query --showformat='${Version}' --show plexmediaserver 2>/dev/null
|
dpkg-query --showformat='${Version}' --show plexmediaserver 2>/dev/null
|
||||||
elif hash rpm 2>/dev/null; then
|
elif hash rpm 2>/dev/null; then
|
||||||
local rpmtemp
|
local rpmtemp
|
||||||
if rpmtemp=$(rpm -q plexmediaserver); then
|
if rpmtemp=$(rpm -q plexmediaserver); then
|
||||||
cut -f2 -d_ <<< "$rpmtemp"
|
parseVersion "$rpmtemp"
|
||||||
else
|
else
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -420,7 +420,7 @@ fi
|
||||||
SKIP_DOWNLOAD="no"
|
SKIP_DOWNLOAD="no"
|
||||||
|
|
||||||
INSTALLED_VERSION="$(getPlexVersion)" || warn "Unable to detect installed version, first time?"
|
INSTALLED_VERSION="$(getPlexVersion)" || warn "Unable to detect installed version, first time?"
|
||||||
FILE_VERSION="$(cut -f2 -d_ <<< "${FILENAME}")"
|
FILE_VERSION="$(parseVersion "${FILENAME}")"
|
||||||
verboseOutput INSTALLED_VERSION FILE_VERSION
|
verboseOutput INSTALLED_VERSION FILE_VERSION
|
||||||
|
|
||||||
if [ "${REDHAT}" = "yes" -a "${AUTOINSTALL}" = "yes" -a "${AUTOSTART}" = "no" ]; then
|
if [ "${REDHAT}" = "yes" -a "${AUTOINSTALL}" = "yes" -a "${AUTOSTART}" = "no" ]; then
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue