summaryrefslogtreecommitdiff
path: root/checkAllRepos
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2017-02-15 09:57:32 +0100
committerErich Eckner <git@eckner.net>2017-02-15 09:57:32 +0100
commit00e9adf2df73a0df86fcb158fce3715f6a484f75 (patch)
tree080d9e27793ecb011ab3cff971cb153d9d40e40b /checkAllRepos
parent61250b1d6953faae25368e6099ff92bcf464aeec (diff)
downloadarchlinuxewe.git.save-00e9adf2df73a0df86fcb158fce3715f6a484f75.tar.xz
checkAllRepos verbessert
Diffstat (limited to 'checkAllRepos')
-rwxr-xr-xcheckAllRepos50
1 files changed, 31 insertions, 19 deletions
diff --git a/checkAllRepos b/checkAllRepos
index fbe7c1bd..c27d63bf 100755
--- a/checkAllRepos
+++ b/checkAllRepos
@@ -2,27 +2,35 @@
usage() {
>&2 echo 'Verwendung:'
- >&2 echo "${ich} [-d|--download URL] [-a|--alle] [-s|--suche wonach] [-i|--intensiv] [-x|--exakt]"
+ >&2 echo "${ich}"' [-d|--download URL] [-a|--alle] [-s|--suche wonach] [-i|--intensiv] [-x|--exakt] [-l|--leise]'
exit 1
}
verpackung() {
typ="$(file -bizL "$1")"
case "${typ}" in
+ "application/x-tar; charset=binary")
+ ;;
"application/x-tar; charset=binary compressed-encoding=application/x-xz; charset=binary")
echo "-J"
;;
+ "application/x-tar; charset=binary compressed-encoding=application/x-bzip2; charset=binary")
+ echo "-j"
+ ;;
"application/x-tar; charset=binary compressed-encoding=application/x-gzip; charset=binary" | \
"application/octet-stream; charset=binary compressed-encoding=application/x-gzip; charset=binary")
echo "-z"
;;
"ERROR: (null)" | \
"inode/x-empty; charset=binary")
+ return 1
;;
*)
- >&2 echo "FEHLER: Unbekannter Verpackungstyp '${typ}'"
+ ${leise} || >&2 echo "FEHLER: Unbekannter Verpackungstyp '${typ}'"
+ return 1
;;
esac
+ return 0
}
ich="$(readlink -f "$0")"
@@ -30,11 +38,12 @@ pfad="$(dirname "${ich}")/.checkAllRepos"
[ ! -d "${pfad}" ] && mkdir -p "${pfad}"
eval set -- "$(
- getopt -o ad:is:x \
+ getopt -o ad:ils:x \
--long alle \
--long download: \
--long exakt \
--long intensiv \
+ --long leise \
--long suche: \
-n "$(basename "$0")" \
-- "$@" \
@@ -46,10 +55,15 @@ unset downloads suchen
alle=false
exakt=false
intensiv=false
+leise=false
+flag_l=''
while true
do
case "$1" in
+ -a|--alle)
+ alle=true
+ ;;
-d|--download)
shift
if [ -n "$1" ]
@@ -57,15 +71,13 @@ do
downloads[${#downloads[@]}]="$1"
fi
;;
- -a|--alle)
- alle=true
- ;;
- -x|--exakt)
- exakt=true
- ;;
-i|--intensiv)
intensiv=true
;;
+ -l|--leise)
+ leise=true
+ flag_l="-l"
+ ;;
-s|--suche)
shift
if [ -n "$1" ]
@@ -73,6 +85,9 @@ do
suchen[${#suchen[@]}]="$1"
fi
;;
+ -x|--exakt)
+ exakt=true
+ ;;
--)
shift
break
@@ -107,21 +122,18 @@ then
sed "s|^<pre> \[\([^]]*\)].*\sServer = \(\S\+\)\(\s.*\)\?\$|\1 \2/\1.db|" | \
sed "s|^\(\S\+\)\s\+\(.*\)\$repo|\1 \2\1|; s|\$arch|x86_64|" | \
sed "s|^\S\+\s\+||" | \
- parallel -j0 "${ich} -d {}"
+ parallel -j0 "${ich} ${flag_l} -d {}"
fi
for ((i=0;i<${#downloads[@]};i++))
do
err=false
ziel="${pfad}/${downloads[${i}]##*/}"
- curl -o "${ziel}" "${downloads[${i}]}" 2> /dev/null || err=true
+ wget -O "${ziel}" "${downloads[${i}]}" 2> /dev/null || err=true
if ! ${err}
then
- verp=$(verpackung "${ziel}")
- if ! tar ${verp} -tf "${ziel}" &> /dev/null
+ if ! verp=$(verpackung "${ziel}") || ! tar ${verp} -tf "${ziel}" &> /dev/null
then
- [ -n "${verp}" ] && \
- echo tar ${verp} -tf "${ziel}" || \
err=true
fi
fi
@@ -129,7 +141,7 @@ do
then
rm -f "${ziel}"
else
- echo "${ziel##*/} erfolgreich heruntergeladen"
+ ${leise} || echo "${ziel##*/} erfolgreich heruntergeladen"
fi
done
@@ -139,7 +151,7 @@ do
${exakt} && suchName="^\(${suchName}\)-[^-]\+-[^-]\+\$"
for db in ${pfad}/*.db
do
- if tar $(verpackung "${db}") -tf "${db}" | \
+ if tar $(verpackung "${db}") -tf "${db}" 2> /dev/null | \
grep "/\$" |
sed "s|/\$||" |
grep -q "${suchName}"
@@ -153,10 +165,10 @@ do
fi
if ${intensiv}
then
- for pkg in $(tar $(verpackung "${db}") -tf "${db}" --wildcards "*/desc")
+ for pkg in $(tar $(verpackung "${db}") -tf "${db}" --wildcards "*/desc" 2> /dev/null)
do
inhalt="$(
- tar $(verpackung "${db}") -Oxf "${db}" "${pkg}" | \
+ tar $(verpackung "${db}") -Oxf "${db}" "${pkg}" 2> /dev/null | \
sed '
:begin;
$!N;