blob: 86415a4a883e71abd3b3a79e6d973e8e44cec9fd [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
11 LINK="$D$systemd_system_unitdir/multi-user.target.requires/obmc-host-reset@${i}.target"
12 TARGET="../obmc-host-reset@.target"
13 ln -s $TARGET $LINK
Andrew Geissler20cff702020-03-09 16:51:27 -050014
Patrick Williams4c7b3e62022-03-09 15:56:34 -060015 LINK="$D$systemd_system_unitdir/multi-user.target.requires/phosphor-discover-system-state@${i}.service"
16 TARGET="../phosphor-discover-system-state@.service"
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/obmc-bmc-service-quiesce@${i}.target"
20 TARGET="./obmc-bmc-service-quiesce@.target"
21 ln -s $TARGET $LINK
Andrew Geissler77c01262022-02-25 19:30:14 +000022
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
Andrew Geisslera02a18a2022-02-21 23:00:20 +0000101pkg_postinst:${PN}-chassis-check-power-status:append() {
102
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600103 for i in ${OBMC_HOST_INSTANCES};
104 do
105 mkdir -p $D$systemd_system_unitdir/obmc-chassis-poweron@${i}.target.requires
106 LINK="$D$systemd_system_unitdir/obmc-chassis-poweron@${i}.target.requires/phosphor-chassis-check-power-status@${i}.service"
107 TARGET="../phosphor-chassis-check-power-status@.service"
108 ln -s $TARGET $LINK
109 done
Andrew Geisslera02a18a2022-02-21 23:00:20 +0000110}
111
Patrick Williams12fc9392021-08-06 09:16:53 -0500112pkg_prerm:${PN}-obmc-targets:append() {
Andrew Geissler20cff702020-03-09 16:51:27 -0500113
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600114 for i in ${OBMC_HOST_INSTANCES};
115 do
Andrew Geissler20cff702020-03-09 16:51:27 -0500116
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600117 LINK="$D$systemd_system_unitdir/multi-user.target.requires/obmc-host-reset@${i}.target"
118 rm $LINK
Andrew Geissler20cff702020-03-09 16:51:27 -0500119
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600120 LINK="$D$systemd_system_unitdir/multi-user.target.requires/phosphor-discover-system-state@${i}.service"
121 rm $LINK
Andrew Geissleref50c6a2021-09-17 18:01:30 +0000122
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600123 LINK="$D$systemd_system_unitdir/obmc-chassis-poweron@${i}.target.wants/phosphor-reset-host-recovery@${i}.service"
124 rm $LINK
Andrew Geissler20cff702020-03-09 16:51:27 -0500125
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600126 LINK="$D$systemd_system_unitdir/obmc-host-start@${i}.target.requires/obmc-host-startmin@${i}.target"
127 rm $LINK
Andrew Geissler20cff702020-03-09 16:51:27 -0500128
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600129 LINK="$D$systemd_system_unitdir/obmc-host-start@${i}.target.requires/phosphor-reset-host-reboot-attempts@${i}.service"
130 rm $LINK
Andrew Geissler4ef0e112021-01-05 16:51:58 -0600131
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600132 LINK="$D$systemd_system_unitdir/obmc-host-startmin@${i}.target.wants/phosphor-set-host-transition-to-running@${i}.service"
133 rm $LINK
Andrew Geissler4ef0e112021-01-05 16:51:58 -0600134
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600135 LINK="$D$systemd_system_unitdir/obmc-host-stop@${i}.target.wants/phosphor-set-host-transition-to-off@${i}.service"
136 rm $LINK
Andrew Geisslerd3f1e5b2020-09-25 09:23:51 -0500137
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600138 LINK="$D$systemd_system_unitdir/obmc-host-stop@${i}.target.wants/phosphor-reset-sensor-states@${i}.service"
139 rm $LINK
Andrew Geissler9c4b92b2020-09-25 14:32:57 -0500140
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600141 LINK="$D$systemd_system_unitdir/obmc-host-quiesce@${i}.target.wants/phosphor-reset-sensor-states@${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-reset@${i}.target.requires/phosphor-reset-host-running@${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-shutdown@${i}.target.requires/obmc-chassis-poweroff@${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-reboot@${i}.target.requires/obmc-host-shutdown@${i}.target"
151 rm $LINK
Andrew Geissler20cff702020-03-09 16:51:27 -0500152
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600153 LINK="$D$systemd_system_unitdir/obmc-host-reboot@${i}.target.requires/phosphor-reboot-host@${i}.service"
154 rm $LINK
Andrew Geissler20cff702020-03-09 16:51:27 -0500155
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600156 LINK="$D$systemd_system_unitdir/obmc-host-warm-reboot@${i}.target.requires/xyz.openbmc_project.Ipmi.Internal.SoftPowerOff.service"
157 rm $LINK
Andrew Geissler20cff702020-03-09 16:51:27 -0500158
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600159 LINK="$D$systemd_system_unitdir/obmc-host-force-warm-reboot@${i}.target.requires/obmc-host-stop@${i}.target"
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-force-warm-reboot@${i}.target.requires/phosphor-reboot-host@${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-warm-reboot@${i}.target.requires/obmc-host-force-warm-reboot@${i}.target"
166 rm $LINK
167
168 LINK="$D$systemd_system_unitdir/obmc-chassis-poweroff@${i}.target.wants/phosphor-clear-one-time@${i}.service"
169 rm $LINK
170
171 done
Andrew Geissler20cff702020-03-09 16:51:27 -0500172}
Andrew Geisslera02a18a2022-02-21 23:00:20 +0000173
174pkg_prerm:${PN}-chassis-check-power-status:append() {
175
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600176 for i in ${OBMC_HOST_INSTANCES};
177 do
178
179 LINK="$D$systemd_system_unitdir/obmc-chassis-poweron@${i}.target.requires/phosphor-chassis-check-power-status@${i}.service"
180 rm $LINK
181
182 done
Andrew Geisslera02a18a2022-02-21 23:00:20 +0000183}