File: mirror-snapshot.sh

package info (click to toggle)
dose3 7.0.0-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,276 kB
  • sloc: ml: 25,053; python: 605; perl: 391; sh: 347; makefile: 187
file content (23 lines) | stat: -rwxr-xr-x 1,023 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/bash

#set -x

dists=${1:-unstable}
years="2011 2012"

for y in $years; do
  for m in {1..12}; do
    if [ $m -lt 10 ] ; then m="0"$m ; fi
    line=$(wget -O - "http://snapshot.debian.org/archive/debian/?year=$y;month=$m" | grep "$y-$m-10" | head -1)
    date=$(echo $line | perl -0ne 'print "$1\n" while (/a href=\"(.*?)\">.*?<\/a>/igs)')
    url=http://snapshot.debian.org/archive/debian/$date/dists/$dists/main/binary-i386/Packages.gz
    mkdir -p archive/$date/dists/$dists/main/binary-i386
    wget -c -O archive/$date/dists/$dists/main/binary-i386/Packages.gz $url

    line=$(wget -O - "http://snapshot.debian.org/archive/debian/?year=$y;month=$m" | grep "$y-$m-25" | head -1)
    date=$(echo $line | perl -0ne 'print "$1\n" while (/a href=\"(.*?)\">.*?<\/a>/igs)')
    url=http://snapshot.debian.org/archive/debian/$date/dists/$dists/main/binary-i386/Packages.gz
    mkdir -p archive/$date/dists/$dists/main/binary-i386
    wget -c -O archive/$date/dists/$dists/main/binary-i386/Packages.gz $url
  done
done