r1: [svn-inject] Installing original source of apt-cn
[apt-cn.git] / debian / postinst
1 #!/bin/sh
2
3 set -e
4
5 [ "$1" = "configure" ] || exit 0
6
7 repos_regexp="
8 ^deb .*tp://security.debian.org etch/updates main contrib non-free
9 ^deb .*tp://ftp.carnet.hr/.*debian etch main contrib non-free
10 ^deb .*tp://ftp.carnet.hr/carnet-debian etch main non-free"
11
12 repos="
13 1 deb http://security.debian.org etch/updates main contrib non-free
14 2 deb http://ftp.carnet.hr/debian etch main contrib non-free
15 3 deb http://ftp.carnet.hr/carnet-debian etch main non-free"
16
17 notneeded_repos_regexp="^deb.*tp://.*debian-non-US"
18
19 IFS="
20 "
21
22 counter=1
23 for i in $repos_regexp; do
24   if ! grep -q "$i" /etc/apt/sources.list; then
25     needed="$needed $counter"
26   fi
27   counter=$(($counter + 1))
28 done
29
30 if grep -q "$notneeded_repos_regexp" /etc/apt/sources.list; then
31   echo "CN: Following repositories are obsolete:"
32   grep "$notneeded_repos_regexp" /etc/apt/sources.list
33   echo ""
34 fi
35
36 if [ ! -z "$needed" ]; then
37   echo "CN: Following repositories are not found in your sources list:"
38   IFS=" "
39   for i in $needed; do
40     echo $repos | grep ^$i | cut -c3-300
41   done
42   echo ""
43   echo "CN: You can add the above to /etc/apt/sources.list or just:"
44   echo "CN: # install-carnet-sources.list"
45 fi