~ubuntu-branches/debian/squeeze/ntp/squeeze-201010051545

« back to all changes in this revision

Viewing changes to debian/ntp-simple.postinst

  • Committer: Bazaar Package Importer
  • Author(s): Matt Zimmerman
  • Date: 2004-10-11 16:10:27 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20041011161027-icyjbji8ujym633o
Tags: 1:4.2.0a-10ubuntu2
Use ntp.ubuntulinux.org instead of pool.ntp.org

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/bin/sh 
2
2
 
3
 
NC="/etc/ntp.conf"
4
 
NS="/etc/default/ntp-servers"
5
 
 
6
 
TWEAK="no"
7
 
 
8
3
# only do remaining stuff if we're being called to configure the package
9
4
if [ "$1" != "configure" ]
10
5
then
16
11
 
17
12
start-stop-daemon --stop --quiet --exec /usr/sbin/ntpd
18
13
 
19
 
. /usr/share/debconf/confmodule
20
 
 
21
 
db_get shared/ntp/update-conf
22
 
OverwriteConfig="${RET:-true}"
23
 
 
24
 
# only emit config files if the admin gave us permission to do so
25
 
if test "$OverwriteConfig" = "true"
26
 
then
27
 
 
28
 
        # get list of servers from debconf and write shared info file
29
 
        db_get shared/ntp/servers
30
 
        echo "NTPSERVERS=\"$RET\"" > $NS
31
 
 
32
 
        # if no ntp.conf file exists or it's empty, stuff a template
33
 
 
34
 
        if [ ! -s $NC ]
35
 
        then
36
 
                echo "# /etc/ntp.conf, configuration for ntpd" > $NC
37
 
                echo "" >> $NC
38
 
                echo "# ntpd will use syslog() if logfile is not defined" >> $NC
39
 
                echo "#logfile /var/log/ntpd" >> $NC
40
 
                echo "" >> $NC
41
 
                echo "driftfile /var/lib/ntp/ntp.drift" >> $NC
42
 
                echo "statsdir /var/log/ntpstats/" >> $NC
43
 
                echo "" >> $NC
44
 
                echo "statistics loopstats peerstats clockstats" >> $NC
45
 
                echo "filegen loopstats file loopstats type day enable" >> $NC
46
 
                echo "filegen peerstats file peerstats type day enable" >> $NC
47
 
                echo "filegen clockstats file clockstats type day enable" >> $NC
48
 
                echo "" >> $NC
49
 
                echo "### lines starting 'server' are auto generated," >> $NC
50
 
                echo "### use dpkg-reconfigure to modify those lines." >> $NC
51
 
                echo "" >> $NC
52
 
        fi
53
 
 
54
 
        # since ntpd does not support an include file mechanism for ntp.conf, 
55
 
        # we have to rewrite it every time the list of servers changes.  
56
 
        # to allow the most system admin flexibility regarding other options, 
57
 
        # we will leave everything alone except lines starting with 'server', 
58
 
        # and replace those with fresh lines at the end of the file derived 
59
 
        # from debconf data
60
 
 
61
 
        grep -v "^server" $NC > $NC.new
62
 
 
63
 
        db_get shared/ntp/servers 
64
 
        for i in $RET
65
 
        do
66
 
                echo "server $i" >> $NC.new
67
 
        done
68
 
 
69
 
        mv -f $NC.new $NC
70
 
fi
71
 
 
72
 
# all done with debconf here.
73
 
db_stop
74
 
 
75
14
#DEBHELPER#
 
15
 
 
16
exit 0