Redid the release detection to be language agnostic

Seems like some versions of wget will happily ask for a localized
version of the webpage, causing the processing to fail.

Now we look for something which remains static regardless of
langauge.
This commit is contained in:
Henric Andersson 2016-02-19 07:45:34 -08:00
commit 17851c6507

View file

@ -48,7 +48,7 @@ DOWNLOADDIR="."
# Defaults # Defaults
# (aka "Advanced" settings, can be overriden with config file) # (aka "Advanced" settings, can be overriden with config file)
RELEASE="64-bit" RELEASE="64"
KEEP=no KEEP=no
FORCE=no FORCE=no
PUBLIC=no PUBLIC=no
@ -85,7 +85,7 @@ do
(-d) AUTODELETE=yes;; (-d) AUTODELETE=yes;;
(-f) FORCE=yes;; (-f) FORCE=yes;;
(-k) KEEP=yes;; (-k) KEEP=yes;;
(-o) RELEASE="32-bit";; (-o) RELEASE="32";;
(-p) PUBLIC=yes;; (-p) PUBLIC=yes;;
(-u) AUTOUPDATE=yes;; (-u) AUTOUPDATE=yes;;
(-U) AUTOUPDATE=no;; (-U) AUTOUPDATE=no;;
@ -157,12 +157,14 @@ if [ -z "${DOWNLOADDIR}" ]; then
fi fi
# Detect if we're running on redhat instead of ubuntu # Detect if we're running on redhat instead of ubuntu
REDHAT=no;
PKGEXT='.deb'
if [ -f /etc/redhat-release ]; then if [ -f /etc/redhat-release ]; then
REDHAT=yes; REDHAT=yes;
PKGEXT='.rpm' PKGEXT='.rpm'
RELEASE="Fedora${RELEASE}"
else
REDHAT=no;
PKGEXT='.deb'
RELEASE="Ubuntu${RELEASE}"
fi fi
# Useful functions # Useful functions
@ -253,7 +255,7 @@ 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 "${PKGEXT}" | grep -m 1 "${RELEASE}" | sed "s/.*href=\"\([^\"]*\\${PKGEXT}\)\"[^>]*>${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}\)\"[^>]*>.*/\1/" )
echo -e "OK" echo -e "OK"
if [ "${DOWNLOAD}" == "" ]; then if [ "${DOWNLOAD}" == "" ]; then