blob: 3a4898b86e9b50b279530922e8eea62b184d7c2c [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
15 LINK="$D$systemd_system_unitdir/multi-user.target.requires/xyz.openbmc_project.State.Chassis@${i}.service"
16 TARGET="../xyz.openbmc_project.State.Chassis@.service"
17 ln -s $TARGET $LINK
18
Patrick Williams4c7b3e62022-03-09 15:56:34 -060019 LINK="$D$systemd_system_unitdir/multi-user.target.requires/obmc-host-reset@${i}.target"
20 TARGET="../obmc-host-reset@.target"
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/multi-user.target.requires/phosphor-discover-system-state@${i}.service"
24 TARGET="../phosphor-discover-system-state@.service"
25 ln -s $TARGET $LINK
Andrew Geissler20cff702020-03-09 16:51:27 -050026
Patrick Williams4c7b3e62022-03-09 15:56:34 -060027 LINK="$D$systemd_system_unitdir/obmc-bmc-service-quiesce@${i}.target"
28 TARGET="./obmc-bmc-service-quiesce@.target"
29 ln -s $TARGET $LINK
Andrew Geissler77c01262022-02-25 19:30:14 +000030
Patrick Williams4c7b3e62022-03-09 15:56:34 -060031 mkdir -p $D$systemd_system_unitdir/obmc-chassis-poweron@${i}.target.wants
32 LINK="$D$systemd_system_unitdir/obmc-chassis-poweron@${i}.target.wants/phosphor-reset-host-recovery@${i}.service"
33 TARGET="../phosphor-reset-host-recovery@.service"
34 ln -s $TARGET $LINK
Andrew Geissleref50c6a2021-09-17 18:01:30 +000035
Patrick Williams4c7b3e62022-03-09 15:56:34 -060036 mkdir -p $D$systemd_system_unitdir/obmc-host-start@${i}.target.requires
37 LINK="$D$systemd_system_unitdir/obmc-host-start@${i}.target.requires/obmc-host-startmin@${i}.target"
38 TARGET="../obmc-host-startmin@.target"
39 ln -s $TARGET $LINK
Andrew Geissler20cff702020-03-09 16:51:27 -050040
Patrick Williams4c7b3e62022-03-09 15:56:34 -060041 LINK="$D$systemd_system_unitdir/obmc-host-start@${i}.target.requires/phosphor-reset-host-reboot-attempts@${i}.service"
42 TARGET="../phosphor-reset-host-reboot-attempts@.service"
43 ln -s $TARGET $LINK
Andrew Geissler20cff702020-03-09 16:51:27 -050044
Patrick Williams4c7b3e62022-03-09 15:56:34 -060045 mkdir -p $D$systemd_system_unitdir/obmc-host-startmin@${i}.target.wants
46 LINK="$D$systemd_system_unitdir/obmc-host-startmin@${i}.target.wants/phosphor-set-host-transition-to-running@${i}.service"
47 TARGET="../phosphor-set-host-transition-to-running@.service"
48 ln -s $TARGET $LINK
Andrew Geissler4ef0e112021-01-05 16:51:58 -060049
Patrick Williams4c7b3e62022-03-09 15:56:34 -060050 mkdir -p $D$systemd_system_unitdir/obmc-host-stop@${i}.target.wants
51 LINK="$D$systemd_system_unitdir/obmc-host-stop@${i}.target.wants/phosphor-set-host-transition-to-off@${i}.service"
52 TARGET="../phosphor-set-host-transition-to-off@.service"
53 ln -s $TARGET $LINK
Andrew Geissler4ef0e112021-01-05 16:51:58 -060054
Patrick Williams4c7b3e62022-03-09 15:56:34 -060055 mkdir -p $D$systemd_system_unitdir/obmc-host-reset@${i}.target.requires
56 LINK="$D$systemd_system_unitdir/obmc-host-reset@${i}.target.requires/phosphor-reset-host-running@${i}.service"
57 TARGET="../phosphor-reset-host-running@.service"
58 ln -s $TARGET $LINK
Andrew Geissler20cff702020-03-09 16:51:27 -050059
Patrick Williams4c7b3e62022-03-09 15:56:34 -060060 mkdir -p $D$systemd_system_unitdir/obmc-host-stop@${i}.target.wants
61 LINK="$D$systemd_system_unitdir/obmc-host-stop@${i}.target.wants/phosphor-reset-sensor-states@${i}.service"
62 TARGET="../phosphor-reset-sensor-states@.service"
63 ln -s $TARGET $LINK
Andrew Geisslerd3f1e5b2020-09-25 09:23:51 -050064
Patrick Williams4c7b3e62022-03-09 15:56:34 -060065 mkdir -p $D$systemd_system_unitdir/obmc-host-quiesce@${i}.target.wants
66 LINK="$D$systemd_system_unitdir/obmc-host-quiesce@${i}.target.wants/phosphor-reset-sensor-states@${i}.service"
67 TARGET="../phosphor-reset-sensor-states@.service"
68 ln -s $TARGET $LINK
Andrew Geissler9c4b92b2020-09-25 14:32:57 -050069
Patrick Williams4c7b3e62022-03-09 15:56:34 -060070 mkdir -p $D$systemd_system_unitdir/obmc-host-shutdown@${i}.target.requires
71 LINK="$D$systemd_system_unitdir/obmc-host-shutdown@${i}.target.requires/obmc-chassis-poweroff@${i}.target"
72 TARGET="../obmc-chassis-poweroff@.target"
73 ln -s $TARGET $LINK
Andrew Geissler20cff702020-03-09 16:51:27 -050074
Patrick Williams4c7b3e62022-03-09 15:56:34 -060075 mkdir -p $D$systemd_system_unitdir/obmc-host-reboot@${i}.target.requires
76 LINK="$D$systemd_system_unitdir/obmc-host-reboot@${i}.target.requires/obmc-host-shutdown@${i}.target"
77 TARGET="../obmc-host-shutdown@.target"
78 ln -s $TARGET $LINK
Andrew Geissler20cff702020-03-09 16:51:27 -050079
Patrick Williams4c7b3e62022-03-09 15:56:34 -060080 LINK="$D$systemd_system_unitdir/obmc-host-reboot@${i}.target.requires/phosphor-reboot-host@${i}.service"
81 TARGET="../phosphor-reboot-host@.service"
82 ln -s $TARGET $LINK
Andrew Geissler20cff702020-03-09 16:51:27 -050083
Patrick Williams4c7b3e62022-03-09 15:56:34 -060084 mkdir -p $D$systemd_system_unitdir/obmc-host-warm-reboot@${i}.target.requires
85 LINK="$D$systemd_system_unitdir/obmc-host-warm-reboot@${i}.target.requires/xyz.openbmc_project.Ipmi.Internal.SoftPowerOff.service"
86 TARGET="../xyz.openbmc_project.Ipmi.Internal.SoftPowerOff.service"
87 ln -s $TARGET $LINK
Andrew Geissler20cff702020-03-09 16:51:27 -050088
Patrick Williams4c7b3e62022-03-09 15:56:34 -060089 mkdir -p $D$systemd_system_unitdir/obmc-host-force-warm-reboot@${i}.target.requires
90 LINK="$D$systemd_system_unitdir/obmc-host-force-warm-reboot@${i}.target.requires/obmc-host-stop@${i}.target"
91 TARGET="../obmc-host-stop@.target"
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-force-warm-reboot@${i}.target.requires/phosphor-reboot-host@${i}.service"
95 TARGET="../phosphor-reboot-host@.service"
96 ln -s $TARGET $LINK
Andrew Geissler20cff702020-03-09 16:51:27 -050097
Patrick Williams4c7b3e62022-03-09 15:56:34 -060098 LINK="$D$systemd_system_unitdir/obmc-host-warm-reboot@${i}.target.requires/obmc-host-force-warm-reboot@${i}.target"
99 TARGET="../obmc-host-force-warm-reboot@.target"
100 ln -s $TARGET $LINK
Andrew Geissler20cff702020-03-09 16:51:27 -0500101
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600102 mkdir -p $D$systemd_system_unitdir/obmc-chassis-poweroff@${i}.target.wants
103 LINK="$D$systemd_system_unitdir/obmc-chassis-poweroff@${i}.target.wants/phosphor-clear-one-time@${i}.service"
104 TARGET="../phosphor-clear-one-time@.service"
105 ln -s $TARGET $LINK
106 done
Andrew Geissler20cff702020-03-09 16:51:27 -0500107}
108
Andrew Geisslera02a18a2022-02-21 23:00:20 +0000109pkg_postinst:${PN}-chassis-check-power-status:append() {
110
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600111 for i in ${OBMC_HOST_INSTANCES};
112 do
113 mkdir -p $D$systemd_system_unitdir/obmc-chassis-poweron@${i}.target.requires
114 LINK="$D$systemd_system_unitdir/obmc-chassis-poweron@${i}.target.requires/phosphor-chassis-check-power-status@${i}.service"
115 TARGET="../phosphor-chassis-check-power-status@.service"
116 ln -s $TARGET $LINK
117 done
Andrew Geisslera02a18a2022-02-21 23:00:20 +0000118}
119
Patrick Williams12fc9392021-08-06 09:16:53 -0500120pkg_prerm:${PN}-obmc-targets:append() {
Andrew Geissler20cff702020-03-09 16:51:27 -0500121
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600122 for i in ${OBMC_HOST_INSTANCES};
123 do
Andrew Geissler20cff702020-03-09 16:51:27 -0500124
Andrew Geisslere1900162022-03-25 16:10:13 +0000125 LINK="$D$systemd_system_unitdir/multi-user.target.requires/xyz.openbmc_project.State.Host@${i}.service"
126 rm $LINK
127
128 LINK="$D$systemd_system_unitdir/multi-user.target.requires/xyz.openbmc_project.State.Chassis@${i}.service"
129 rm $LINK
130
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600131 LINK="$D$systemd_system_unitdir/multi-user.target.requires/obmc-host-reset@${i}.target"
132 rm $LINK
Andrew Geissler20cff702020-03-09 16:51:27 -0500133
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600134 LINK="$D$systemd_system_unitdir/multi-user.target.requires/phosphor-discover-system-state@${i}.service"
135 rm $LINK
Andrew Geissleref50c6a2021-09-17 18:01:30 +0000136
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600137 LINK="$D$systemd_system_unitdir/obmc-chassis-poweron@${i}.target.wants/phosphor-reset-host-recovery@${i}.service"
138 rm $LINK
Andrew Geissler20cff702020-03-09 16:51:27 -0500139
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600140 LINK="$D$systemd_system_unitdir/obmc-host-start@${i}.target.requires/obmc-host-startmin@${i}.target"
141 rm $LINK
Andrew Geissler20cff702020-03-09 16:51:27 -0500142
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600143 LINK="$D$systemd_system_unitdir/obmc-host-start@${i}.target.requires/phosphor-reset-host-reboot-attempts@${i}.service"
144 rm $LINK
Andrew Geissler4ef0e112021-01-05 16:51:58 -0600145
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600146 LINK="$D$systemd_system_unitdir/obmc-host-startmin@${i}.target.wants/phosphor-set-host-transition-to-running@${i}.service"
147 rm $LINK
Andrew Geissler4ef0e112021-01-05 16:51:58 -0600148
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600149 LINK="$D$systemd_system_unitdir/obmc-host-stop@${i}.target.wants/phosphor-set-host-transition-to-off@${i}.service"
150 rm $LINK
Andrew Geisslerd3f1e5b2020-09-25 09:23:51 -0500151
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600152 LINK="$D$systemd_system_unitdir/obmc-host-stop@${i}.target.wants/phosphor-reset-sensor-states@${i}.service"
153 rm $LINK
Andrew Geissler9c4b92b2020-09-25 14:32:57 -0500154
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600155 LINK="$D$systemd_system_unitdir/obmc-host-quiesce@${i}.target.wants/phosphor-reset-sensor-states@${i}.service"
156 rm $LINK
Andrew Geissler20cff702020-03-09 16:51:27 -0500157
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600158 LINK="$D$systemd_system_unitdir/obmc-host-reset@${i}.target.requires/phosphor-reset-host-running@${i}.service"
159 rm $LINK
Andrew Geissler20cff702020-03-09 16:51:27 -0500160
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600161 LINK="$D$systemd_system_unitdir/obmc-host-shutdown@${i}.target.requires/obmc-chassis-poweroff@${i}.target"
162 rm $LINK
Andrew Geissler20cff702020-03-09 16:51:27 -0500163
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600164 LINK="$D$systemd_system_unitdir/obmc-host-reboot@${i}.target.requires/obmc-host-shutdown@${i}.target"
165 rm $LINK
Andrew Geissler20cff702020-03-09 16:51:27 -0500166
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600167 LINK="$D$systemd_system_unitdir/obmc-host-reboot@${i}.target.requires/phosphor-reboot-host@${i}.service"
168 rm $LINK
Andrew Geissler20cff702020-03-09 16:51:27 -0500169
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600170 LINK="$D$systemd_system_unitdir/obmc-host-warm-reboot@${i}.target.requires/xyz.openbmc_project.Ipmi.Internal.SoftPowerOff.service"
171 rm $LINK
Andrew Geissler20cff702020-03-09 16:51:27 -0500172
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600173 LINK="$D$systemd_system_unitdir/obmc-host-force-warm-reboot@${i}.target.requires/obmc-host-stop@${i}.target"
174 rm $LINK
Andrew Geissler20cff702020-03-09 16:51:27 -0500175
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600176 LINK="$D$systemd_system_unitdir/obmc-host-force-warm-reboot@${i}.target.requires/phosphor-reboot-host@${i}.service"
177 rm $LINK
Andrew Geissler20cff702020-03-09 16:51:27 -0500178
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600179 LINK="$D$systemd_system_unitdir/obmc-host-warm-reboot@${i}.target.requires/obmc-host-force-warm-reboot@${i}.target"
180 rm $LINK
181
182 LINK="$D$systemd_system_unitdir/obmc-chassis-poweroff@${i}.target.wants/phosphor-clear-one-time@${i}.service"
183 rm $LINK
184
185 done
Andrew Geissler20cff702020-03-09 16:51:27 -0500186}
Andrew Geisslera02a18a2022-02-21 23:00:20 +0000187
188pkg_prerm:${PN}-chassis-check-power-status:append() {
189
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600190 for i in ${OBMC_HOST_INSTANCES};
191 do
192
193 LINK="$D$systemd_system_unitdir/obmc-chassis-poweron@${i}.target.requires/phosphor-chassis-check-power-status@${i}.service"
194 rm $LINK
195
196 done
Andrew Geisslera02a18a2022-02-21 23:00:20 +0000197}