summaryrefslogtreecommitdiff
path: root/checkVersions
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2016-04-18 15:28:23 +0200
committerErich Eckner <git@eckner.net>2016-04-18 15:28:23 +0200
commitdaa1798475d9e393ca4c01fb64ec13fca25d751e (patch)
treea70f5bc60846b98bd151db9f2005d7124e901b29 /checkVersions
parent5c5bda96d3cd91234fb622a10582c3446ed9533b (diff)
downloadarchlinuxewe-daa1798475d9e393ca4c01fb64ec13fca25d751e.tar.xz
maschinenlesbare Ausgabe erzeugen neu in checkVersions
Diffstat (limited to 'checkVersions')
-rwxr-xr-xcheckVersions37
1 files changed, 25 insertions, 12 deletions
diff --git a/checkVersions b/checkVersions
index 15e001575..92216b1dd 100755
--- a/checkVersions
+++ b/checkVersions
@@ -1,21 +1,22 @@
#!/bin/bash
-me="$(readlink -f $0)"
-cd $(dirname "${me}")
-versionenDatei="/var/cache/$(basename "$(dirname "${me}")").lastVersions"
-jobs=0
-
usage() {
>&2 echo 'Verwendung: '
>&2 echo " $0"' [-f|--force] [-j|--jobs=${jobs}]'
>&2 echo ' -f|--force: 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
}
+me="$(readlink -f $0)"
+cd $(dirname "${me}")
+versionenDatei="/var/cache/$(basename "$(dirname "${me}")").lastVersions"
+jobs=0
+maschinenlesbar=false
[ ! -r "${versionenDatei}" ] && force=true || force=false
-eval set -- "$(getopt -o fj: --long force,jobs: -n "$(basename "$0")" -- "$@" || echo "usage")"
+eval set -- "$(getopt -o fj:m --long force,jobs: -n "$(basename "$0")" -- "$@" || echo "usage")"
args=("$@")
optArgs=()
@@ -25,13 +26,16 @@ do
-f|--force)
force=true
optArgs[${#optArgs[@]}]="-f"
- shift
;;
-j|--jobs)
shift
jobs="$1"
- optArgs[${#optArgs[@]}]="-j $1"
- shift
+ optArgs[${#optArgs[@]}]="-j"
+ optArgs[${#optArgs[@]}]="$1"
+ ;;
+ -m)
+ optArgs[${#optArgs[@]}]="-m"
+ maschinenlesbar=true
;;
--)
shift
@@ -42,12 +46,15 @@ do
rm -rf "${tmpDir}"
usage
esac
+ shift
done
versionenErmitteln=${force}
! ${versionenErmitteln} && [ $(head -n1 "${versionenDatei}") -le $[$(date "+%s")-300] ] && versionenErmitteln=true
+${maschinenlesbar} && versionenErmitteln=true
versionenSchreiben=${versionenErmitteln}
[ ! -w "${versionenDatei}" ] && versionenSchreiben=false
+${maschinenlesbar} && versionenSchreiben=false
if [ $# -eq 0 ]
then
@@ -259,10 +266,16 @@ then
exit 1
fi
- if [ ! "${pkgver}" == "${remVer}" ]
+ if ${maschinenlesbar}
then
- echo "$1: ${pkgname}: ${remVer} vs. ${pkgver}" | \
- sed "s|^\([^:]\+\): \1:|\1:|"
+ echo "remVer='${remVer}'"
+ echo "pkgver='${pkgver}'"
+ else
+ if [ ! "${pkgver}" == "${remVer}" ]
+ then
+ echo "$1: ${pkgname}: ${remVer} vs. ${pkgver}" | \
+ sed "s|^\([^:]\+\): \1:|\1:|"
+ fi
fi
elif ${versionenErmitteln}