File: iprutils.postinst

package info (click to toggle)
iprutils 2.4.19-3
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 1,304 kB
  • sloc: ansic: 27,001; sh: 326; makefile: 88; python: 10
file content (39 lines) | stat: -rw-r--r-- 1,018 bytes parent folder | download | duplicates (5)
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
#! /bin/sh
set -e

#DEBHELPER#

# Start services conditionally rather than relying on debhelper, in order to
# handle udev activation under systemd.
case $1 in
    configure|abort-upgrade|abort-deconfigure|abort-remove)
	if [ -d /run/systemd/system ]; then
		# If we're on systemd, restart services if they're running
		# or if the ipr kernel module is loaded, but otherwise leave
		# services stopped until they're activated by udev.
		systemctl --system daemon-reload >/dev/null || true
		deb-systemd-invoke try-restart \
			iprinit.service iprdump.service iprupdate.service \
			>/dev/null || true
		if [ -d /sys/module/ipr ]; then
			deb-systemd-invoke restart iprutils.target \
				>/dev/null || true
		fi
	else
		# If we're not on systemd, just (re)start services as
		# normal.
		if [ "$2" ]; then
			action=restart
		else
			action=start
		fi
		for script in iprinit iprdump iprupdate; do
			if [ -x "/etc/init.d/$script" ]; then
				invoke-rc.d "$script" "$action" || exit 1
			fi
		done
	fi
	;;
esac

exit 0