95f7699d2c031de0123269b3bc5a759fbd6a1a9a
[apt-repository.git] / rebuild
1 #!/bin/sh
2 SOURCES=sources
3 PACKAGES=public/packages
4
5 mkdir -p $PACKAGES
6
7 cd $PACKAGES
8
9 for i in ../../$SOURCES/*; do 
10         BASE=`basename "$i"`
11         if [ -d "$i" ]; then
12                 echo "Skipping directory '$BASE'"
13                 continue;
14         fi
15         if [ ! -f "$i" ]; then
16                 echo "Skipping special file file '$BASE'"
17                 continue;
18         fi
19         if [ ! -r "$i" ]; then
20                 echo "Skipping non-readable file '$BASE'"
21                 continue;
22         fi
23
24         VERSION=`cat $i | grep "^Version:" | sed "s/^Version: //"`
25         PACKAGE=`cat $i | grep "^Package:" | sed "s/^Package: //"`
26
27         if [ -z "${PACKAGE}" -o -z "${VERSION}" ]; then
28                 echo "Skipping non-equivs file '$BASE'"
29                 continue;
30         fi
31         if [ -f "${PACKAGE}_${VERSION}_all.deb" ]; then
32                 echo "Skipping $PACKAGE, version $VERSION already built"
33                 continue;
34         fi
35
36         echo "Building version $VERSION of $PACKAGE"
37         equivs-build $i
38 done
39
40 cd ../..