62fb438913cbaecd4983dcb051f0606180b80149
[ntp-cn.git] / debian / postinst
1 #!/bin/sh
2
3 [ "$1" = "configure" ] || exit 0
4 [ "$DEBIAN_SCRIPT_DEBUG" ] && set -vx
5
6 konfiguriraj() {
7   if [ -f /etc/ntp.conf ]; then
8     cp -p /etc/ntp.conf /etc/ntp.conf.dpkg-old
9   fi
10
11   if [ -f /etc/default/ntp-servers ]; then
12     cp -p /etc/default/ntp-servers /etc/default/ntp-servers.dpkg-old
13   fi
14
15   cp /usr/share/doc/ntp-cn/ntp.conf.tmpl /etc/ntp.conf
16
17   # Load CARNet Tools
18   . /usr/share/carnet-tools/functions.sh
19
20   cp_check_and_sed 'NTPSERVERS' \
21                    "s/^.*NTPSERVERS.*/NTPSERVERS=\"zg1.ntp.carnet.hr ri.ntp.carnet.hr zg2.ntp.carnet.hr st.ntp.carnet.hr os.ntp.carnet.hr 127.127.1.0\"/g" \
22                    /etc/default/ntpdate || true
23 }
24
25 if [ -f /usr/share/doc/ntp-cn/ntp.conf.tmpl -a -f /etc/ntp.conf ]; then
26   if ! cmp -s /usr/share/doc/ntp-cn/ntp.conf.tmpl /etc/ntp.conf; then
27     konfiguriraj
28   fi
29 fi
30
31 # restartaj sve
32 if [ -x /etc/init.d/ntp ]; then
33   if [ -x /usr/sbin/invoke-rc.d ]; then
34     invoke-rc.d ntp restart
35   else
36     /etc/init.d/ntp restart
37   fi
38 fi