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
# (aka "Advanced" settings, can be overriden with config file)
RELEASE="64-bit"
RELEASE="64"
KEEP=no
FORCE=no
PUBLIC=no
@ -85,7 +85,7 @@ do
(-d) AUTODELETE=yes;;
(-f) FORCE=yes;;
(-k) KEEP=yes;;
(-o) RELEASE="32-bit";;
(-o) RELEASE="32";;
(-p) PUBLIC=yes;;
(-u) AUTOUPDATE=yes;;
(-U) AUTOUPDATE=no;;
@ -157,12 +157,14 @@ if [ -z "${DOWNLOADDIR}" ]; then
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'
RELEASE="Fedora${RELEASE}"
else
REDHAT=no;
PKGEXT='.deb'
RELEASE="Ubuntu${RELEASE}"
fi
# Useful functions
@ -253,7 +255,7 @@ 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 "${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"
if [ "${DOWNLOAD}" == "" ]; then