/[scripts]/trunk/small-deb-mirror.sh
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /trunk/small-deb-mirror.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 14 - (hide annotations)
Thu Oct 6 09:07:47 2005 UTC (18 years, 5 months ago) by dpavlin
File MIME type: application/x-sh
File size: 1712 byte(s)
delete old archive files

1 dpavlin 11 #!/bin/sh
2    
3     from="rem.pliva.hr:/mirrors/debian/pub/debian"
4 dpavlin 14 mount | grep " /usb_drive " && to="/usb_drive/mirrors/debian"
5     test -z "$to" && mount | grep " /mnt " && to="/mnt/mirrors/debian"
6     test -z "$to" && echo "can't find destination directory!" && exit
7     dists="sid sarge"
8 dpavlin 11
9 dpavlin 14 echo "$from -> $to"
10    
11 dpavlin 11 OPT="
12     --exclude "*-alpha" \
13     --exclude "*-arm" \
14     --exclude "*-hppa" \
15     --exclude "*-ia64" \
16     --exclude "*-m68k" \
17     --exclude "*-mips" \
18     --exclude "*-mipsel" \
19     --exclude "*-powerpc" \
20     --exclude "*-s390" \
21     --exclude "*-sparc" \
22     "
23    
24 dpavlin 14 echo > /tmp/pool
25     echo > /tmp/pool-non-US
26 dpavlin 11
27 dpavlin 14 for dist in $dists ; do
28    
29     echo "working on $dist"
30    
31     test -d "$to/dists/$dist/" || mkdir -p "$to/dists/$dist/"
32     test -d "$to-non-US/dists/$dist/" || mkdir -p "$to-non-US/dists/$dist/"
33    
34     rsync -raq --delete $OPT "$from/dists/$dist/" "$to/dists/$dist/"
35     rsync -raq --delete $OPT "$from-non-US/dists/$dist/" "$to-non-US/dists/$dist/"
36    
37     grep ^Filename: $to/dists/$dist/*/binary-i386/Packages | sed 's#^.*Filename: *##' > /tmp/pool_$dist
38     grep ^Filename: $to-non-US/dists/$dist/non-US/*/binary-i386/Packages | sed 's#^.*Filename: *##' > /tmp/pool-non-US_$dist
39    
40     done
41    
42     cat /tmp/pool_* | sort -u > /tmp/pool
43     cat /tmp/pool-non-US_* | sort -u > /tmp/pool-non-US
44    
45     echo `wc -l /tmp/pool` " files in pool"
46     echo `wc -l /tmp/pool-non-US` " files in non-US pool"
47    
48     cd $to || exit
49    
50     echo -n "remove expired files "
51    
52     e=/tmp/pool.existing
53    
54     find pool -type f | sort -u > $e.old
55     cat /tmp/pool /tmp/pool-non-US | sort -u > $e.new
56     diff $e.old $e.new | grep '^<' | cut -c3- > $e.delete
57    
58     wc -l $e.delete | cut -d" " -f1
59    
60     xargs rm < $e.delete
61    
62 dpavlin 11 rsync -av --delete --files-from=/tmp/pool "$from/" "$to/"
63     rsync -av --delete --files-from=/tmp/pool-non-US "$from-non-US/" "$to-non-US/"

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26