blob: 6b0bda0ac7bf6ee534de69b5f1a3b50772e46b50 [file] [log] [blame]
Patrick Williams3952f8b2022-04-20 16:25:53 -05001DEFAULT_TARGETS = " \
2 multi-user.target.requires/xyz.openbmc_project.State.Host@{}.service \
3 multi-user.target.requires/obmc-host-reset@{}.target \
4 multi-user.target.requires/phosphor-discover-system-state@{}.service \
5 obmc-chassis-poweron@{}.target.wants/phosphor-reset-host-recovery@{}.service \
6 obmc-host-start@{}.target.requires/obmc-host-startmin@{}.target \
7 obmc-host-start@{}.target.requires/phosphor-reset-host-reboot-attempts@{}.service \
8 obmc-host-startmin@{}.target.wants/phosphor-set-host-transition-to-running@{}.service \
9 obmc-host-stop@{}.target.wants/phosphor-set-host-transition-to-off@{}.service \
10 obmc-host-reset@{}.target.requires/phosphor-reset-host-running@{}.service \
11 obmc-host-stop@{}.target.wants/phosphor-reset-sensor-states@{}.service \
12 obmc-host-quiesce@{}.target.wants/phosphor-reset-sensor-states@{}.service \
13 obmc-host-shutdown@{}.target.requires/obmc-chassis-poweroff@{}.target \
14 obmc-host-reboot@{}.target.requires/obmc-host-shutdown@{}.target \
15 obmc-host-reboot@{}.target.requires/phosphor-reboot-host@{}.service \
16 obmc-host-warm-reboot@{}.target.requires/xyz.openbmc_project.Ipmi.Internal.SoftPowerOff.service \
17 obmc-host-force-warm-reboot@{}.target.requires/obmc-host-stop@{}.target \
18 obmc-host-force-warm-reboot@{}.target.requires/phosphor-reboot-host@{}.service \
19 obmc-host-warm-reboot@{}.target.requires/obmc-host-force-warm-reboot@{}.target \
20 obmc-chassis-poweroff@{}.target.wants/phosphor-clear-one-time@{}.service \
21"
Patrick Williams4c7b3e62022-03-09 15:56:34 -060022
23# TODO: There are some targets that are chassis oriented, but there is no
24# obvious way to map HOST<->CHASSIS relationships. Making an assumption
25# currently that there is a 1-to-1 relationship between the two.
26
Patrick Williams12fc9392021-08-06 09:16:53 -050027pkg_postinst:${PN}-obmc-targets:append() {
Andrew Geissler20cff702020-03-09 16:51:27 -050028
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 Williams83a7aa92022-04-20 13:48:37 -050042pkg_postinst:${PN}-chassis:append() {
Patrick Williams954512d2022-04-20 15:01:07 -050043 for i in ${OBMC_CHASSIS_INSTANCES};
Patrick Williams83a7aa92022-04-20 13:48:37 -050044 do
45 mkdir -p $D$systemd_system_unitdir/multi-user.target.requires
46
47 LINK="$D$systemd_system_unitdir/multi-user.target.requires/xyz.openbmc_project.State.Chassis@${i}.service"
48 TARGET="../xyz.openbmc_project.State.Chassis@.service"
49 ln -s $TARGET $LINK
Patrick Williams954512d2022-04-20 15:01:07 -050050
Patrick Williams83a7aa92022-04-20 13:48:37 -050051 done
52}
53
Andrew Geisslera02a18a2022-02-21 23:00:20 +000054pkg_postinst:${PN}-chassis-check-power-status:append() {
55
Patrick Williams4c7b3e62022-03-09 15:56:34 -060056 for i in ${OBMC_HOST_INSTANCES};
57 do
58 mkdir -p $D$systemd_system_unitdir/obmc-chassis-poweron@${i}.target.requires
59 LINK="$D$systemd_system_unitdir/obmc-chassis-poweron@${i}.target.requires/phosphor-chassis-check-power-status@${i}.service"
60 TARGET="../phosphor-chassis-check-power-status@.service"
61 ln -s $TARGET $LINK
62 done
Andrew Geisslera02a18a2022-02-21 23:00:20 +000063}
64
Patrick Williams12fc9392021-08-06 09:16:53 -050065pkg_prerm:${PN}-obmc-targets:append() {
Andrew Geissler20cff702020-03-09 16:51:27 -050066
Patrick Williams4c7b3e62022-03-09 15:56:34 -060067 for i in ${OBMC_HOST_INSTANCES};
68 do
Patrick Williams3952f8b2022-04-20 16:25:53 -050069 for j in ${DEFAULT_TARGETS};
70 do
71 LINK="$D$systemd_system_unitdir/${j}"
72 LINK="$(echo ${LINK} | sed s/{}/${i}/g )"
73 rm "${LINK}"
74 done
Patrick Williams4c7b3e62022-03-09 15:56:34 -060075 done
Andrew Geissler20cff702020-03-09 16:51:27 -050076}
Andrew Geisslera02a18a2022-02-21 23:00:20 +000077
Patrick Williams83a7aa92022-04-20 13:48:37 -050078pkg_prerm:${PN}-chassis:append() {
Patrick Williams954512d2022-04-20 15:01:07 -050079 for i in ${OBMC_CHASSIS_INSTANCES};
Patrick Williams83a7aa92022-04-20 13:48:37 -050080 do
81
82 LINK="$D$systemd_system_unitdir/multi-user.target.requires/xyz.openbmc_project.State.Chassis@${i}.service"
83 rm $LINK
84
85 done
86}
87
Andrew Geisslera02a18a2022-02-21 23:00:20 +000088pkg_prerm:${PN}-chassis-check-power-status:append() {
89
Patrick Williams4c7b3e62022-03-09 15:56:34 -060090 for i in ${OBMC_HOST_INSTANCES};
91 do
92
93 LINK="$D$systemd_system_unitdir/obmc-chassis-poweron@${i}.target.requires/phosphor-chassis-check-power-status@${i}.service"
94 rm $LINK
95
96 done
Andrew Geisslera02a18a2022-02-21 23:00:20 +000097}