#!/bin/bash
usage() {
>&2 echo 'Verwendung: '
>&2 echo " $0"' [--32] [-f|--force] [-j|--jobs=${jobs}]'
>&2 echo ' --32: Versionen in archlinux32 statt archlinuxewe prüfen'
>&2 echo ' -f|--force|--noUpdate: prüfe Versionen unhabhängig von Zeit der letzten Prüfung'
>&2 echo ' -j|--jobs: Anzahl parallel auszufuehrender Anfragen'
>&2 echo ' -m: maschinenlesbare Ausgabe erzeugen'
exit 1
}
curl_it() {
local source="$1"
local cache_file
cache_file=$(
{
printf '%s\n' "$1"
printf '%s\n' "$@" | \
sort -u
} | \
sha512sum | \
awk '{print $1}'
)
shift
cache_file="${curl_cache}/${cache_file}"
if [ -s "${cache_file}" ] && \
[ $(stat -c%Y "${cache_file}") -gt $(($(date +%s)-300)) ] &&
! grep -qiF 'access denied' "${cache_file}"; then
cat "${cache_file}"
return
fi
tmp_file=$(mktemp)
curl --compressed -o "${tmp_file}" --connect-timeout 10 -s -x socks5://127.0.0.1:9050 "$@" "${source}"
if grep -qiF "$(
printf '%s\n' \
'access denied' \
'Repository seems to be empty'
)" "${tmp_file}"; then
: >"${tmp_file}"
fi
if [ ! -s "${tmp_file}" ]; then
curl --compressed -o "${tmp_file}" --connect-timeout 10 -s "$@" "${source}"
fi
cat "${tmp_file}"
local trials
if grep -qiF "$(
printf '%s\n' \
'access denied' \
'Repository seems to be empty'
)" "${tmp_file}"; then
trials=-1
else
trials=5
while [ ${trials} -gt 0 ] && \
! mv "${tmp_file}" "${cache_file}"; do
sleep 1
trials=$((trials-1))
done
fi
if [ ${trials} -le 0 ]; then
rm -f "${tmp_file}"
fi
}
me="$(readlink -f $0)"
cd $(dirname "${me}")
versionenDatei="/var/cache/$(basename "$(dirname "${me}")")/lastVersions"
curl_cache="/var/cache/$(basename "$(dirname "${me}")")/curl-cache"
jobs=50
maschinenlesbar=false
force=false
unForce=false
archlinuxewe=true
eval set -- "$(
getopt \
-o fj:m \
--long 32 \
--long force \
--long jobs: \
--long noUpdate \
-n "$(basename "$0")" \
-- \
"$@" \
|| echo "usage"
)"
args=("$@")
optArgs=()
while true
do
case $1 in
--32)
archlinuxewe=false
versionenDatei="/var/cache/$(basename "$(dirname "${me}")")/lastVersions32"
optArgs[${#optArgs[@]}]="--32"
;;
-f|--force)
force=true
optArgs[${#optArgs[@]}]="-f"
;;
--noUpdate)
unForce=true
optArgs[${#optArgs[@]}]="--noUpdate"
;;
-j|--jobs)
shift
jobs="$1"
optArgs[${#optArgs[@]}]="-j"
optArgs[${#optArgs[@]}]="$1"
;;
-m)
optArgs[${#optArgs[@]}]="-m"
maschinenlesbar=true
;;
--)
shift
break
;;
*)
>&2 echo "FEHLER: Verstehe Option \"$1\" doch nicht! Ich beende."
rm -rf "${tmpDir}"
usage
esac
shift
done
[ ! -r "${versionenDatei}" ] && force=true
versionenErmitteln=${force}
! ${versionenErmitteln} && [ "$(head -n1 "${versionenDatei}")" -le $[$(date "+%s")-300] ] && versionenErmitteln=true
${maschinenlesbar} && versionenErmitteln=true
${unForce} && versionenErmitteln=false
versionenSchreiben=${versionenErmitteln}
[ ! -w "${versionenDatei}" ] && versionenSchreiben=false
${maschinenlesbar} && versionenSchreiben=false
if [ $# -eq 0 ]
then
if ${versionenSchreiben}
then
tmpFile="$(mktemp /tmp/versionen.XXXXXX)"
date "+%s" > "${tmpFile}"
set -o pipefail
if ${archlinuxewe}; then
${me} "${args[@]}" $(echo */PKGBUILD | tr " " "\n" | sed "s|/PKGBUILD||") | tee -a "${tmpFile}"
err=$?
else
if ! mountpoint -q /mnt/archlinux32; then
mount /mnt/archlinux32
fi
/usr/src/archlinux32/devops/watch-versions | sed 's/$/ (arch32)/' | tee -a "${tmpFile}"
${me} "${args[@]}" $(echo */PKGBUILD | tr " " "\n" | sed "s|/PKGBUILD||" | grep '32$') | tee -a "${tmpFile}"
err=$?
fi
set +o pipefail
cat "${tmpFile}" > "${versionenDatei}"
rm "${tmpFile}"
elif ! ${versionenErmitteln}
then
sed '1d' "${versionenDatei}"
err=$?
elif ${archlinuxewe}; then
${me} "${args[@]}" $(echo */PKGBUILD | tr " " "\n" | sed "s|/PKGBUILD||")
err=$?
else
/usr/src/archlinux32/devops/watch-versions | sed 's/$/ (arch32)/'
${me} "${args[@]}" $(echo */PKGBUILD | tr " " "\n" | sed "s|/PKGBUILD||" | grep '32$')
err=$?
fi
exit ${err}
elif [ $# -eq 1 ] && ${versionenErmitteln}
then
unset pkgbase
unset pkgname
unset pkgver
if ${archlinuxewe}; then
. $1/PKGBUILD
srcKnown=false
else
eval "$(
grep '^pkg\(base\|name\|ver\)=' $1/PKGBUILD
)"
source=(dummy)
fi
if [ -n "${pkgbase}" ]; then
pkgname="${pkgbase}"
fi
for src in "${source[@]}" "${source_i686[@]}" "${source_x86_64[@]}"
do
if ! ${archlinuxewe}; then
remVer=$(
find '/mnt/archlinux32' -regextype sed \
-type f \
-regex '.*/'"${1%32}"'-[^-]\+-[^-]\+-any\.pkg\.tar\.xz' \
-printf '%f\n' | \
sed '
s/-[^-]\+-[^-]\+$//
s/^.*-//
' | \
sort -V | \
tail -n1
)
srcKnown=true
continue
fi
src_name="${src%%::*}"
src="${src#*::}"
if echo "${src}" | \
grep '^https://archive-server\.archlinux32\.org/' |
grep '[&?]t=git' | \
grep '[&?]r=' | \
grep -q '[&?]tag='; then
remDir=$(
printf '%s\n' "${src}" \
| sed 's,^.*[?&]r=\([^&]\+\)\(\&.*\)\?$,\1,' \
| sed 's/%3D/=/g'
)
remTag=$(
printf '%s\n' "${src}" \
| sed 's,^.*[?&]tag=\([^&]\+\)\(\&.*\)\?$,\1,' \
| sed 's/%3D/=/g'
)
remVer=$(
git -C "/usr/src/skripte/archive-server/work/repositories/git/${remDir}" tag \
| sed '
s/^[^0-9.*]*'"$(
printf '%s\n' "$remTag" \
| sed 's/[0-9.]\+$/\\([0-9.]\\+\\)/'
)"'$/\1/
t
d
' \
| sort -V \
| tail -n1
)
elif [ "${pkgname}" = 'local-certificates' ]; then
remVer=$(
curl_it 'https://eckner.net/certs/sha512sums' \
| sed '
s/^\S\+ \([0-9]\{4\}\)-\([0-9]\{2\}\)-\([0-9]\{2\}\)T\([0-9]\{2\}\):\([0-9]\{2\}\):\([0-9]\{2\}\)\.\S\+$/\1.\2.\3.\4.\5.\6/
t
d
' \
| sort \
| tail -n1
)
elif [ "${pkgbase}" = 'bareos' ]; then
remVer=$(
curl_it 'https://github.com/bareos/bareos/releases' \
| sed '
s,^.* href="/bareos/bareos/archive/Release/\([0-9.]\+\)\.tar\.gz"\( [^>]*\)\?>.*$,\1,
t
d
' \
| head -n1
)
elif [ "${pkgname}" = 'python2-courier-pythonfilter' ]
then
remVer=$(
curl_it 'https://bitbucket.org/gordonmessmer/courier-pythonfilter/downloads/?tab=tags' \
| tr '"' '\n' \
| sed '
s,^/gordonmessmer/courier-pythonfilter/get/release-\([-0-9]\+\)\.tar\.gz$,\1,
t
d
' \
| tr '-' '.' \
| sort -V \
| tail -n1
)
elif [ "${pkgname}" = 'pacman-static' ]
then
git submodule update "${pkgname}"
eval "$(
sed -n '
s/^pkgver=/remVer=/
T
p
' "${pkgname}/PKGBUILD"
)"
elif echo "${src}" | \
grep -qF '/ssacli-'; then
centosVer=$(
curl_it "${src%/*/*/*/*}/" | \
tr '"' '\n' | \
sed '
s,^\([0-9]\+\)/$,\1,
t
d
' | \
sort -V | \
tail -n1
)
remVer=$(
curl_it "${src%/*/*/*/*}/${centosVer}/x86_64/current/" | \
tr '"' '\n' | \
sed '
s,^ssacli-\([0-9.]\+\)-\([0-9.]\+\)\.x86_64\.rpm$,\1_\2,
t
d
' | \
sort -V | \
tail -n1
)
elif [ "${pkgname}" = 'adduser' ]
then
remVer=$(
curl_it "${source[0]#*::}" '-L' | \
grep '^# Version: ' | \
sed 's|^# Version: \+||'
)
elif [ "${pkgname}" = 'dropbox' ]
then
remVer=$(
curl_it 'https://www.dropboxforum.com/t5/Desktop-client-builds/bd-p/101003016' | \
tr '<>' '\n' | \
sed '
s/^\s*Stable Build \([0-9.-]\+\)\s*$/\1/
t
d
' | \
sort -V | \
tail -n1
)
elif [ "${pkgname}" = 'tightvnc' ]
then
remVer=$(
curl_it 'https://www.tightvnc.com/download-old.php' | \
tr '"' '\n' | \
grep -x 'https://www\.tightvnc\.com/download/\([0-9.]\+\)/tightvnc-\1_unixsrc\.tar\.bz2' | \
sed 's|^https://www\.tightvnc\.com/download/\([0-9.]\+\)/tightvnc-\1_unixsrc\.tar\.bz2$|\1|'
)
elif [ "${pkgname}" = 'g95' ]
then
remVer='0.94'
elif [ "${pkgname}" = 'pgplot-for-ifeffit' ]
then
remVer=$(
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 | \
tail -n1
)
elif [ "${pkgname}" == "wurzel-old" ]
then
remVer="0.1"
elif echo "${src}" | \
grep -q '^http://ftp.linux.org.uk/.*/netkit/'
then
quVer="${src%/*}/"
remVer="$(
curl_it "${quVer}" | \
tr '<>' '\n' | \
grep "^${pkgname#netkit-}-[0-9.-]\+\.tar\.gz\$" | \
sed "s|^${pkgname#netkit-}-\([0-9.-]\+\)\.tar\.gz\$|\1|" | \
sort -V | \
tail -n1
)"
elif [ "${pkgname}" == "archiso32" ] || [ "${pkgname}" == 'archiso-dual' ]
then
git -C /usr/src/archlinux/archiso fetch upstream
git -C /usr/src/archlinux32/archiso32 fetch origin
remVer="$(
{
git -C /usr/src/archlinux/archiso tag
git -C /usr/src/archlinux32/archiso32 tag
} | \
sed -n '
s/^\(i686-\|dual-\)v//
T
p
' | \
sort -V | \
tail -n1
)"
elif [ "${pkgname}" == 'devtools32' ]
then
git -C /usr/src/archlinux/devtools fetch upstream
git -C /usr/src/archlinux32/devtools32 fetch origin
remVer="$(
(
git -C /usr/src/archlinux/devtools archive --format=tar upstream/master -- Makefile | \
tar -Ox | \
grep -m1 '^V=[0-9.]\+$' | \
cut -d= -f2
git -C /usr/src/archlinux32/devtools32 tag | \
sed -n '
s/^v//
/^[0-9.]\+$/p
'
) | \
sort -V | \
tail -n1
)"
elif [ "${pkgname}" == 'pacman-mirrorlist32' ]
then
git -C "/usr/src/archlinux32/packages" fetch origin >/dev/null 2>&1
remVer=$(
{
git -C "/usr/src/archlinux32/packages" archive origin/master -- core/pacman-mirrorlist/PKGBUILD | \
tar -Ox | \
grep -m1 '^pkgver=[0-9.]\+$' | \
cut -d= -f2
} | \
sort -V | \
tail -n1
)
elif echo "${src}" | \
grep -q '//www\.abisource\.com/'
then
quVer="$(
echo "${src}" | \
sed 's|\(/[^/]\+\)\{3\}$|/|'
)"
remVer="$(
curl_it "${quVer}" | \
tr '<>' '\n' | \
sed -n '
s,^a href="\([0-9.]\+\)/"$,\1,
T
p
' | \
sort -V | \
tail -n1
)"
elif echo "${src}" | \
grep -q '//download\.virtualbox\.org/'
then
quVer="$(
echo "${src}" | \
sed 's|/[^/]\+/[^/]\+$||'
)"
remVer="$(
curl_it "${quVer}/" | \
sed -n '
s,^.*.*$,\1,
T
p
' | \
sort -V | \
tail -n1
)"
elif echo "${src}" | \
grep -q "//www\.mpich\.org/"
then
quVer="${src%/*/*}/"
aVers="$(
curl_it "${quVer}" | \
tr '"' '\n' | \
grep '^[0-9.]\+/$' | \
sed 's|/$||'
)"
if [ ! "${pkgname}" == "mpich" ]
then
aVers="$(
(
echo "${aVers}"
echo "${pkgname#mpich} %%%SCHNIPP%%%"
) |
sort -V | \
sed '/%%%SCHNIPP%%%/q' | \
grep -v '%%%SCHNIPP%%%'
)"
fi
remVer="$(
echo "${aVers}" | \
sort -V | \
tail -n1
)"
elif echo "${src}" | \
grep -q '^git://anonscm\.debian\.org/\|^git\(+https\?\)\?://git\(hub\.com\|\.archlinux32\.org\)/.*#tag='
then
src="${src#git+}"
src="${src%#*}"
remVer=$(
{
git ls-remote --tags "${src}" 2>/dev/null || \
git ls-remote --tags "${src//git.archlinux32.org\/archlinux32\//git2.archlinux32.org/archlinux32/}" 2>/dev/null
} | \
awk '{print $2}' | \
sed '
s|^refs/tags/'"$(
if ! echo "${src}" | \
grep -qF archlinux32; then
printf 'v'
fi
)"'\([0-9.]\+\)$|\1|
t
d
' | \
sort -V | \
tail -n1
)
elif echo "${src}" | \
grep -q '^git\(+[^:]\+\)\?://[^#]\+\(#commit=[^#]\+\)\?$'
then
remVer=$(
cd "$1"
makepkg --verifysource >/dev/null 2>&1
git -C "${src_name}" fetch --all -p >/dev/null 2>&1
_commit='HEAD'
srcdir=$(pwd)
pkgver
)
elif echo "${src}" | \
grep -q '^svn\(+[^:]\+\)\?://[^#]\+\(#revision=[^#]\+\)\?$'
then
remVer=$(
cd "$1"
makepkg --verifysource >/dev/null 2>&1
(
cd "${src_name}"
svn update >/dev/null
)
srcdir=$(pwd)
pkgver
)
elif echo "${src}" | \
grep -q "^https://pypi\.python\.org/packages/"
then
qu=$(
echo "${src}" | \
sed 's|^.*/packages/.*/\([^/]\+\)-[^/-]\+\.tar\.gz$|https://pypi.org/project/\1/|'
)
_pkgname=$(
echo "${qu}" | \
sed '
s|/$||
s|^.*/||
'
)
remVer="$(
curl_it "${qu}" | \
tr '"' '\n' | \
grep "^/project/\(python-\)\?${_pkgname}/[0-9.-]\+/\$" | \
sed "s|^/project/\(python-\)\?${_pkgname}/\([0-9.-]\+\)/\$|\2|" | \
sort -V | \
tail -n1
)"
remHash="$(
curl_it "${qu}${remVer}/" | \
tr '"#' '\n' | \
sponge | \
grep -m1 "^https://files\.pythonhosted\.org/packages/.*/[0-9a-f]\{60\}/${_pkgname}-${remVer}\.tar\.\(gz\|bz2\|xz\)\$" | \
sed 's|/[^/]\+$|/|; s|^https://files\.pythonhosted\.org/packages/|/|'
)"
locHash="$(
echo "${src}" | \
sed 's|/[^/]\+$|/|; s|^https://pypi\.python\.org/packages/|/|'
)"
${maschinenlesbar} && \
[ "${remHash}" != "${locHash}" ] && \
echo "sed_extra='s@${locHash}@${remHash}@g;'"
elif echo "${src}" | \
grep -q "//bundles\.openttdcoop\.org/"
then
qu="$(
echo "${src}" | \
sed 's|^\(https\?://\([^/]\+/\)\{3\}\).*$|\1|'
)"
remVer="$(
curl_it "${qu}" | \
tr "\"" "\n" | \
grep '^[0-9.]\+/$' | \
sed 's|/$||' | \
sort -V | \
tail -n1
)"
elif echo "${src}" | \
grep -q "//git\.eckner\.net/"
then
quVer="${src%/*/*}"
quNam=$(
printf '%s\n' "${src}" | \
sed '
s,^.*/,,
s,-[0-9.]\+\.tar\.xz$,,
'
)
remVer=$( \
curl_it "${quVer}" | \
tr "<>'\"" '\n' | \
sed -n '
s,^/'"${quVer#*//*/}"'/snapshot/'"${quNam}"'-\([0-9.]\+\)\.tar\.xz$,\1,
T
p
' | \
sort -V | \
tail -n1
)
elif echo "${src}" | \
grep -q "//\(search\.m\?\)\?cpan\.org/\|//cpan\.metacpan\.org/authors/\|cpan\.org/modules/by-module/"
then
quVer=$( \
echo "${src%/*}/" | \
sed 's|//\(search\.m\?\)\?cpan\.org/|//www.cpan.org/|' | \
sed 's|/CPAN/|/|'
)
quNam=${src##*/}
quNam=${quNam%-*}
quEnd=$( \
echo "${src##*-}" | \
sed "s|^v\?[0-9.]*||" | \
sed 's|\.|\\\.|'
)
if [ "${pkgname}" = 'perl-chi' ] || \
[ "${pkgname}" = 'perl-perl-metrics-simple' ]
then
pre='s|\(\...\)$|\10|'
post='s|\(\...\)0$|\1|'
elif [ "${pkgname}" = 'perl-opengl' ] || \
[ "${pkgname}" = 'perl-array-diff' ] || \
[ "${pkgname}" = 'perl-module-cpants-analyse' ] || \
[ "${pkgname}" = 'perl-data-clean' ]
then
pre='s|\(\...\)\(.\)|\1.\2|'
post='s|\(\...\)\.\(.\)|\1\2|'
else
pre=''
post=''
fi
remVer=$( \
curl_it "${quVer}" | \
tr '"<>' '\n' | \
grep "^${quNam}-v\?[0-9.-]*\.${quEnd}\$" | \
sed "s|^${quNam}-v\?\([0-9.-]*\)\.${quEnd}\$|\1|" | \
sed "${pre}" | \
sort -V | \
tail -n1 | \
sed "${post}"
)
elif echo "${src}" | \
grep -q "ftp://"
then
quVer="${src%/*}/"
quNam=${src##*/}
quEnd=$( \
echo "${quNam}" |
sed "s|^.*v\?[0-9.]*[0-9]||" \
)
quNam=$( \
echo ${quNam} | \
sed "s|v\?[0-9.]\+.*\$||" \
)
tmpVer=$( \
curl_it "${quVer}" | \
awk '{print $9}' | \
grep "^${quNam}v\?[0-9.]*${quEnd}\$" | \
sed "s|^${quNam}v\?\([0-9.]*\)${quEnd}\$|\1|" | \
sort -V | \
tail -n1 \
)
[ "${pkgname}" == "pgplot" ] \
&& [ -n "${tmpVer}" ] \
&& remVer="${tmpVer:0:1}.${tmpVer:1:1}.${tmpVer:2}" \
|| remVer="${tmpVer}"
elif echo "${src}" | \
grep -q '//arch\.eckner\.net/\|//mirror\.archlinux32\.org/'
then
quVer="${src%/*}"
quVer="${quVer#*::}"
quNam=${src##*/}
quNam=${quNam%-*}
quNam=${quNam%-*}
quNam=${quNam%-*}
quEnd=${src##*-}
quEnd=${quEnd#*.}
remVer=$( \
curl_it "${quVer}/" | \
tr "\"" "\n" | \
grep "^${quNam}\(-[^-]*\)\{3\}\.${quEnd}\$" | \
sed "s|^${quNam}-\([^-]*\)\(-[^-]*\)\{2\}\.${quEnd}\$|\1|" | \
sort -V | \
tail -n1 \
)
elif echo "${src}" | \
grep -q '^https\?://github\.com/'
then
quVer=$(
echo "${src#*::}" | \
sed '
s|/archive/\(Release/\)\?[^/]*$|/releases|
s|/download/[^/]*/[^/]*$||
s|http:|https:|
'
)
quNam=$(
echo "/${quVer#*.com/}/tag/" | \
tr '[[:upper:]]' '[[:lower:]]'
)
remVer=$( \
curl_it "${quVer}" | \
tr "\"" "\n" | \
tr '[[:upper:]]' '[[:lower:]]' | \
grep "^${quNam}\(v\|release%2f\|\)[0-9.]\+\$" | \
sed "s@^${quNam}\(v\|release%2f\|\)@@" | \
(
if [ "${pkgname}" == "conky-irc" ]
then
grep -v '\.999$'
else
cat
fi
) | \
sort -V | \
tail -n1 \
)
elif echo "${src}" | \
grep -q "//\(\(pr\)\?downloads\.\)\?sourceforge\.net/"
then
quVer=$( \
echo "${src}" | \
sed '
s,^https\?://\(\(pr\)\?downloads\.\)\?sourceforge\.net/,,
s,^sourceforge/,,
s,^projects\?/,,
' | \
sed '
s,^\([^/]\+\)/[^/]\+$,\1/files/\1,
t end
s,^\([^/]\+\)/\(files/\)\?\([^/]\+\)/[0-9.]\+/[^/]\+$,\1/files/\3,
t end
s,^\([^/]\+\)/\(files/\)\?branch_[0-9.]\+/[^/]\+$,\1/files,
t end
w /dev/stderr
d
:end
s,/scidavis$,/SciDAVis,
s,^.*$,https://sourceforge.net/projects/\0/,
'
)
remVer=$( \
curl_it "${quVer}" | \
sed -n '
\@]* href="[^"<>]*/latest/download"@,\@@ {
s@^.*\(\('"${pkgname}"'\|'"${_pkgname}"'\)\([-.]\|%20\)\)\?\([0-9.]\+\)\(\.tar\.\([xg]z\|bz2\)\|\.zip\|-win-dist\.msi\)\( [^<>]*\)\?.*$@\4@
T
p
}
s@^.*"'"${quVer#*sourceforge.net}"'\('"${pkgname}"'\([-.]\|%20\)\)\?\([0-9.-]\+[^"/%]*\)["/%].*$@\3@
T
p
' | \
sed '
s/-$//
s/\.$//
' | \
sort -V | \
tail -n1
)
elif echo "${src}" | \
grep -q '//support\.hdfgroup\.org/'
then
quVer="${src%/*/*/*}/"
quNam="${src#${quVer}}"
quNam="${quNam%%.*}"
quNam="$(echo "${quNam}" | tr '[:lower:]' '[:upper:]')"
remVer=$( \
curl_it "${quVer}" | \
tr '"' '\n' | \
grep "^${quNam}\.[.0-9]\+/\$" | \
sed "s|^${quNam}\.\(.*\)/\$|\1|" | \
sort -V | \
tail -n1 \
)
elif echo "${src}" | \
grep -q 'https://bitbucket\.org/.*/get/[^/]\+$'
then
srcPreNam="$(
echo "${src}" | \
sed 's|^.*/\([^/0-9]\+_\)[0-9][^/]\+$|\1|'
)"
srcEndg="$(
echo "${src}" | \
sed 's|^.*\(\.tar[^/]*\)$|\1|' | \
sed 's|\.|\\.|g'
)"
remVer="$(
curl_it "${src%/get/*}/downloads/?tab=tags" | \
tr '"' '\n' | \
grep "${srcEndg}\$" | \
sed "s|^.*/${srcPreNam}\(.*\)${srcEndg}\$|\1|" | \
tr '_' '.' | \
sort -V | \
tail -n1
)"
elif echo "${src}" | \
grep -q '^https\?://lilypond\.org/'
then
quVer="${src%/*}/"
remVer="$( \
curl_it "${quVer}" | \
tr '"<>' '\n\n\n' | \
grep "^lilypond-[0-9.]\+\(-[0-9]\+\.documentation\)\?\.t\(ar\(\.[gx]z\|\.bz2\)\?\|gz\)\$" | \
sed "s@^lilypond-\([0-9.]\+\)\(-[0-9]\+\.documentation\)\?\.t\(ar\(\.[gx]z\|\.bz2\)\?\|gz\)\$@\1@" | \
tr '_' '.' | \
sort -V | \
tail -n1
)"
elif echo "${src}" | \
grep -qF '//www.cybernoia.de/'; then
quVer="${src%/*}.html"
remVer=$(
curl_it "${quVer}" | \
tr '<>' '\n' | \
sed -n '
s,^a href="'"${pkgname}/${pkgname}"'-\([0-9.]\+\)\.tar\.gz"$,\1,
T
p
'
)
elif echo "${src}" | \
grep -q "$(
printf '^https\\?://%s/\|' \
'alpine\.freeiz\.com' \
'bitbucket\.org' \
'bindfs\.org' \
'dl\.suckless\.org' \
'download\.osgeo\.org' \
'ftp\.daper\.net' \
'isl\.gforge\.inria\.fr' \
'people\.gnome\.org' \
'pkgbuild\.com' \
'qgis\.org' \
'sources\.archlinux32\.org' \
'webhome\.phy\.duke\.edu' \
'www\.dragonsdawn\.net' \
'www\.gaia-gis\.it' \
'www\.hashcash\.org' \
'www\.iozone\.org' \
'www\.tana\.it' \
'www\.vandenoever\.info' \
'www\.wurzel\.org' \
'www.xcrysden.org' \
| sed 's@\\|$@\n@'
)"
then
for _pkgname in "${provides[@]}"; do
if [ "${pkgname#${_pkgname%=*}}" != "${pkgname}" ]; then
pkgname="${_pkgname%=*}"
break
fi
done
quVer="${src%/*}/"
remVer="$( \
curl_it "${quVer}" | \
tr '"<>' '\n\n\n' | \
grep "^${pkgname#python2-}\(-src\)\?-\?v\?[0-9._]\+[a-z]\?\.t\(ar\(\.[gx]z\|\.bz2\)\?\|gz\)\$" | \
sed "s@^${pkgname#python2-}\(-src\)\?-\?v\?\([0-9._]\+[a-z]\?\)\.t\(ar\(\.[gx]z\|\.bz2\)\?\|gz\)\$@\2@" | \
tr '_' '.' | \
sort -V | \
tail -n1
)"
elif echo "${src}" | \
grep -q '^https\?://\(www\.\)\?paraview\.org/files/'
then
remVerz="$(
echo "${src}" | \
sed 's|/v[0-9.]\+/ParaView-v[0-9.]\+\.tar\.gz$|/|' | \
sed 's|^\(http://\)|\1www.|'
)"
for mainVer in $(
curl_it "${remVerz}" | \
tr ' >' '\n' | \
grep '^href="v[0-9.]\+/"$' | \
sed 's|href="v\([0-9.]\+\)/"$|\1|' | \
sort -Vr
)
do
remVer="$(
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|' | \
sort -V | \
tail -n1
)"
[ -n "${remVer}" ] && break
done
elif echo "${src}" | \
grep -q '^https://download\.kde\.org/stable/plasma/'
then
remVerz=$(
echo "${src}" | \
sed 's|\(/[^/]\+\)\{2\}$|/|'
)
for mainVer in $(
curl_it "${remVerz}" | \
tr '"' '\n' | \
grep '^[0-9.]\+/$' | \
sed 's|/$||' | \
sort -Vr
)
do
remVer=$(
curl_it "${remVerz}${mainVer}/" | \
tr '"' '\n' | \
grep '^oxygen-fonts-[0-9.]\+\.tar\.xz$' | \
sed 's|^oxygen-fonts-\([0-9.]\+\)\.tar\.xz$|\1|' | \
sort -V | \
tail -n1
)
[ -n "${remVer}" ] && break
done
elif echo "${src}" | \
grep -q '^https://archive\.apache\.org/'
then
remVerz="$(
echo "${src}" | \
sed 's|[^/]\+/[^/]\+$||'
)"
for mainVer in $(
curl_it "${remVerz}" | \
tr '"' '\n' | \
grep "^${pkgname#apache-}-[0-9.]\+/\$" | \
sed "s|^${pkgname#apache-}-\([0-9.]\+\)/\$|\1|" | \
sort -Vr
)
do
remVer="$(
curl_it "${remVerz}${pkgname#apache-}-${mainVer}/" | \
tr '"' '\n' | \
grep "^${pkgname#apache-}-[0-9.]\+\.t\(ar\.\)\?\(gz\|bz2\|xz\)\$" | \
sed "s@^${pkgname#apache-}-\([0-9.]\+\)\.t\(ar\.\)\?\(gz\|bz2\|xz\)\$@\1@" | \
sort -V | \
tail -n1
)"
[ -n "${remVer}" ] && break
done
elif echo "${src}" | \
grep -q "http://www\.mkgmap\.org\.uk/download"
then
remUrl="$(
echo "${src}" | \
sed 's|-r[0-9]\+\.zip$|.html|'
)"
remVer="r$(
curl_it "${remUrl}" | \
grep '"text: current()\.version"' | \
tr '<>' '\n' |
grep '^[0-9]\+$' | \
sort -n | \
tail -n1
)"
elif echo "${src}" | \
grep -q '://semiletov\.org/[^/]*/dloads/'
then
remVer=$(
curl_it "${source%%/dloads/*}/" | \
tr '"' '\n' | \
sed -n '
s,^\(http://.*/\|dloads/\|\)'"${pkgname}"'-\([0-9.]\+\)\.tar\.bz2$,\2,
T
p
'
)
elif echo "${src}" | \
grep -q '//www.roguetemple.com/'
then
remVer=$(
curl_it "${src%/*}/download.php" | \
sed '
s,^.*[^<>]\+ source code.*$,\1.\2,
t
d
'
)
elif echo "${src}" | \
grep -q '//www\.us\.apache\.org/dist/spamassassin/source/'
then
remVer=$(
curl_it 'https://spamassassin.apache.org/downloads.cgi' | \
tr '"' '\n' | \
sed '
s,^.*/Mail-SpamAssassin-\([0-9.]\+\)\.tar\.gz$,\1,
t
d
' | \
sort -V | \
tail -n1
)
elif echo "${src}" | \
grep -q '//zircon\.org\.uk/topal/'
then
remVer=$(
curl_it "${src%/*/*}/" | \
sed '
s,^.*\1.*$,\2,
t
d
' | \
sort -V | \
tail -n1
)
else
continue
fi
srcKnown=true
break
done
if ! ${srcKnown}
then
printf '%s: Unknown source:\n' "$1"
printf "'%s'\n" "${source[@]}" "${source_i686[@]}" "${source_x86_64[@]}"
exit 1
fi
if ${maschinenlesbar}
then
echo "remVer='${remVer}'"
echo "pkgver='${pkgver}'"
echo "pkgrel='${pkgrel}'"
else
if [ ! "${pkgver}" == "${remVer}" ]
then
if ! ${archlinuxewe}; then
printf '(32) '
fi
echo "$1: ${pkgname}: ${remVer} vs. ${pkgver}" | \
sed "s|^\([^:]\+\): \1:|\1:|"
fi
fi
elif ${versionenErmitteln}
then
echo "$@" | \
tr " " "\n" | \
parallel -j${jobs} "${me}" "${optArgs[@]}" {} \;
exit $?
else
for s in "$@"
do
grep "^${s}:" "${versionenDatei}"
done
fi