Make APT sources for Ubuntu jaunty / 9.10.
[git-tools-moved-to-github.git] / update-archive / update-archive.sh
1 #!/bin/sh
2 # $Id: update-archive.sh,v 1.13 2008-10-20 10:24:15 adam Exp $
3 if test ! -f apt-ftparchive.conf.in; then
4         echo "$0: apt-ftparchive.conf.in must be located in current directory"
5         exit 1
6 fi
7
8 if test ! -x /usr/bin/apt-ftparchive; then
9         echo "$0: /usr/bin/apt-ftparchive missing. Install apt-utils"
10         exit 1
11 fi
12
13 # gpg -a -d -o Release.gpg Release
14
15 confdir=`pwd`
16
17 architectures="i386 amd64"
18
19 for vdist in ubuntu/gutsy ubuntu/hardy ubuntu/intrepid ubuntu/jaunty debian/lenny debian/etch debian/sarge debian/woody; do
20         dist=`basename $vdist`
21         vendor=`dirname $vdist`
22         ftpdir=/home/ftp/pub/$vendor
23         if test ! -d $ftpdir; then
24                 echo "$ftpdir does not exist"
25                 exit 1
26         fi
27         cd $ftpdir
28         test -d tmp || mkdir tmp
29         # Uncomment to clean the .db (cache)
30         # rm tmp/*
31
32         # Make symlinks from the regular FTP archive
33         d=pool/dists/$dist
34         if test ! -d $d; then mkdir -p $d; fi
35         # Remove invalid symlinks
36         for l in $d/*; do
37                 if test -L $l; then
38                         if test ! -f $l; then
39                                 rm $l
40                         fi
41                 fi
42         done
43         mkdir -p $d/source
44         ln -sf /home/ftp/pub/*/$vendor/$dist/* $d/source
45         rm $d/source/*.deb
46         for arch in $architectures; do
47                 mkdir -p $d/${arch}
48                 for f in /home/ftp/pub/*/$vendor/$dist/*_${arch}.* \
49                          /home/ftp/pub/*/$vendor/$dist/*_all.*; do
50                         if test -f $f; then
51                                 ln -sf $f $d/${arch}
52                         fi
53                 done
54                 #ln -sf /home/ftp/pub/*/$vendor/$dist/*_${arch}.* $d/${arch}
55                 #ln -sf /home/ftp/pub/*/$vendor/$dist/*_all.* $d/${arch}
56         done
57
58         # ${confdir}/symclean.sh $d
59
60         for arch in $architectures; do
61                 d=dists/$dist/main/binary-$arch
62                 if test ! -d $d; then mkdir -p $d; fi
63                 echo "Archive: $dist" >$d/Release
64                 echo 'Component: main' >>$d/Release
65                 echo 'Origin: Indexdata' >>$d/Release
66                 echo "Architecture: $arch" >>$d/Release
67         done
68
69         d=dists/$dist/main/source
70         if test ! -d $d; then mkdir -p $d; fi
71         echo "Archive: $dist" >$d/Release
72         echo 'Component: main' >>$d/Release
73         echo 'Origin: Indexdata' >>$d/Release
74         echo 'Architecture: source' >>$d/Release
75
76         # generate
77         echo "Begin Generate $dist"
78         F=apt-ftparchive.conf
79         sed "s/@dist@/$dist/g" <${confdir}/${F}.in |sed "s/@architectures@/${architectures}/g" > $F
80         # Don't know if clean is needed!
81         # apt-ftparchive clean apt-ftparchive.conf
82         apt-ftparchive generate apt-ftparchive.conf
83         echo "Done generate $dist"
84
85         # release
86         r=dists/$dist/Release
87         F=apt-release.conf
88         sed "s/@dist@/$dist/g" <${confdir}/${F}.in | sed "s/@architectures@/${architectures}/g" >$F
89         # Move Release file away while calling using release 
90         rm $r
91         apt-ftparchive -c $F release dists/$dist >tmp_Release
92         mv tmp_Release $r
93
94         # sign
95         if true; then
96                 r=dists/$dist/Release
97                 rm -f ${r}.gpg
98                 gpg --sign -u "Index Data" -ba -o ${r}.gpg dists/$dist/Release
99         fi
100 done
101 # Local Variables:
102 # mode:shell-script
103 # sh-indentation: 2
104 # sh-basic-offset: 8
105 # End:
106