blob: aa0dc0ebf892e5edb9457bbe9c694a7f533312dd [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() {
106 for i in ${OBMC_HOST_INSTANCES};
107 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
113 done
114}
115
Andrew Geisslera02a18a2022-02-21 23:00:20 +0000116pkg_postinst:${PN}-chassis-check-power-status:append() {
117
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600118 for i in ${OBMC_HOST_INSTANCES};
119 do
120 mkdir -p $D$systemd_system_unitdir/obmc-chassis-poweron@${i}.target.requires
121 LINK="$D$systemd_system_unitdir/obmc-chassis-poweron@${i}.target.requires/phosphor-chassis-check-power-status@${i}.service"
122 TARGET="../phosphor-chassis-check-power-status@.service"
123 ln -s $TARGET $LINK
124 done
Andrew Geisslera02a18a2022-02-21 23:00:20 +0000125}
126
Patrick Williams12fc9392021-08-06 09:16:53 -0500127pkg_prerm:${PN}-obmc-targets:append() {
Andrew Geissler20cff702020-03-09 16:51:27 -0500128
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600129 for i in ${OBMC_HOST_INSTANCES};
130 do
Andrew Geissler20cff702020-03-09 16:51:27 -0500131
Andrew Geisslere1900162022-03-25 16:10:13 +0000132 LINK="$D$systemd_system_unitdir/multi-user.target.requires/xyz.openbmc_project.State.Host@${i}.service"
133 rm $LINK
134
135 LINK="$D$systemd_system_unitdir/multi-user.target.requires/xyz.openbmc_project.State.Chassis@${i}.service"
136 rm $LINK
137
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600138 LINK="$D$systemd_system_unitdir/multi-user.target.requires/obmc-host-reset@${i}.target"
139 rm $LINK
Andrew Geissler20cff702020-03-09 16:51:27 -0500140
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600141 LINK="$D$systemd_system_unitdir/multi-user.target.requires/phosphor-discover-system-state@${i}.service"
142 rm $LINK
Andrew Geissleref50c6a2021-09-17 18:01:30 +0000143
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600144 LINK="$D$systemd_system_unitdir/obmc-chassis-poweron@${i}.target.wants/phosphor-reset-host-recovery@${i}.service"
145 rm $LINK
Andrew Geissler20cff702020-03-09 16:51:27 -0500146
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600147 LINK="$D$systemd_system_unitdir/obmc-host-start@${i}.target.requires/obmc-host-startmin@${i}.target"
148 rm $LINK
Andrew Geissler20cff702020-03-09 16:51:27 -0500149
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600150 LINK="$D$systemd_system_unitdir/obmc-host-start@${i}.target.requires/phosphor-reset-host-reboot-attempts@${i}.service"
151 rm $LINK
Andrew Geissler4ef0e112021-01-05 16:51:58 -0600152
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600153 LINK="$D$systemd_system_unitdir/obmc-host-startmin@${i}.target.wants/phosphor-set-host-transition-to-running@${i}.service"
154 rm $LINK
Andrew Geissler4ef0e112021-01-05 16:51:58 -0600155
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600156 LINK="$D$systemd_system_unitdir/obmc-host-stop@${i}.target.wants/phosphor-set-host-transition-to-off@${i}.service"
157 rm $LINK
Andrew Geisslerd3f1e5b2020-09-25 09:23:51 -0500158
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600159 LINK="$D$systemd_system_unitdir/obmc-host-stop@${i}.target.wants/phosphor-reset-sensor-states@${i}.service"
160 rm $LINK
Andrew Geissler9c4b92b2020-09-25 14:32:57 -0500161
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600162 LINK="$D$systemd_system_unitdir/obmc-host-quiesce@${i}.target.wants/phosphor-reset-sensor-states@${i}.service"
163 rm $LINK
Andrew Geissler20cff702020-03-09 16:51:27 -0500164
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600165 LINK="$D$systemd_system_unitdir/obmc-host-reset@${i}.target.requires/phosphor-reset-host-running@${i}.service"
166 rm $LINK
Andrew Geissler20cff702020-03-09 16:51:27 -0500167
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600168 LINK="$D$systemd_system_unitdir/obmc-host-shutdown@${i}.target.requires/obmc-chassis-poweroff@${i}.target"
169 rm $LINK
Andrew Geissler20cff702020-03-09 16:51:27 -0500170
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600171 LINK="$D$systemd_system_unitdir/obmc-host-reboot@${i}.target.requires/obmc-host-shutdown@${i}.target"
172 rm $LINK
Andrew Geissler20cff702020-03-09 16:51:27 -0500173
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600174 LINK="$D$systemd_system_unitdir/obmc-host-reboot@${i}.target.requires/phosphor-reboot-host@${i}.service"
175 rm $LINK
Andrew Geissler20cff702020-03-09 16:51:27 -0500176
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600177 LINK="$D$systemd_system_unitdir/obmc-host-warm-reboot@${i}.target.requires/xyz.openbmc_project.Ipmi.Internal.SoftPowerOff.service"
178 rm $LINK
Andrew Geissler20cff702020-03-09 16:51:27 -0500179
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600180 LINK="$D$systemd_system_unitdir/obmc-host-force-warm-reboot@${i}.target.requires/obmc-host-stop@${i}.target"
181 rm $LINK
Andrew Geissler20cff702020-03-09 16:51:27 -0500182
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600183 LINK="$D$systemd_system_unitdir/obmc-host-force-warm-reboot@${i}.target.requires/phosphor-reboot-host@${i}.service"
184 rm $LINK
Andrew Geissler20cff702020-03-09 16:51:27 -0500185
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600186 LINK="$D$systemd_system_unitdir/obmc-host-warm-reboot@${i}.target.requires/obmc-host-force-warm-reboot@${i}.target"
187 rm $LINK
188
189 LINK="$D$systemd_system_unitdir/obmc-chassis-poweroff@${i}.target.wants/phosphor-clear-one-time@${i}.service"
190 rm $LINK
191
192 done
Andrew Geissler20cff702020-03-09 16:51:27 -0500193}
Andrew Geisslera02a18a2022-02-21 23:00:20 +0000194
Patrick Williams83a7aa92022-04-20 13:48:37 -0500195pkg_prerm:${PN}-chassis:append() {
196 for i in ${OBMC_HOST_INSTANCES};
197 do
198
199 LINK="$D$systemd_system_unitdir/multi-user.target.requires/xyz.openbmc_project.State.Chassis@${i}.service"
200 rm $LINK
201
202 done
203}
204
Andrew Geisslera02a18a2022-02-21 23:00:20 +0000205pkg_prerm:${PN}-chassis-check-power-status:append() {
206
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600207 for i in ${OBMC_HOST_INSTANCES};
208 do
209
210 LINK="$D$systemd_system_unitdir/obmc-chassis-poweron@${i}.target.requires/phosphor-chassis-check-power-status@${i}.service"
211 rm $LINK
212
213 done
Andrew Geisslera02a18a2022-02-21 23:00:20 +0000214}