summaryrefslogtreecommitdiff
path: root/meta-openpower/recipes-phosphor/debug/openpower-debug-collector-systemd-links.inc
blob: 9c522c1cd16de18aefe65f3c8d85eec0ae87d589 (plain)
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
pkg_postinst:${PN}:append() {
	mkdir -p $D$systemd_system_unitdir/obmc-host-crash@0.target.wants
	mkdir -p $D$systemd_system_unitdir/obmc-host-timeout@0.target.wants

	# The obmc-host-crash target is repurposed for the memory preserving reboot
	# feature when it is enabled. If not enabled, then install the standard
	# debug collector checkstop service for basic error reporting
	if [ "${@bb.utils.filter('DISTRO_FEATURES', 'mpreboot', d)}" != mpreboot ]; then
		LINK="$D$systemd_system_unitdir/obmc-host-crash@0.target.wants/openpower-debug-collector-checkstop@0.service"
		TARGET="../openpower-debug-collector-checkstop@.service"
		ln -s $TARGET $LINK
	fi

	LINK="$D$systemd_system_unitdir/obmc-host-timeout@0.target.wants/openpower-debug-collector-watchdog@0.service"
	TARGET="../openpower-debug-collector-watchdog@.service"
	ln -s $TARGET $LINK

	if [ "${@bb.utils.filter('OBMC_MACHINE_FEATURES', 'phal', d)}" != 'phal' ]; then
		LINK="$D$systemd_system_unitdir/obmc-host-timeout@0.target.wants/openpower-debug-collector-watchdog-timeout@0.service"
		TARGET="../openpower-debug-collector-watchdog-timeout@.service"
		ln -s $TARGET $LINK
	fi
}

pkg_prerm:${PN}:append() {
	if [ "${@bb.utils.filter('DISTRO_FEATURES', 'mpreboot', d)}" != mpreboot ]; then
		LINK="$D$systemd_system_unitdir/obmc-host-crash@0.target.wants/openpower-debug-collector-checkstop@0.service"
		rm $LINK
	fi
	LINK="$D$systemd_system_unitdir/obmc-host-timeout@0.target.wants/openpower-debug-collector-watchdog@0.service"
	rm $LINK
	if [ "${@bb.utils.filter('OBMC_MACHINE_FEATURES', 'phal', d)}" != 'phal' ]; then
		LINK="$D$systemd_system_unitdir/obmc-host-timeout@0.target.wants/openpower-debug-collector-watchdog-timeout@0.service"
		rm $LINK
	fi
}