novi debian/rules i novi debian/copyright
[ntp-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 konfiguriraj() {
9   if [ -f /etc/ntp.conf ]; then
10     cp -p /etc/ntp.conf /etc/ntp.conf.dpkg-old
11   fi
12
13   if [ -f /etc/default/ntp-servers ]; then
14     cp -p /etc/default/ntp-servers /etc/default/ntp-servers.dpkg-old
15   fi
16
17   cp /usr/share/doc/ntp-cn/ntp.conf.tmpl /etc/ntp.conf
18
19   # Load CARNet Tools
20   . /usr/share/carnet-tools/functions.sh
21
22   cp_check_and_sed 'NTPSERVERS' \
23                    "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" \
24                    /etc/default/ntpdate || true
25 }
26
27 if [ -f /usr/share/doc/ntp-cn/ntp.conf.tmpl -a -f /etc/ntp.conf ]; then
28   if ! cmp -s /usr/share/doc/ntp-cn/ntp.conf.tmpl /etc/ntp.conf; then
29     konfiguriraj
30   fi
31 fi
32
33 # restartaj sve
34 if [ -x /etc/init.d/ntp ]; then
35   if [ -x /usr/sbin/invoke-rc.d ]; then
36     invoke-rc.d ntp restart
37   else
38     /etc/init.d/ntp restart
39   fi
40 fi