blob: 37932b4b9dd5df622e748bbb0e45375d98b186f8 [file] [log] [blame]
Patrick Williams4c7b3e62022-03-09 15:56:34 -06001
2# TODO: There are some targets that are chassis oriented, but there is no
3# obvious way to map HOST<->CHASSIS relationships. Making an assumption
4# currently that there is a 1-to-1 relationship between the two.
5
Patrick Williams12fc9392021-08-06 09:16:53 -05006pkg_postinst:${PN}-obmc-targets:append() {
Andrew Geissler20cff702020-03-09 16:51:27 -05007
Patrick Williams4c7b3e62022-03-09 15:56:34 -06008 for i in ${OBMC_HOST_INSTANCES};
9 do
10 mkdir -p $D$systemd_system_unitdir/multi-user.target.requires
Andrew Geisslere1900162022-03-25 16:10:13 +000011 LINK="$D$systemd_system_unitdir/multi-user.target.requires/xyz.openbmc_project.State.Host@${i}.service"
12 TARGET="../xyz.openbmc_project.State.Host@.service"
13 ln -s $TARGET $LINK
14
Patrick Williams4c7b3e62022-03-09 15:56:34 -060015 LINK="$D$systemd_system_unitdir/multi-user.target.requires/obmc-host-reset@${i}.target"
16 TARGET="../obmc-host-reset@.target"
17 ln -s $TARGET $LINK
Andrew Geissler20cff702020-03-09 16:51:27 -050018
Patrick Williams4c7b3e62022-03-09 15:56:34 -060019 LINK="$D$systemd_system_unitdir/multi-user.target.requires/phosphor-discover-system-state@${i}.service"
20 TARGET="../phosphor-discover-system-state@.service"
21 ln -s $TARGET $LINK
Andrew Geissler20cff702020-03-09 16:51:27 -050022
Patrick Williams4c7b3e62022-03-09 15:56:34 -060023 LINK="$D$systemd_system_unitdir/obmc-bmc-service-quiesce@${i}.target"
24 TARGET="./obmc-bmc-service-quiesce@.target"
25 ln -s $TARGET $LINK
Andrew Geissler77c01262022-02-25 19:30:14 +000026
Patrick Williams4c7b3e62022-03-09 15:56:34 -060027 mkdir -p $D$systemd_system_unitdir/obmc-chassis-poweron@${i}.target.wants
28 LINK="$D$systemd_system_unitdir/obmc-chassis-poweron@${i}.target.wants/phosphor-reset-host-recovery@${i}.service"
29 TARGET="../phosphor-reset-host-recovery@.service"
30 ln -s $TARGET $LINK
Andrew Geissleref50c6a2021-09-17 18:01:30 +000031
Patrick Williams4c7b3e62022-03-09 15:56:34 -060032 mkdir -p $D$systemd_system_unitdir/obmc-host-start@${i}.target.requires
33 LINK="$D$systemd_system_unitdir/obmc-host-start@${i}.target.requires/obmc-host-startmin@${i}.target"
34 TARGET="../obmc-host-startmin@.target"
35 ln -s $TARGET $LINK
Andrew Geissler20cff702020-03-09 16:51:27 -050036
Patrick Williams4c7b3e62022-03-09 15:56:34 -060037 LINK="$D$systemd_system_unitdir/obmc-host-start@${i}.target.requires/phosphor-reset-host-reboot-attempts@${i}.service"
38 TARGET="../phosphor-reset-host-reboot-attempts@.service"
39 ln -s $TARGET $LINK
Andrew Geissler20cff702020-03-09 16:51:27 -050040
Patrick Williams4c7b3e62022-03-09 15:56:34 -060041 mkdir -p $D$systemd_system_unitdir/obmc-host-startmin@${i}.target.wants
42 LINK="$D$systemd_system_unitdir/obmc-host-startmin@${i}.target.wants/phosphor-set-host-transition-to-running@${i}.service"
43 TARGET="../phosphor-set-host-transition-to-running@.service"
44 ln -s $TARGET $LINK
Andrew Geissler4ef0e112021-01-05 16:51:58 -060045
Patrick Williams4c7b3e62022-03-09 15:56:34 -060046 mkdir -p $D$systemd_system_unitdir/obmc-host-stop@${i}.target.wants
47 LINK="$D$systemd_system_unitdir/obmc-host-stop@${i}.target.wants/phosphor-set-host-transition-to-off@${i}.service"
48 TARGET="../phosphor-set-host-transition-to-off@.service"
49 ln -s $TARGET $LINK
Andrew Geissler4ef0e112021-01-05 16:51:58 -060050
Patrick Williams4c7b3e62022-03-09 15:56:34 -060051 mkdir -p $D$systemd_system_unitdir/obmc-host-reset@${i}.target.requires
52 LINK="$D$systemd_system_unitdir/obmc-host-reset@${i}.target.requires/phosphor-reset-host-running@${i}.service"
53 TARGET="../phosphor-reset-host-running@.service"
54 ln -s $TARGET $LINK
Andrew Geissler20cff702020-03-09 16:51:27 -050055
Patrick Williams4c7b3e62022-03-09 15:56:34 -060056 mkdir -p $D$systemd_system_unitdir/obmc-host-stop@${i}.target.wants
57 LINK="$D$systemd_system_unitdir/obmc-host-stop@${i}.target.wants/phosphor-reset-sensor-states@${i}.service"
58 TARGET="../phosphor-reset-sensor-states@.service"
59 ln -s $TARGET $LINK
Andrew Geisslerd3f1e5b2020-09-25 09:23:51 -050060
Patrick Williams4c7b3e62022-03-09 15:56:34 -060061 mkdir -p $D$systemd_system_unitdir/obmc-host-quiesce@${i}.target.wants
62 LINK="$D$systemd_system_unitdir/obmc-host-quiesce@${i}.target.wants/phosphor-reset-sensor-states@${i}.service"
63 TARGET="../phosphor-reset-sensor-states@.service"
64 ln -s $TARGET $LINK
Andrew Geissler9c4b92b2020-09-25 14:32:57 -050065
Patrick Williams4c7b3e62022-03-09 15:56:34 -060066 mkdir -p $D$systemd_system_unitdir/obmc-host-shutdown@${i}.target.requires
67 LINK="$D$systemd_system_unitdir/obmc-host-shutdown@${i}.target.requires/obmc-chassis-poweroff@${i}.target"
68 TARGET="../obmc-chassis-poweroff@.target"
69 ln -s $TARGET $LINK
Andrew Geissler20cff702020-03-09 16:51:27 -050070
Patrick Williams4c7b3e62022-03-09 15:56:34 -060071 mkdir -p $D$systemd_system_unitdir/obmc-host-reboot@${i}.target.requires
72 LINK="$D$systemd_system_unitdir/obmc-host-reboot@${i}.target.requires/obmc-host-shutdown@${i}.target"
73 TARGET="../obmc-host-shutdown@.target"
74 ln -s $TARGET $LINK
Andrew Geissler20cff702020-03-09 16:51:27 -050075
Patrick Williams4c7b3e62022-03-09 15:56:34 -060076 LINK="$D$systemd_system_unitdir/obmc-host-reboot@${i}.target.requires/phosphor-reboot-host@${i}.service"
77 TARGET="../phosphor-reboot-host@.service"
78 ln -s $TARGET $LINK
Andrew Geissler20cff702020-03-09 16:51:27 -050079
Patrick Williams4c7b3e62022-03-09 15:56:34 -060080 mkdir -p $D$systemd_system_unitdir/obmc-host-warm-reboot@${i}.target.requires
81 LINK="$D$systemd_system_unitdir/obmc-host-warm-reboot@${i}.target.requires/xyz.openbmc_project.Ipmi.Internal.SoftPowerOff.service"
82 TARGET="../xyz.openbmc_project.Ipmi.Internal.SoftPowerOff.service"
83 ln -s $TARGET $LINK
Andrew Geissler20cff702020-03-09 16:51:27 -050084
Patrick Williams4c7b3e62022-03-09 15:56:34 -060085 mkdir -p $D$systemd_system_unitdir/obmc-host-force-warm-reboot@${i}.target.requires
86 LINK="$D$systemd_system_unitdir/obmc-host-force-warm-reboot@${i}.target.requires/obmc-host-stop@${i}.target"
87 TARGET="../obmc-host-stop@.target"
88 ln -s $TARGET $LINK
Andrew Geissler20cff702020-03-09 16:51:27 -050089
Patrick Williams4c7b3e62022-03-09 15:56:34 -060090 LINK="$D$systemd_system_unitdir/obmc-host-force-warm-reboot@${i}.target.requires/phosphor-reboot-host@${i}.service"
91 TARGET="../phosphor-reboot-host@.service"
92 ln -s $TARGET $LINK
Andrew Geissler20cff702020-03-09 16:51:27 -050093
Patrick Williams4c7b3e62022-03-09 15:56:34 -060094 LINK="$D$systemd_system_unitdir/obmc-host-warm-reboot@${i}.target.requires/obmc-host-force-warm-reboot@${i}.target"
95 TARGET="../obmc-host-force-warm-reboot@.target"
96 ln -s $TARGET $LINK
Andrew Geissler20cff702020-03-09 16:51:27 -050097
Patrick Williams4c7b3e62022-03-09 15:56:34 -060098 mkdir -p $D$systemd_system_unitdir/obmc-chassis-poweroff@${i}.target.wants
99 LINK="$D$systemd_system_unitdir/obmc-chassis-poweroff@${i}.target.wants/phosphor-clear-one-time@${i}.service"
100 TARGET="../phosphor-clear-one-time@.service"
101 ln -s $TARGET $LINK
102 done
Andrew Geissler20cff702020-03-09 16:51:27 -0500103}
104
Patrick Williams83a7aa92022-04-20 13:48:37 -0500105pkg_postinst:${PN}-chassis:append() {
Patrick Williams954512d2022-04-20 15:01:07 -0500106 for i in ${OBMC_CHASSIS_INSTANCES};
Patrick Williams83a7aa92022-04-20 13:48:37 -0500107 do
108 mkdir -p $D$systemd_system_unitdir/multi-user.target.requires
109
110 LINK="$D$systemd_system_unitdir/multi-user.target.requires/xyz.openbmc_project.State.Chassis@${i}.service"
111 TARGET="../xyz.openbmc_project.State.Chassis@.service"
112 ln -s $TARGET $LINK
Patrick Williams954512d2022-04-20 15:01:07 -0500113
Patrick Williams83a7aa92022-04-20 13:48:37 -0500114 done
115}
116
Andrew Geisslera02a18a2022-02-21 23:00:20 +0000117pkg_postinst:${PN}-chassis-check-power-status:append() {
118
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600119 for i in ${OBMC_HOST_INSTANCES};
120 do
121 mkdir -p $D$systemd_system_unitdir/obmc-chassis-poweron@${i}.target.requires
122 LINK="$D$systemd_system_unitdir/obmc-chassis-poweron@${i}.target.requires/phosphor-chassis-check-power-status@${i}.service"
123 TARGET="../phosphor-chassis-check-power-status@.service"
124 ln -s $TARGET $LINK
125 done
Andrew Geisslera02a18a2022-02-21 23:00:20 +0000126}
127
Patrick Williams12fc9392021-08-06 09:16:53 -0500128pkg_prerm:${PN}-obmc-targets:append() {
Andrew Geissler20cff702020-03-09 16:51:27 -0500129
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600130 for i in ${OBMC_HOST_INSTANCES};
131 do
Andrew Geissler20cff702020-03-09 16:51:27 -0500132
Andrew Geisslere1900162022-03-25 16:10:13 +0000133 LINK="$D$systemd_system_unitdir/multi-user.target.requires/xyz.openbmc_project.State.Host@${i}.service"
134 rm $LINK
135
136 LINK="$D$systemd_system_unitdir/multi-user.target.requires/xyz.openbmc_project.State.Chassis@${i}.service"
137 rm $LINK
138
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600139 LINK="$D$systemd_system_unitdir/multi-user.target.requires/obmc-host-reset@${i}.target"
140 rm $LINK
Andrew Geissler20cff702020-03-09 16:51:27 -0500141
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600142 LINK="$D$systemd_system_unitdir/multi-user.target.requires/phosphor-discover-system-state@${i}.service"
143 rm $LINK
Andrew Geissleref50c6a2021-09-17 18:01:30 +0000144
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600145 LINK="$D$systemd_system_unitdir/obmc-chassis-poweron@${i}.target.wants/phosphor-reset-host-recovery@${i}.service"
146 rm $LINK
Andrew Geissler20cff702020-03-09 16:51:27 -0500147
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600148 LINK="$D$systemd_system_unitdir/obmc-host-start@${i}.target.requires/obmc-host-startmin@${i}.target"
149 rm $LINK
Andrew Geissler20cff702020-03-09 16:51:27 -0500150
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600151 LINK="$D$systemd_system_unitdir/obmc-host-start@${i}.target.requires/phosphor-reset-host-reboot-attempts@${i}.service"
152 rm $LINK
Andrew Geissler4ef0e112021-01-05 16:51:58 -0600153
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600154 LINK="$D$systemd_system_unitdir/obmc-host-startmin@${i}.target.wants/phosphor-set-host-transition-to-running@${i}.service"
155 rm $LINK
Andrew Geissler4ef0e112021-01-05 16:51:58 -0600156
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600157 LINK="$D$systemd_system_unitdir/obmc-host-stop@${i}.target.wants/phosphor-set-host-transition-to-off@${i}.service"
158 rm $LINK
Andrew Geisslerd3f1e5b2020-09-25 09:23:51 -0500159
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600160 LINK="$D$systemd_system_unitdir/obmc-host-stop@${i}.target.wants/phosphor-reset-sensor-states@${i}.service"
161 rm $LINK
Andrew Geissler9c4b92b2020-09-25 14:32:57 -0500162
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600163 LINK="$D$systemd_system_unitdir/obmc-host-quiesce@${i}.target.wants/phosphor-reset-sensor-states@${i}.service"
164 rm $LINK
Andrew Geissler20cff702020-03-09 16:51:27 -0500165
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600166 LINK="$D$systemd_system_unitdir/obmc-host-reset@${i}.target.requires/phosphor-reset-host-running@${i}.service"
167 rm $LINK
Andrew Geissler20cff702020-03-09 16:51:27 -0500168
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600169 LINK="$D$systemd_system_unitdir/obmc-host-shutdown@${i}.target.requires/obmc-chassis-poweroff@${i}.target"
170 rm $LINK
Andrew Geissler20cff702020-03-09 16:51:27 -0500171
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600172 LINK="$D$systemd_system_unitdir/obmc-host-reboot@${i}.target.requires/obmc-host-shutdown@${i}.target"
173 rm $LINK
Andrew Geissler20cff702020-03-09 16:51:27 -0500174
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600175 LINK="$D$systemd_system_unitdir/obmc-host-reboot@${i}.target.requires/phosphor-reboot-host@${i}.service"
176 rm $LINK
Andrew Geissler20cff702020-03-09 16:51:27 -0500177
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600178 LINK="$D$systemd_system_unitdir/obmc-host-warm-reboot@${i}.target.requires/xyz.openbmc_project.Ipmi.Internal.SoftPowerOff.service"
179 rm $LINK
Andrew Geissler20cff702020-03-09 16:51:27 -0500180
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600181 LINK="$D$systemd_system_unitdir/obmc-host-force-warm-reboot@${i}.target.requires/obmc-host-stop@${i}.target"
182 rm $LINK
Andrew Geissler20cff702020-03-09 16:51:27 -0500183
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600184 LINK="$D$systemd_system_unitdir/obmc-host-force-warm-reboot@${i}.target.requires/phosphor-reboot-host@${i}.service"
185 rm $LINK
Andrew Geissler20cff702020-03-09 16:51:27 -0500186
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600187 LINK="$D$systemd_system_unitdir/obmc-host-warm-reboot@${i}.target.requires/obmc-host-force-warm-reboot@${i}.target"
188 rm $LINK
189
190 LINK="$D$systemd_system_unitdir/obmc-chassis-poweroff@${i}.target.wants/phosphor-clear-one-time@${i}.service"
191 rm $LINK
192
193 done
Andrew Geissler20cff702020-03-09 16:51:27 -0500194}
Andrew Geisslera02a18a2022-02-21 23:00:20 +0000195
Patrick Williams83a7aa92022-04-20 13:48:37 -0500196pkg_prerm:${PN}-chassis:append() {
Patrick Williams954512d2022-04-20 15:01:07 -0500197 for i in ${OBMC_CHASSIS_INSTANCES};
Patrick Williams83a7aa92022-04-20 13:48:37 -0500198 do
199
200 LINK="$D$systemd_system_unitdir/multi-user.target.requires/xyz.openbmc_project.State.Chassis@${i}.service"
201 rm $LINK
202
203 done
204}
205
Andrew Geisslera02a18a2022-02-21 23:00:20 +0000206pkg_prerm:${PN}-chassis-check-power-status:append() {
207
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600208 for i in ${OBMC_HOST_INSTANCES};
209 do
210
211 LINK="$D$systemd_system_unitdir/obmc-chassis-poweron@${i}.target.requires/phosphor-chassis-check-power-status@${i}.service"
212 rm $LINK
213
214 done
Andrew Geisslera02a18a2022-02-21 23:00:20 +0000215}