blob: e716c722766c854cc471bbeea5dba92587d2ec39 [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 mkdir -p $D$systemd_system_unitdir/obmc-chassis-poweron@${i}.target.wants
24 LINK="$D$systemd_system_unitdir/obmc-chassis-poweron@${i}.target.wants/phosphor-reset-host-recovery@${i}.service"
25 TARGET="../phosphor-reset-host-recovery@.service"
26 ln -s $TARGET $LINK
Andrew Geissleref50c6a2021-09-17 18:01:30 +000027
Patrick Williams4c7b3e62022-03-09 15:56:34 -060028 mkdir -p $D$systemd_system_unitdir/obmc-host-start@${i}.target.requires
29 LINK="$D$systemd_system_unitdir/obmc-host-start@${i}.target.requires/obmc-host-startmin@${i}.target"
30 TARGET="../obmc-host-startmin@.target"
31 ln -s $TARGET $LINK
Andrew Geissler20cff702020-03-09 16:51:27 -050032
Patrick Williams4c7b3e62022-03-09 15:56:34 -060033 LINK="$D$systemd_system_unitdir/obmc-host-start@${i}.target.requires/phosphor-reset-host-reboot-attempts@${i}.service"
34 TARGET="../phosphor-reset-host-reboot-attempts@.service"
35 ln -s $TARGET $LINK
Andrew Geissler20cff702020-03-09 16:51:27 -050036
Patrick Williams4c7b3e62022-03-09 15:56:34 -060037 mkdir -p $D$systemd_system_unitdir/obmc-host-startmin@${i}.target.wants
38 LINK="$D$systemd_system_unitdir/obmc-host-startmin@${i}.target.wants/phosphor-set-host-transition-to-running@${i}.service"
39 TARGET="../phosphor-set-host-transition-to-running@.service"
40 ln -s $TARGET $LINK
Andrew Geissler4ef0e112021-01-05 16:51:58 -060041
Patrick Williams4c7b3e62022-03-09 15:56:34 -060042 mkdir -p $D$systemd_system_unitdir/obmc-host-stop@${i}.target.wants
43 LINK="$D$systemd_system_unitdir/obmc-host-stop@${i}.target.wants/phosphor-set-host-transition-to-off@${i}.service"
44 TARGET="../phosphor-set-host-transition-to-off@.service"
45 ln -s $TARGET $LINK
Andrew Geissler4ef0e112021-01-05 16:51:58 -060046
Patrick Williams4c7b3e62022-03-09 15:56:34 -060047 mkdir -p $D$systemd_system_unitdir/obmc-host-reset@${i}.target.requires
48 LINK="$D$systemd_system_unitdir/obmc-host-reset@${i}.target.requires/phosphor-reset-host-running@${i}.service"
49 TARGET="../phosphor-reset-host-running@.service"
50 ln -s $TARGET $LINK
Andrew Geissler20cff702020-03-09 16:51:27 -050051
Patrick Williams4c7b3e62022-03-09 15:56:34 -060052 mkdir -p $D$systemd_system_unitdir/obmc-host-stop@${i}.target.wants
53 LINK="$D$systemd_system_unitdir/obmc-host-stop@${i}.target.wants/phosphor-reset-sensor-states@${i}.service"
54 TARGET="../phosphor-reset-sensor-states@.service"
55 ln -s $TARGET $LINK
Andrew Geisslerd3f1e5b2020-09-25 09:23:51 -050056
Patrick Williams4c7b3e62022-03-09 15:56:34 -060057 mkdir -p $D$systemd_system_unitdir/obmc-host-quiesce@${i}.target.wants
58 LINK="$D$systemd_system_unitdir/obmc-host-quiesce@${i}.target.wants/phosphor-reset-sensor-states@${i}.service"
59 TARGET="../phosphor-reset-sensor-states@.service"
60 ln -s $TARGET $LINK
Andrew Geissler9c4b92b2020-09-25 14:32:57 -050061
Patrick Williams4c7b3e62022-03-09 15:56:34 -060062 mkdir -p $D$systemd_system_unitdir/obmc-host-shutdown@${i}.target.requires
63 LINK="$D$systemd_system_unitdir/obmc-host-shutdown@${i}.target.requires/obmc-chassis-poweroff@${i}.target"
64 TARGET="../obmc-chassis-poweroff@.target"
65 ln -s $TARGET $LINK
Andrew Geissler20cff702020-03-09 16:51:27 -050066
Patrick Williams4c7b3e62022-03-09 15:56:34 -060067 mkdir -p $D$systemd_system_unitdir/obmc-host-reboot@${i}.target.requires
68 LINK="$D$systemd_system_unitdir/obmc-host-reboot@${i}.target.requires/obmc-host-shutdown@${i}.target"
69 TARGET="../obmc-host-shutdown@.target"
70 ln -s $TARGET $LINK
Andrew Geissler20cff702020-03-09 16:51:27 -050071
Patrick Williams4c7b3e62022-03-09 15:56:34 -060072 LINK="$D$systemd_system_unitdir/obmc-host-reboot@${i}.target.requires/phosphor-reboot-host@${i}.service"
73 TARGET="../phosphor-reboot-host@.service"
74 ln -s $TARGET $LINK
Andrew Geissler20cff702020-03-09 16:51:27 -050075
Patrick Williams4c7b3e62022-03-09 15:56:34 -060076 mkdir -p $D$systemd_system_unitdir/obmc-host-warm-reboot@${i}.target.requires
77 LINK="$D$systemd_system_unitdir/obmc-host-warm-reboot@${i}.target.requires/xyz.openbmc_project.Ipmi.Internal.SoftPowerOff.service"
78 TARGET="../xyz.openbmc_project.Ipmi.Internal.SoftPowerOff.service"
79 ln -s $TARGET $LINK
Andrew Geissler20cff702020-03-09 16:51:27 -050080
Patrick Williams4c7b3e62022-03-09 15:56:34 -060081 mkdir -p $D$systemd_system_unitdir/obmc-host-force-warm-reboot@${i}.target.requires
82 LINK="$D$systemd_system_unitdir/obmc-host-force-warm-reboot@${i}.target.requires/obmc-host-stop@${i}.target"
83 TARGET="../obmc-host-stop@.target"
84 ln -s $TARGET $LINK
Andrew Geissler20cff702020-03-09 16:51:27 -050085
Patrick Williams4c7b3e62022-03-09 15:56:34 -060086 LINK="$D$systemd_system_unitdir/obmc-host-force-warm-reboot@${i}.target.requires/phosphor-reboot-host@${i}.service"
87 TARGET="../phosphor-reboot-host@.service"
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-warm-reboot@${i}.target.requires/obmc-host-force-warm-reboot@${i}.target"
91 TARGET="../obmc-host-force-warm-reboot@.target"
92 ln -s $TARGET $LINK
Andrew Geissler20cff702020-03-09 16:51:27 -050093
Patrick Williams4c7b3e62022-03-09 15:56:34 -060094 mkdir -p $D$systemd_system_unitdir/obmc-chassis-poweroff@${i}.target.wants
95 LINK="$D$systemd_system_unitdir/obmc-chassis-poweroff@${i}.target.wants/phosphor-clear-one-time@${i}.service"
96 TARGET="../phosphor-clear-one-time@.service"
97 ln -s $TARGET $LINK
98 done
Andrew Geissler20cff702020-03-09 16:51:27 -050099}
100
Patrick Williams83a7aa92022-04-20 13:48:37 -0500101pkg_postinst:${PN}-chassis:append() {
Patrick Williams954512d2022-04-20 15:01:07 -0500102 for i in ${OBMC_CHASSIS_INSTANCES};
Patrick Williams83a7aa92022-04-20 13:48:37 -0500103 do
104 mkdir -p $D$systemd_system_unitdir/multi-user.target.requires
105
106 LINK="$D$systemd_system_unitdir/multi-user.target.requires/xyz.openbmc_project.State.Chassis@${i}.service"
107 TARGET="../xyz.openbmc_project.State.Chassis@.service"
108 ln -s $TARGET $LINK
Patrick Williams954512d2022-04-20 15:01:07 -0500109
Patrick Williams83a7aa92022-04-20 13:48:37 -0500110 done
111}
112
Andrew Geisslera02a18a2022-02-21 23:00:20 +0000113pkg_postinst:${PN}-chassis-check-power-status:append() {
114
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600115 for i in ${OBMC_HOST_INSTANCES};
116 do
117 mkdir -p $D$systemd_system_unitdir/obmc-chassis-poweron@${i}.target.requires
118 LINK="$D$systemd_system_unitdir/obmc-chassis-poweron@${i}.target.requires/phosphor-chassis-check-power-status@${i}.service"
119 TARGET="../phosphor-chassis-check-power-status@.service"
120 ln -s $TARGET $LINK
121 done
Andrew Geisslera02a18a2022-02-21 23:00:20 +0000122}
123
Patrick Williams12fc9392021-08-06 09:16:53 -0500124pkg_prerm:${PN}-obmc-targets:append() {
Andrew Geissler20cff702020-03-09 16:51:27 -0500125
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600126 for i in ${OBMC_HOST_INSTANCES};
127 do
Andrew Geissler20cff702020-03-09 16:51:27 -0500128
Andrew Geisslere1900162022-03-25 16:10:13 +0000129 LINK="$D$systemd_system_unitdir/multi-user.target.requires/xyz.openbmc_project.State.Host@${i}.service"
130 rm $LINK
131
132 LINK="$D$systemd_system_unitdir/multi-user.target.requires/xyz.openbmc_project.State.Chassis@${i}.service"
133 rm $LINK
134
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600135 LINK="$D$systemd_system_unitdir/multi-user.target.requires/obmc-host-reset@${i}.target"
136 rm $LINK
Andrew Geissler20cff702020-03-09 16:51:27 -0500137
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600138 LINK="$D$systemd_system_unitdir/multi-user.target.requires/phosphor-discover-system-state@${i}.service"
139 rm $LINK
Andrew Geissleref50c6a2021-09-17 18:01:30 +0000140
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600141 LINK="$D$systemd_system_unitdir/obmc-chassis-poweron@${i}.target.wants/phosphor-reset-host-recovery@${i}.service"
142 rm $LINK
Andrew Geissler20cff702020-03-09 16:51:27 -0500143
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600144 LINK="$D$systemd_system_unitdir/obmc-host-start@${i}.target.requires/obmc-host-startmin@${i}.target"
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/phosphor-reset-host-reboot-attempts@${i}.service"
148 rm $LINK
Andrew Geissler4ef0e112021-01-05 16:51:58 -0600149
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600150 LINK="$D$systemd_system_unitdir/obmc-host-startmin@${i}.target.wants/phosphor-set-host-transition-to-running@${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-stop@${i}.target.wants/phosphor-set-host-transition-to-off@${i}.service"
154 rm $LINK
Andrew Geisslerd3f1e5b2020-09-25 09:23:51 -0500155
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600156 LINK="$D$systemd_system_unitdir/obmc-host-stop@${i}.target.wants/phosphor-reset-sensor-states@${i}.service"
157 rm $LINK
Andrew Geissler9c4b92b2020-09-25 14:32:57 -0500158
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600159 LINK="$D$systemd_system_unitdir/obmc-host-quiesce@${i}.target.wants/phosphor-reset-sensor-states@${i}.service"
160 rm $LINK
Andrew Geissler20cff702020-03-09 16:51:27 -0500161
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600162 LINK="$D$systemd_system_unitdir/obmc-host-reset@${i}.target.requires/phosphor-reset-host-running@${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-shutdown@${i}.target.requires/obmc-chassis-poweroff@${i}.target"
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-reboot@${i}.target.requires/obmc-host-shutdown@${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/phosphor-reboot-host@${i}.service"
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-warm-reboot@${i}.target.requires/xyz.openbmc_project.Ipmi.Internal.SoftPowerOff.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-force-warm-reboot@${i}.target.requires/obmc-host-stop@${i}.target"
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/phosphor-reboot-host@${i}.service"
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-warm-reboot@${i}.target.requires/obmc-host-force-warm-reboot@${i}.target"
184 rm $LINK
185
186 LINK="$D$systemd_system_unitdir/obmc-chassis-poweroff@${i}.target.wants/phosphor-clear-one-time@${i}.service"
187 rm $LINK
188
189 done
Andrew Geissler20cff702020-03-09 16:51:27 -0500190}
Andrew Geisslera02a18a2022-02-21 23:00:20 +0000191
Patrick Williams83a7aa92022-04-20 13:48:37 -0500192pkg_prerm:${PN}-chassis:append() {
Patrick Williams954512d2022-04-20 15:01:07 -0500193 for i in ${OBMC_CHASSIS_INSTANCES};
Patrick Williams83a7aa92022-04-20 13:48:37 -0500194 do
195
196 LINK="$D$systemd_system_unitdir/multi-user.target.requires/xyz.openbmc_project.State.Chassis@${i}.service"
197 rm $LINK
198
199 done
200}
201
Andrew Geisslera02a18a2022-02-21 23:00:20 +0000202pkg_prerm:${PN}-chassis-check-power-status:append() {
203
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600204 for i in ${OBMC_HOST_INSTANCES};
205 do
206
207 LINK="$D$systemd_system_unitdir/obmc-chassis-poweron@${i}.target.requires/phosphor-chassis-check-power-status@${i}.service"
208 rm $LINK
209
210 done
Andrew Geisslera02a18a2022-02-21 23:00:20 +0000211}