blob: 52bbb05b75c200b19a1f68568889e43d489224ee [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() {
Andrew Geissler20cff702020-03-09 16:51:27 -050027
Patrick Williams4c7b3e62022-03-09 15:56:34 -060028 for i in ${OBMC_HOST_INSTANCES};
29 do
Patrick Williams3952f8b2022-04-20 16:25:53 -050030 for j in ${DEFAULT_TARGETS};
31 do
32 LINK="$D$systemd_system_unitdir/${j}"
33 LINK="$(echo ${LINK} | sed s/{}/${i}/g )"
34 TARGET="../$(basename ${j} | sed s/{}//g )"
35 mkdir -p "$(dirname ${LINK})"
36 ln -s "${TARGET}" "${LINK}"
37 done
Patrick Williams4c7b3e62022-03-09 15:56:34 -060038 done
Andrew Geissler20cff702020-03-09 16:51:27 -050039}
40
Patrick Williams83a7aa92022-04-20 13:48:37 -050041pkg_postinst:${PN}-chassis:append() {
Patrick Williams954512d2022-04-20 15:01:07 -050042 for i in ${OBMC_CHASSIS_INSTANCES};
Patrick Williams83a7aa92022-04-20 13:48:37 -050043 do
44 mkdir -p $D$systemd_system_unitdir/multi-user.target.requires
45
46 LINK="$D$systemd_system_unitdir/multi-user.target.requires/xyz.openbmc_project.State.Chassis@${i}.service"
47 TARGET="../xyz.openbmc_project.State.Chassis@.service"
48 ln -s $TARGET $LINK
Patrick Williams954512d2022-04-20 15:01:07 -050049
Patrick Williams83a7aa92022-04-20 13:48:37 -050050 done
51}
52
Andrew Geisslera02a18a2022-02-21 23:00:20 +000053pkg_postinst:${PN}-chassis-check-power-status:append() {
54
Patrick Williams4c7b3e62022-03-09 15:56:34 -060055 for i in ${OBMC_HOST_INSTANCES};
56 do
57 mkdir -p $D$systemd_system_unitdir/obmc-chassis-poweron@${i}.target.requires
58 LINK="$D$systemd_system_unitdir/obmc-chassis-poweron@${i}.target.requires/phosphor-chassis-check-power-status@${i}.service"
59 TARGET="../phosphor-chassis-check-power-status@.service"
60 ln -s $TARGET $LINK
61 done
Andrew Geisslera02a18a2022-02-21 23:00:20 +000062}
63
Patrick Williamsad7adea2022-04-20 13:48:37 -050064pkg_postinst:${PN}-host:append() {
65 for i in ${OBMC_HOST_INSTANCES};
66 do
67 mkdir -p $D$systemd_system_unitdir/multi-user.target.requires
68
69 LINK="$D$systemd_system_unitdir/multi-user.target.requires/xyz.openbmc_project.State.Host@${i}.service"
70 TARGET="../xyz.openbmc_project.State.Host@.service"
71 ln -s $TARGET $LINK
72
73 done
74}
75
Patrick Williams12fc9392021-08-06 09:16:53 -050076pkg_prerm:${PN}-obmc-targets:append() {
Andrew Geissler20cff702020-03-09 16:51:27 -050077
Patrick Williams4c7b3e62022-03-09 15:56:34 -060078 for i in ${OBMC_HOST_INSTANCES};
79 do
Patrick Williams3952f8b2022-04-20 16:25:53 -050080 for j in ${DEFAULT_TARGETS};
81 do
82 LINK="$D$systemd_system_unitdir/${j}"
83 LINK="$(echo ${LINK} | sed s/{}/${i}/g )"
84 rm "${LINK}"
85 done
Patrick Williams4c7b3e62022-03-09 15:56:34 -060086 done
Andrew Geissler20cff702020-03-09 16:51:27 -050087}
Andrew Geisslera02a18a2022-02-21 23:00:20 +000088
Patrick Williams83a7aa92022-04-20 13:48:37 -050089pkg_prerm:${PN}-chassis:append() {
Patrick Williams954512d2022-04-20 15:01:07 -050090 for i in ${OBMC_CHASSIS_INSTANCES};
Patrick Williams83a7aa92022-04-20 13:48:37 -050091 do
92
93 LINK="$D$systemd_system_unitdir/multi-user.target.requires/xyz.openbmc_project.State.Chassis@${i}.service"
94 rm $LINK
95
96 done
97}
98
Andrew Geisslera02a18a2022-02-21 23:00:20 +000099pkg_prerm:${PN}-chassis-check-power-status:append() {
100
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600101 for i in ${OBMC_HOST_INSTANCES};
102 do
103
104 LINK="$D$systemd_system_unitdir/obmc-chassis-poweron@${i}.target.requires/phosphor-chassis-check-power-status@${i}.service"
105 rm $LINK
106
107 done
Andrew Geisslera02a18a2022-02-21 23:00:20 +0000108}
Patrick Williamsad7adea2022-04-20 13:48:37 -0500109
110pkg_prerm:${PN}-host:append() {
111 for i in ${OBMC_HOST_INSTANCES};
112 do
113
114 LINK="$D$systemd_system_unitdir/multi-user.target.requires/xyz.openbmc_project.State.Host@${i}.service"
115 rm $LINK
116
117 done
118}