File: ntp.postinst

package info (click to toggle)
ntp 1%3A4.2.2.p4%2Bdfsg-2etch4
  • links: PTS
  • area: main
  • in suites: etch
  • size: 10,236 kB
  • ctags: 10,865
  • sloc: ansic: 90,242; sh: 4,314; perl: 1,331; makefile: 631; awk: 417; asm: 37; sed: 7
file content (44 lines) | stat: -rw-r--r-- 1,150 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/sh 

set -e

if [ "$1" = "configure" ]; then
	adduser --system --quiet --group --no-create-home ntp || :
	chown -R ntp:ntp /var/lib/ntp /var/log/ntpstats

	# Make sure the previous daemon gets stopped.  Versions up to and
	# including 1:4.2.0a+stable-8.2 don't properly stop the daemon in
	# case ntp-simple or ntp-refclock is removed before ntp-server:
	# the binary is removed and the init script doesn't do a thing.
	if [ -n "$2" ] && dpkg --compare-versions "$2" lt 1:4.2.0a+stable-9; then
		if [ -x "/etc/init.d/ntp" ]; then
			if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
				invoke-rc.d ntp stop
			else
				/etc/init.d/ntp stop
			fi
		fi
	fi

	# Disable configuration files of predecessor package.
	if [ -n "$2" ] && dpkg --compare-versions "$2" le 1:4.2.2.p4+dfsg-1; then
		for file in \
			/etc/cron.daily/ntp-server \
			/etc/cron.weekly/ntp-server \
			/etc/init.d/ntp-server \
			/etc/interfaces/if-up.d/ntp-server \
			/etc/logcheck/ignore.d.server/ntp-server
		do
			if [ -f $file ]; then
				mv -f $file $file.dpkg-old
			fi
		done
		update-rc.d -f ntp-server remove
	fi
fi

installinit_error() {
	exit $?
}

#DEBHELPER#