File: checkdebmirrors.sh

package info (click to toggle)
apt-cacher-ng 3.3.1-2~bpo10+1
  • links: PTS, VCS
  • area: main
  • in suites: buster-backports
  • size: 2,040 kB
  • sloc: cpp: 17,564; sh: 553; ansic: 401; perl: 377; makefile: 126
file content (25 lines) | stat: -rw-r--r-- 623 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/bash -x

# DEPRECATED script, see checkubuntu* stuff

listfile=goodmirrors.txt
badfile=badmirrors.txt
wd=$(mktemp -d)

src=$wd/src
./apt-cacher-ng -c conf logdir=/tmp debug=-42 | grep __debrep | cut -f1 -d_ > $src

a=0
for x in `cat $src` ; do
   x=$(echo $x | sed -e 's,/\+,/,g ; s,http:/,http://, ; s,/$,,')
   a=$(( $a + 1 ))
   wget -q -t 1 -O- --timeout=10 $x/dists/ | grep -q 'stable' && echo $x > $wd/url.$a || echo $x > $wd/bad.$a &
   sleep 0.2
done

wait

cat $wd/url.* | sed -e 's,$,/,;s,//$,/,' | sort -u > $listfile
cat $wd/bad.* | sed -e 's,$,/,;s,//$,/,' | sort -u > $badfile

echo $listfile created.