summaryrefslogtreecommitdiff
path: root/checkVersions
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2017-06-29 08:38:41 +0200
committerErich Eckner <git@eckner.net>2017-06-29 08:38:41 +0200
commitb8ea0b831aa6f655164a00471d32a499d91385eb (patch)
tree5209aad6e32a49b907f71b29c1759b9150d486e8 /checkVersions
parent0099beacd28fe68c15f31292cd3652f6e740ea9b (diff)
downloadarchlinuxewe.git.save-b8ea0b831aa6f655164a00471d32a499d91385eb.tar.xz
checkVersions: cleanup curl mess
Diffstat (limited to 'checkVersions')
-rwxr-xr-xcheckVersions60
1 files changed, 36 insertions, 24 deletions
diff --git a/checkVersions b/checkVersions
index 62a65905..2fc4528c 100755
--- a/checkVersions
+++ b/checkVersions
@@ -9,6 +9,18 @@ usage() {
exit 1
}
+curl_it() {
+ if ping -c1 -W5 "$(
+ echo "$1" | \
+ sed '
+ s|^[^/]\+://||
+ s|/.*$||
+ '
+ )" > /dev/null 2>&1; then
+ curl -sS "$1"
+ fi
+}
+
me="$(readlink -f $0)"
cd $(dirname "${me}")
versionenDatei="/var/cache/$(basename "$(dirname "${me}")").lastVersions"
@@ -101,14 +113,14 @@ then
if [ "${pkgname}" == "adduser" ]
then
remVer="$(
- wget -O - "${source[0]}" 2> /dev/null | \
+ curl_it "${source[0]}" | \
grep '^# Version: ' | \
sed 's|^# Version: \+||'
)"
elif [ "${pkgname}" == "dropbox" ]
then
remVer="$(
- curl 'https://www.dropboxforum.com/t5/Desktop-client-builds/bd-p/101003016' 2> /dev/null | \
+ curl_it 'https://www.dropboxforum.com/t5/Desktop-client-builds/bd-p/101003016' | \
tr '<>' '\n' | \
grep '^Stable Build [0-9.-]\+$' | \
sed 's|^Stable Build \([0-9.-]\+\)$|\1|' | \
@@ -121,7 +133,7 @@ then
elif [ "${pkgname}" == "pgplot-for-ifeffit" ]
then
remVer="$(
- curl "ftp://ftp.astro.caltech.edu/pub/pgplot/" 2> /dev/null | \
+ curl_it "ftp://ftp.astro.caltech.edu/pub/pgplot/" | \
grep "\spgplot[0-9.]\+\.tar\.gz -> \S\+\$" | \
sed "s|^.*\spgplot\([0-9.]\+\)\.tar\.gz -> \S\+\$|\1|" | \
sort -V | \
@@ -135,7 +147,7 @@ then
then
quVer="${src%/*}/"
remVer="$(
- curl "${quVer}" 2> /dev/null | \
+ curl_it "${quVer}" | \
tr '<>' '\n' | \
grep "^${pkgname#netkit-}-[0-9.-]\+\.tar\.gz\$" | \
sed "s|^${pkgname#netkit-}-\([0-9.-]\+\)\.tar\.gz\$|\1|" | \
@@ -159,14 +171,14 @@ then
sed 's|/[^/]\+/[^/]\+$||'
)"
remVer="$(
- curl "${quVer}/LATEST.TXT" 2> /dev/null
+ curl_it "${quVer}/LATEST.TXT"
)"
elif echo "${src}" | \
grep -q "//www\.mpich\.org/"
then
quVer="${src%/*/*}/"
aVers="$(
- curl "${quVer}" 2> /dev/null | \
+ curl_it "${quVer}" | \
tr '"' '\n' | \
grep '^[0-9.]\+/$' | \
sed 's|/$||'
@@ -207,7 +219,7 @@ then
sed 's|^\(.*\)/packages/.*/\([^/]\+\)-[^/-]\+\.tar\.gz$|\1/pypi/\2/|'
)"
remVer="$(
- curl "${qu}" 2> /dev/null | \
+ curl_it "${qu}" | \
tr "\"" "\n" | \
grep "^/pypi/\(python-\)\?${pkgname#*-}/[0-9.-]\+\$" | \
sed "s|^/pypi/\(python-\)\?${pkgname#*-}/\([0-9.-]\+\)\$|\2|" | \
@@ -215,7 +227,7 @@ then
tail -n1
)"
remHash="$(
- curl "${qu}${remVer}" 2> /dev/null | \
+ curl_it "${qu}${remVer}" | \
tr '"#' '\n' | \
grep -m1 "^https://pypi\.python\.org/packages/.*/[0-9a-f]\{60\}/${pkgname#*-}-${remVer}\.tar\.\(gz\|bz2\|xz\)\$" | \
sed 's|/[^/]\+$|/|; s|^https://pypi\.python\.org/packages/|/|'
@@ -235,7 +247,7 @@ then
sed 's|^\(https\?://\([^/]\+/\)\{3\}\).*$|\1|'
)"
remVer="$(
- curl "${qu}" 2> /dev/null | \
+ curl_it "${qu}" | \
tr "\"" "\n" | \
grep '^[0-9.]\+/$' | \
sed 's|/$||' | \
@@ -249,10 +261,10 @@ then
qu=${qu%-*}
quNam=${qu#*=}
remVer=$( \
- curl "$(\
+ curl_it "$(\
echo "${qu}" | \
sed "s|\?dl=|?ls=|" \
- )" 2> /dev/null | \
+ )" | \
tr "<>" "\n\n" | \
grep "^${quNam}-" | \
sed "s|^${quNam}-||" | \
@@ -287,7 +299,7 @@ then
post=''
fi
remVer=$( \
- curl "${quVer}" 2> /dev/null | \
+ curl_it "${quVer}" | \
tr "\"" "\n" | \
grep "^${quNam}-v\?[0-9.-]*\.${quEnd}\$" | \
sed "s|^${quNam}-v\?\([0-9.-]*\)\.${quEnd}\$|\1|" | \
@@ -310,7 +322,7 @@ then
sed "s|v\?[0-9.]\+.*\$||" \
)
tmpVer=$( \
- curl "${quVer}" 2> /dev/null | \
+ curl_it "${quVer}" | \
awk '{print $9}' | \
grep "^${quNam}v\?[0-9.]*${quEnd}\$" | \
sed "s|^${quNam}v\?\([0-9.]*\)${quEnd}\$|\1|" | \
@@ -330,7 +342,7 @@ then
quEnd=${src##*-}
quEnd=${quEnd#*.}
remVer=$( \
- curl "${quVer}/" 2> /dev/null | \
+ curl_it "${quVer}/" | \
tr "\"" "\n" | \
grep "^${quNam}\(-[^-]*\)\{3\}\.${quEnd}\$" | \
sed "s|^${quNam}-\([^-]*\)\(-[^-]*\)\{2\}\.${quEnd}\$|\1|" | \
@@ -347,7 +359,7 @@ then
)
quNam=/${quVer#*.com/}/tag/
remVer=$( \
- curl "${quVer}" 2> /dev/null | \
+ curl_it "${quVer}" | \
tr "\"" "\n" | \
tr '[[:upper:]]' '[[:lower:]]' | \
grep "^${quNam}v\?[0-9.]\+\$" | \
@@ -375,7 +387,7 @@ then
sed 's|^http:|https:|'
)
remVer=$( \
- curl "${quVer}" 2> /dev/null | \
+ curl_it "${quVer}" | \
tr "\"" "\n" | \
grep "^${quVer#*sourceforge.net}\(${pkgname}\(-\|%20\)\)\?[0-9.-]" | \
sed "s@/${pkgname}\(-\|%20\)@/@" | \
@@ -392,7 +404,7 @@ then
quNam="${quNam%%.*}"
quNam="$(echo "${quNam}" | tr '[:lower:]' '[:upper:]')"
remVer=$( \
- curl "${quVer}" 2> /dev/null | \
+ curl_it "${quVer}" | \
tr '"' '\n' | \
grep "^${quNam}\.[.0-9]\+/\$" | \
sed "s|^${quNam}\.\(.*\)/\$|\1|" | \
@@ -424,7 +436,7 @@ then
sed 's|\.|\\.|g'
)"
remVer="$(
- curl "${src%/get/*}/downloads/?tab=tags" 2> /dev/null | \
+ curl_it "${src%/get/*}/downloads/?tab=tags" | \
tr '"' '\n' | \
grep "${srcEndg}\$" | \
sed "s|^.*/${srcPreNam}\(.*\)${srcEndg}\$|\1|" | \
@@ -451,7 +463,7 @@ then
then
quVer="${src%/*}/"
remVer="$( \
- curl "${quVer}" 2> /dev/null | \
+ curl_it "${quVer}" | \
tr '"<>' '\n\n\n' | \
grep "^${pkgname}\(-src\)\?-\?[0-9._]\+\.t\(ar\(\.[gx]z\|\.bz2\)\?\|gz\)\$" | \
sed "s@^${pkgname}\(-src\)\?-\?\([0-9._]\+\)\.t\(ar\(\.[gx]z\|\.bz2\)\?\|gz\)\$@\2@" | \
@@ -468,7 +480,7 @@ then
sed 's|^\(http://\)|\1www.|'
)"
for mainVer in $(
- curl "${remVerz}" 2> /dev/null | \
+ curl_it "${remVerz}" | \
tr ' >' '\n' | \
grep '^href="v[0-9.]\+/"$' | \
sed 's|href="v\([0-9.]\+\)/"$|\1|' | \
@@ -476,7 +488,7 @@ then
)
do
remVer="$(
- curl "${remVerz}v${mainVer}/" 2> /dev/null | \
+ curl_it "${remVerz}v${mainVer}/" | \
tr ' >' '\n' | \
grep '^href="ParaView-v[0-9.]\+\.tar\.gz"$' | \
sed 's|^href="ParaView-v\([0-9.]\+\)\.tar\.gz"$|\1|' | \
@@ -493,7 +505,7 @@ then
sed 's|[^/]\+/[^/]\+$||'
)"
for mainVer in $(
- curl "${remVerz}" 2> /dev/null | \
+ curl_it "${remVerz}" | \
tr '"' '\n' | \
grep '^v[0-9.]\+/$' | \
sed 's|^v\([0-9.]\+\)/$|\1|' | \
@@ -501,7 +513,7 @@ then
)
do
remVer="$(
- curl "${remVerz}v${mainVer}/" 2> /dev/null | \
+ curl_it "${remVerz}v${mainVer}/" | \
tr '"' '\n' | \
grep '^lilypond-[0-9.]\+\.tar\.\(gz\|bz2\|xz\)$' | \
sed 's@^lilypond-\([0-9.]\+\)\.tar\.\(gz\|bz2\|xz\)$@\1@' | \
@@ -518,7 +530,7 @@ then
sed 's|-r[0-9]\+\.zip$|.html|'
)"
remVer="r$(
- curl "${remUrl}" 2> /dev/null | \
+ curl_it "${remUrl}" | \
grep '"text: current()\.version"' | \
tr '<>' '\n' |
grep '^[0-9]\+$' | \