summaryrefslogtreecommitdiff
path: root/find-bootstrap-duplicates
blob: 6d80e039f3acf403555b27f8b4b27375dd12a8ea (plain)
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/bin/bash

bootstrap_mirror='https://archlinux32.andreasbaumann.cc/bootstrap/i486'
bootstrap_prefix='bootstrap'
mirror='https://mirror.archlinux32.org'

tmp_dir=$(mktemp -d)
trap 'rm -rf --one-file-system "${tmp_dir}"' EXIT

for repo in \
  'core' \
  'extra' \
  'community' \
  'testing' \
  'community-testing' \
  'staging' \
  'community-staging' \
  ''; do

  curl -Ss "${bootstrap_mirror}/${repo}/${bootstrap_prefix}${repo+-}${repo}.db.tar.gz" | \
    tar -tz 2>/dev/null | \
    sed -n '
      s,\(-[^-]\+\)\{2\}/$,,
      T
      p
    ' >> \
    "${tmp_dir}/bootstrap"

  if [ -n "${repo}" ]; then
    for arch in 'i486' 'i686'; do
      curl -Ss "${mirror}/${arch}/${repo}/${repo}.db.tar.gz" | \
        tar -tz 2>/dev/null | \
        sed -n '
          s,\(-[^-]\+\)\{2\}/$,,
          T
          p
        ' >> \
        "${tmp_dir}/${arch}"
    done
  fi
done

{
  sort -u "${tmp_dir}/bootstrap" | \
    sed 'p'
  sort -u "${tmp_dir}/i486" | \
    sed 'p'
  sort -u "${tmp_dir}/i686"
} | \
  sort | \
  uniq -u | \
  sed '
    s/^/missing (i486 vs. i686):\t/
  '

{
  sort -u "${tmp_dir}/bootstrap"
  sort -u "${tmp_dir}/i486"
} | \
  sort | \
  uniq -d | \
  sed '
    s/^/duplicates:\t/
  '

{
  sort -u "${tmp_dir}/bootstrap"
  sort -u "${tmp_dir}/i486" | \
    sed 'p'
} | \
  sort | \
  uniq -u | \
  sed '
    s/^/missing (i486 vs. bootstrap):\t/
  '