r1: [svn-inject] Installing original source of samba-cn
[samba-cn.git] / debian / postinst
1 #!/bin/sh
2
3 [ "$1" = "configure" ] || exit 0
4
5 konfiguriraj() {
6   if [ -f /etc/ntp.conf ]; then
7     cp -p /etc/ntp.conf /etc/ntp.conf.dpkg-old
8   fi
9
10   if [ -f /etc/default/ntp-servers ]; then
11     cp -p /etc/default/ntp-servers /etc/default/ntp-servers.dpkg-old
12   fi
13
14   cp /usr/share/doc/ntp-cn/ntp.conf.tmpl /etc
15
16   cat > /etc/default/ntp-servers <<EOF
17 NTPSERVERS="zg1.ntp.carnet.hr ri.ntp.carnet.hr zg2.ntp.carnet.hr 127.127.1.0"
18 EOF
19 }
20
21 if [ -f /usr/share/doc/ntp-cn/ntp.conf.tmpl -a -f /etc/ntp.conf ]; then
22   if ! cmp -s /usr/share/doc/ntp-cn/ntp.conf.tmpl /etc/ntp.conf; then
23     konfiguriraj
24   fi
25 fi
26
27 # restartaj sve
28 if [ -x /etc/init.d/ntp ]; then
29   if [ -x /usr/sbin/invoke-rc.d ]; then
30     invoke-rc.d ntp stop
31     for i in 1 2 3 4 5 6 7 8 9 0; do
32       pgrep -u root -f /usr/sbin/ntpd >/dev/null && sleep 1 || break
33     done
34     invoke-rc.d ntp start
35   else
36     /etc/init.d/ntp stop
37     for i in 1 2 3 4 5 6 7 8 9 0; do
38       pgrep -u root -f /usr/sbin/ntpd >/dev/null && sleep 1 || break
39     done
40     /etc/init.d/ntp start
41   fi
42 fi