blob: 7e142e7ae3c50b434d45ef308cbbacb17b482c61 [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 \
Andrew Geisslerb5138ed2022-11-11 14:00:30 -06005 obmc-chassis-poweron@{}.target.requires/obmc-power-start@{}.service \
6 obmc-chassis-poweroff@{}.target.requires/obmc-power-stop@{}.service \
7 obmc-chassis-poweroff@{}.target.requires/obmc-powered-off@{}.service \
Patrick Williams3952f8b2022-04-20 16:25:53 -05008 obmc-host-start@{}.target.requires/obmc-host-startmin@{}.target \
9 obmc-host-start@{}.target.requires/phosphor-reset-host-reboot-attempts@{}.service \
10 obmc-host-startmin@{}.target.wants/phosphor-set-host-transition-to-running@{}.service \
11 obmc-host-stop@{}.target.wants/phosphor-set-host-transition-to-off@{}.service \
12 obmc-host-reset@{}.target.requires/phosphor-reset-host-running@{}.service \
13 obmc-host-stop@{}.target.wants/phosphor-reset-sensor-states@{}.service \
Andrew Geissler73f93652022-04-15 13:32:04 -050014 obmc-host-graceful-quiesce@{}.target.wants/obmc-host-quiesce@{}.target \
15 obmc-host-graceful-quiesce@{}.target.wants/pldmSoftPowerOff.service \
Patrick Williams3952f8b2022-04-20 16:25:53 -050016 obmc-host-quiesce@{}.target.wants/phosphor-reset-sensor-states@{}.service \
17 obmc-host-shutdown@{}.target.requires/obmc-chassis-poweroff@{}.target \
18 obmc-host-reboot@{}.target.requires/obmc-host-shutdown@{}.target \
19 obmc-host-reboot@{}.target.requires/phosphor-reboot-host@{}.service \
20 obmc-host-warm-reboot@{}.target.requires/xyz.openbmc_project.Ipmi.Internal.SoftPowerOff.service \
21 obmc-host-force-warm-reboot@{}.target.requires/obmc-host-stop@{}.target \
22 obmc-host-force-warm-reboot@{}.target.requires/phosphor-reboot-host@{}.service \
23 obmc-host-warm-reboot@{}.target.requires/obmc-host-force-warm-reboot@{}.target \
24 obmc-chassis-poweroff@{}.target.wants/phosphor-clear-one-time@{}.service \
Andrew Geisslere0ba7fb2022-07-06 14:51:03 -050025 obmc-chassis-blackout@{}.target.wants/phosphor-reset-sensor-states@{}.service \
Thu Nguyen1859f252022-12-29 11:21:48 +070026 obmc-chassis-powerreset@{}.target.requires/phosphor-reset-chassis-on@{}.service \
27 obmc-chassis-powerreset@{}.target.requires/phosphor-reset-chassis-running@{}.service \
Patrick Williams3952f8b2022-04-20 16:25:53 -050028"
Patrick Williams4c7b3e62022-03-09 15:56:34 -060029
30# TODO: There are some targets that are chassis oriented, but there is no
31# obvious way to map HOST<->CHASSIS relationships. Making an assumption
32# currently that there is a 1-to-1 relationship between the two.
33
Patrick Williams12fc9392021-08-06 09:16:53 -050034pkg_postinst:${PN}-obmc-targets:append() {
Patrick Williams4c7b3e62022-03-09 15:56:34 -060035 for i in ${OBMC_HOST_INSTANCES};
36 do
Patrick Williams3952f8b2022-04-20 16:25:53 -050037 for j in ${DEFAULT_TARGETS};
38 do
39 LINK="$D$systemd_system_unitdir/${j}"
40 LINK="$(echo ${LINK} | sed s/{}/${i}/g )"
41 TARGET="../$(basename ${j} | sed s/{}//g )"
42 mkdir -p "$(dirname ${LINK})"
43 ln -s "${TARGET}" "${LINK}"
44 done
Patrick Williams4c7b3e62022-03-09 15:56:34 -060045 done
Andrew Geissler20cff702020-03-09 16:51:27 -050046}
47
Patrick Williams12fc9392021-08-06 09:16:53 -050048pkg_prerm:${PN}-obmc-targets:append() {
Patrick Williams4c7b3e62022-03-09 15:56:34 -060049 for i in ${OBMC_HOST_INSTANCES};
50 do
Patrick Williams3952f8b2022-04-20 16:25:53 -050051 for j in ${DEFAULT_TARGETS};
52 do
53 LINK="$D$systemd_system_unitdir/${j}"
54 LINK="$(echo ${LINK} | sed s/{}/${i}/g )"
55 rm "${LINK}"
56 done
Patrick Williams4c7b3e62022-03-09 15:56:34 -060057 done
Andrew Geissler20cff702020-03-09 16:51:27 -050058}
Andrew Geisslera02a18a2022-02-21 23:00:20 +000059
Patrick Williams4040b542022-04-20 16:35:25 -050060pkg_postinst:${PN}-chassis:append() {
61 for i in ${OBMC_CHASSIS_INSTANCES};
62 do
63 mkdir -p $D$systemd_system_unitdir/multi-user.target.requires
64 LINK="$D$systemd_system_unitdir/multi-user.target.requires/xyz.openbmc_project.State.Chassis@${i}.service"
65 TARGET="../xyz.openbmc_project.State.Chassis@.service"
66 ln -s $TARGET $LINK
67 done
68}
69
Patrick Williams83a7aa92022-04-20 13:48:37 -050070pkg_prerm:${PN}-chassis:append() {
Patrick Williams954512d2022-04-20 15:01:07 -050071 for i in ${OBMC_CHASSIS_INSTANCES};
Patrick Williams83a7aa92022-04-20 13:48:37 -050072 do
Patrick Williams83a7aa92022-04-20 13:48:37 -050073 LINK="$D$systemd_system_unitdir/multi-user.target.requires/xyz.openbmc_project.State.Chassis@${i}.service"
74 rm $LINK
Patrick Williams4040b542022-04-20 16:35:25 -050075 done
76}
Patrick Williams83a7aa92022-04-20 13:48:37 -050077
Patrick Williams4040b542022-04-20 16:35:25 -050078pkg_postinst:${PN}-chassis-check-power-status:append() {
79 for i in ${OBMC_HOST_INSTANCES};
80 do
81 mkdir -p $D$systemd_system_unitdir/obmc-chassis-poweron@${i}.target.requires
82 LINK="$D$systemd_system_unitdir/obmc-chassis-poweron@${i}.target.requires/phosphor-chassis-check-power-status@${i}.service"
83 TARGET="../phosphor-chassis-check-power-status@.service"
84 ln -s $TARGET $LINK
Patrick Williams83a7aa92022-04-20 13:48:37 -050085 done
86}
87
Andrew Geisslera02a18a2022-02-21 23:00:20 +000088pkg_prerm:${PN}-chassis-check-power-status:append() {
Patrick Williams4c7b3e62022-03-09 15:56:34 -060089 for i in ${OBMC_HOST_INSTANCES};
90 do
Patrick Williams4c7b3e62022-03-09 15:56:34 -060091 LINK="$D$systemd_system_unitdir/obmc-chassis-poweron@${i}.target.requires/phosphor-chassis-check-power-status@${i}.service"
92 rm $LINK
Patrick Williams4040b542022-04-20 16:35:25 -050093 done
94}
Patrick Williams4c7b3e62022-03-09 15:56:34 -060095
Patrick Williams4040b542022-04-20 16:35:25 -050096pkg_postinst:${PN}-host:append() {
97 for i in ${OBMC_HOST_INSTANCES};
98 do
99 mkdir -p $D$systemd_system_unitdir/multi-user.target.requires
100 LINK="$D$systemd_system_unitdir/multi-user.target.requires/xyz.openbmc_project.State.Host@${i}.service"
101 TARGET="../xyz.openbmc_project.State.Host@.service"
102 ln -s $TARGET $LINK
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600103 done
Andrew Geisslera02a18a2022-02-21 23:00:20 +0000104}
Patrick Williamsad7adea2022-04-20 13:48:37 -0500105
106pkg_prerm:${PN}-host:append() {
107 for i in ${OBMC_HOST_INSTANCES};
108 do
Patrick Williamsad7adea2022-04-20 13:48:37 -0500109 LINK="$D$systemd_system_unitdir/multi-user.target.requires/xyz.openbmc_project.State.Host@${i}.service"
110 rm $LINK
Patrick Williamsad7adea2022-04-20 13:48:37 -0500111 done
112}