blob: 2a3f04429b809fa054175f97d53213121405ac15 [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 \
Andrew Geisslerdee00252022-05-12 11:42:27 -04003 multi-user.target.wants/phosphor-discover-system-state@{}.service \
Patrick Williams3952f8b2022-04-20 16:25:53 -05004 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 \
Andrew Geissler73f93652022-04-15 13:32:04 -050011 obmc-host-graceful-quiesce@{}.target.wants/obmc-host-quiesce@{}.target \
12 obmc-host-graceful-quiesce@{}.target.wants/pldmSoftPowerOff.service \
Patrick Williams3952f8b2022-04-20 16:25:53 -050013 obmc-host-quiesce@{}.target.wants/phosphor-reset-sensor-states@{}.service \
14 obmc-host-shutdown@{}.target.requires/obmc-chassis-poweroff@{}.target \
15 obmc-host-reboot@{}.target.requires/obmc-host-shutdown@{}.target \
16 obmc-host-reboot@{}.target.requires/phosphor-reboot-host@{}.service \
17 obmc-host-warm-reboot@{}.target.requires/xyz.openbmc_project.Ipmi.Internal.SoftPowerOff.service \
18 obmc-host-force-warm-reboot@{}.target.requires/obmc-host-stop@{}.target \
19 obmc-host-force-warm-reboot@{}.target.requires/phosphor-reboot-host@{}.service \
20 obmc-host-warm-reboot@{}.target.requires/obmc-host-force-warm-reboot@{}.target \
21 obmc-chassis-poweroff@{}.target.wants/phosphor-clear-one-time@{}.service \
22"
Patrick Williams4c7b3e62022-03-09 15:56:34 -060023
24# TODO: There are some targets that are chassis oriented, but there is no
25# obvious way to map HOST<->CHASSIS relationships. Making an assumption
26# currently that there is a 1-to-1 relationship between the two.
27
Patrick Williams12fc9392021-08-06 09:16:53 -050028pkg_postinst:${PN}-obmc-targets:append() {
Patrick Williams4c7b3e62022-03-09 15:56:34 -060029 for i in ${OBMC_HOST_INSTANCES};
30 do
Patrick Williams3952f8b2022-04-20 16:25:53 -050031 for j in ${DEFAULT_TARGETS};
32 do
33 LINK="$D$systemd_system_unitdir/${j}"
34 LINK="$(echo ${LINK} | sed s/{}/${i}/g )"
35 TARGET="../$(basename ${j} | sed s/{}//g )"
36 mkdir -p "$(dirname ${LINK})"
37 ln -s "${TARGET}" "${LINK}"
38 done
Patrick Williams4c7b3e62022-03-09 15:56:34 -060039 done
Andrew Geissler20cff702020-03-09 16:51:27 -050040}
41
Patrick Williams12fc9392021-08-06 09:16:53 -050042pkg_prerm:${PN}-obmc-targets:append() {
Patrick Williams4c7b3e62022-03-09 15:56:34 -060043 for i in ${OBMC_HOST_INSTANCES};
44 do
Patrick Williams3952f8b2022-04-20 16:25:53 -050045 for j in ${DEFAULT_TARGETS};
46 do
47 LINK="$D$systemd_system_unitdir/${j}"
48 LINK="$(echo ${LINK} | sed s/{}/${i}/g )"
49 rm "${LINK}"
50 done
Patrick Williams4c7b3e62022-03-09 15:56:34 -060051 done
Andrew Geissler20cff702020-03-09 16:51:27 -050052}
Andrew Geisslera02a18a2022-02-21 23:00:20 +000053
Patrick Williams4040b542022-04-20 16:35:25 -050054pkg_postinst:${PN}-chassis:append() {
55 for i in ${OBMC_CHASSIS_INSTANCES};
56 do
57 mkdir -p $D$systemd_system_unitdir/multi-user.target.requires
58 LINK="$D$systemd_system_unitdir/multi-user.target.requires/xyz.openbmc_project.State.Chassis@${i}.service"
59 TARGET="../xyz.openbmc_project.State.Chassis@.service"
60 ln -s $TARGET $LINK
61 done
62}
63
Patrick Williams83a7aa92022-04-20 13:48:37 -050064pkg_prerm:${PN}-chassis:append() {
Patrick Williams954512d2022-04-20 15:01:07 -050065 for i in ${OBMC_CHASSIS_INSTANCES};
Patrick Williams83a7aa92022-04-20 13:48:37 -050066 do
Patrick Williams83a7aa92022-04-20 13:48:37 -050067 LINK="$D$systemd_system_unitdir/multi-user.target.requires/xyz.openbmc_project.State.Chassis@${i}.service"
68 rm $LINK
Patrick Williams4040b542022-04-20 16:35:25 -050069 done
70}
Patrick Williams83a7aa92022-04-20 13:48:37 -050071
Patrick Williams4040b542022-04-20 16:35:25 -050072pkg_postinst:${PN}-chassis-check-power-status:append() {
73 for i in ${OBMC_HOST_INSTANCES};
74 do
75 mkdir -p $D$systemd_system_unitdir/obmc-chassis-poweron@${i}.target.requires
76 LINK="$D$systemd_system_unitdir/obmc-chassis-poweron@${i}.target.requires/phosphor-chassis-check-power-status@${i}.service"
77 TARGET="../phosphor-chassis-check-power-status@.service"
78 ln -s $TARGET $LINK
Patrick Williams83a7aa92022-04-20 13:48:37 -050079 done
80}
81
Andrew Geisslera02a18a2022-02-21 23:00:20 +000082pkg_prerm:${PN}-chassis-check-power-status:append() {
Patrick Williams4c7b3e62022-03-09 15:56:34 -060083 for i in ${OBMC_HOST_INSTANCES};
84 do
Patrick Williams4c7b3e62022-03-09 15:56:34 -060085 LINK="$D$systemd_system_unitdir/obmc-chassis-poweron@${i}.target.requires/phosphor-chassis-check-power-status@${i}.service"
86 rm $LINK
Patrick Williams4040b542022-04-20 16:35:25 -050087 done
88}
Patrick Williams4c7b3e62022-03-09 15:56:34 -060089
Patrick Williams4040b542022-04-20 16:35:25 -050090pkg_postinst:${PN}-host:append() {
91 for i in ${OBMC_HOST_INSTANCES};
92 do
93 mkdir -p $D$systemd_system_unitdir/multi-user.target.requires
94 LINK="$D$systemd_system_unitdir/multi-user.target.requires/xyz.openbmc_project.State.Host@${i}.service"
95 TARGET="../xyz.openbmc_project.State.Host@.service"
96 ln -s $TARGET $LINK
Patrick Williams4c7b3e62022-03-09 15:56:34 -060097 done
Andrew Geisslera02a18a2022-02-21 23:00:20 +000098}
Patrick Williamsad7adea2022-04-20 13:48:37 -050099
100pkg_prerm:${PN}-host:append() {
101 for i in ${OBMC_HOST_INSTANCES};
102 do
Patrick Williamsad7adea2022-04-20 13:48:37 -0500103 LINK="$D$systemd_system_unitdir/multi-user.target.requires/xyz.openbmc_project.State.Host@${i}.service"
104 rm $LINK
Patrick Williamsad7adea2022-04-20 13:48:37 -0500105 done
106}