blob: df214313f76ca9cb0962869d7b361542dd4d12c1 [file] [log] [blame]
Patrick Williams3952f8b2022-04-20 16:25:53 -05001DEFAULT_TARGETS = " \
Patrick Williams3952f8b2022-04-20 16:25:53 -05002 multi-user.target.requires/obmc-host-reset@{}.target \
3 multi-user.target.requires/phosphor-discover-system-state@{}.service \
4 obmc-chassis-poweron@{}.target.wants/phosphor-reset-host-recovery@{}.service \
5 obmc-host-start@{}.target.requires/obmc-host-startmin@{}.target \
6 obmc-host-start@{}.target.requires/phosphor-reset-host-reboot-attempts@{}.service \
7 obmc-host-startmin@{}.target.wants/phosphor-set-host-transition-to-running@{}.service \
8 obmc-host-stop@{}.target.wants/phosphor-set-host-transition-to-off@{}.service \
9 obmc-host-reset@{}.target.requires/phosphor-reset-host-running@{}.service \
10 obmc-host-stop@{}.target.wants/phosphor-reset-sensor-states@{}.service \
11 obmc-host-quiesce@{}.target.wants/phosphor-reset-sensor-states@{}.service \
12 obmc-host-shutdown@{}.target.requires/obmc-chassis-poweroff@{}.target \
13 obmc-host-reboot@{}.target.requires/obmc-host-shutdown@{}.target \
14 obmc-host-reboot@{}.target.requires/phosphor-reboot-host@{}.service \
15 obmc-host-warm-reboot@{}.target.requires/xyz.openbmc_project.Ipmi.Internal.SoftPowerOff.service \
16 obmc-host-force-warm-reboot@{}.target.requires/obmc-host-stop@{}.target \
17 obmc-host-force-warm-reboot@{}.target.requires/phosphor-reboot-host@{}.service \
18 obmc-host-warm-reboot@{}.target.requires/obmc-host-force-warm-reboot@{}.target \
19 obmc-chassis-poweroff@{}.target.wants/phosphor-clear-one-time@{}.service \
20"
Patrick Williams4c7b3e62022-03-09 15:56:34 -060021
22# TODO: There are some targets that are chassis oriented, but there is no
23# obvious way to map HOST<->CHASSIS relationships. Making an assumption
24# currently that there is a 1-to-1 relationship between the two.
25
Patrick Williams12fc9392021-08-06 09:16:53 -050026pkg_postinst:${PN}-obmc-targets:append() {
Patrick Williams4c7b3e62022-03-09 15:56:34 -060027 for i in ${OBMC_HOST_INSTANCES};
28 do
Patrick Williams3952f8b2022-04-20 16:25:53 -050029 for j in ${DEFAULT_TARGETS};
30 do
31 LINK="$D$systemd_system_unitdir/${j}"
32 LINK="$(echo ${LINK} | sed s/{}/${i}/g )"
33 TARGET="../$(basename ${j} | sed s/{}//g )"
34 mkdir -p "$(dirname ${LINK})"
35 ln -s "${TARGET}" "${LINK}"
36 done
Patrick Williams4c7b3e62022-03-09 15:56:34 -060037 done
Andrew Geissler20cff702020-03-09 16:51:27 -050038}
39
Patrick Williams12fc9392021-08-06 09:16:53 -050040pkg_prerm:${PN}-obmc-targets:append() {
Patrick Williams4c7b3e62022-03-09 15:56:34 -060041 for i in ${OBMC_HOST_INSTANCES};
42 do
Patrick Williams3952f8b2022-04-20 16:25:53 -050043 for j in ${DEFAULT_TARGETS};
44 do
45 LINK="$D$systemd_system_unitdir/${j}"
46 LINK="$(echo ${LINK} | sed s/{}/${i}/g )"
47 rm "${LINK}"
48 done
Patrick Williams4c7b3e62022-03-09 15:56:34 -060049 done
Andrew Geissler20cff702020-03-09 16:51:27 -050050}
Andrew Geisslera02a18a2022-02-21 23:00:20 +000051
Patrick Williams4040b542022-04-20 16:35:25 -050052pkg_postinst:${PN}-chassis:append() {
53 for i in ${OBMC_CHASSIS_INSTANCES};
54 do
55 mkdir -p $D$systemd_system_unitdir/multi-user.target.requires
56 LINK="$D$systemd_system_unitdir/multi-user.target.requires/xyz.openbmc_project.State.Chassis@${i}.service"
57 TARGET="../xyz.openbmc_project.State.Chassis@.service"
58 ln -s $TARGET $LINK
59 done
60}
61
Patrick Williams83a7aa92022-04-20 13:48:37 -050062pkg_prerm:${PN}-chassis:append() {
Patrick Williams954512d2022-04-20 15:01:07 -050063 for i in ${OBMC_CHASSIS_INSTANCES};
Patrick Williams83a7aa92022-04-20 13:48:37 -050064 do
Patrick Williams83a7aa92022-04-20 13:48:37 -050065 LINK="$D$systemd_system_unitdir/multi-user.target.requires/xyz.openbmc_project.State.Chassis@${i}.service"
66 rm $LINK
Patrick Williams4040b542022-04-20 16:35:25 -050067 done
68}
Patrick Williams83a7aa92022-04-20 13:48:37 -050069
Patrick Williams4040b542022-04-20 16:35:25 -050070pkg_postinst:${PN}-chassis-check-power-status:append() {
71 for i in ${OBMC_HOST_INSTANCES};
72 do
73 mkdir -p $D$systemd_system_unitdir/obmc-chassis-poweron@${i}.target.requires
74 LINK="$D$systemd_system_unitdir/obmc-chassis-poweron@${i}.target.requires/phosphor-chassis-check-power-status@${i}.service"
75 TARGET="../phosphor-chassis-check-power-status@.service"
76 ln -s $TARGET $LINK
Patrick Williams83a7aa92022-04-20 13:48:37 -050077 done
78}
79
Andrew Geisslera02a18a2022-02-21 23:00:20 +000080pkg_prerm:${PN}-chassis-check-power-status:append() {
Patrick Williams4c7b3e62022-03-09 15:56:34 -060081 for i in ${OBMC_HOST_INSTANCES};
82 do
Patrick Williams4c7b3e62022-03-09 15:56:34 -060083 LINK="$D$systemd_system_unitdir/obmc-chassis-poweron@${i}.target.requires/phosphor-chassis-check-power-status@${i}.service"
84 rm $LINK
Patrick Williams4040b542022-04-20 16:35:25 -050085 done
86}
Patrick Williams4c7b3e62022-03-09 15:56:34 -060087
Patrick Williams4040b542022-04-20 16:35:25 -050088pkg_postinst:${PN}-host:append() {
89 for i in ${OBMC_HOST_INSTANCES};
90 do
91 mkdir -p $D$systemd_system_unitdir/multi-user.target.requires
92 LINK="$D$systemd_system_unitdir/multi-user.target.requires/xyz.openbmc_project.State.Host@${i}.service"
93 TARGET="../xyz.openbmc_project.State.Host@.service"
94 ln -s $TARGET $LINK
Patrick Williams4c7b3e62022-03-09 15:56:34 -060095 done
Andrew Geisslera02a18a2022-02-21 23:00:20 +000096}
Patrick Williamsad7adea2022-04-20 13:48:37 -050097
98pkg_prerm:${PN}-host:append() {
99 for i in ${OBMC_HOST_INSTANCES};
100 do
Patrick Williamsad7adea2022-04-20 13:48:37 -0500101 LINK="$D$systemd_system_unitdir/multi-user.target.requires/xyz.openbmc_project.State.Host@${i}.service"
102 rm $LINK
Patrick Williamsad7adea2022-04-20 13:48:37 -0500103 done
104}