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