blob: 8e214c32fafa9c71c8ff82a0fc7e1d94f97bd53f [file] [log] [blame]
Delphine CC Chiudb86eb12022-12-21 15:37:28 +08001HOST_DEFAULT_TARGETS = " \
Patrick Williams3952f8b2022-04-20 16:25:53 -05002 multi-user.target.requires/obmc-host-reset@{}.target \
Delphine CC Chiu6b8809e2023-02-07 17:12:26 +08003 multi-user.target.wants/phosphor-discover-system-state@{}.service \
Patrick Williams3952f8b2022-04-20 16:25:53 -05004 obmc-host-start@{}.target.requires/obmc-host-startmin@{}.target \
5 obmc-host-start@{}.target.requires/phosphor-reset-host-reboot-attempts@{}.service \
6 obmc-host-startmin@{}.target.wants/phosphor-set-host-transition-to-running@{}.service \
7 obmc-host-stop@{}.target.wants/phosphor-set-host-transition-to-off@{}.service \
8 obmc-host-reset@{}.target.requires/phosphor-reset-host-running@{}.service \
9 obmc-host-stop@{}.target.wants/phosphor-reset-sensor-states@{}.service \
Patrick Williams07e91c72024-02-05 11:11:42 -060010 obmc-host-shutdown@{}.target.requires/obmc-host-stop@{}.target \
Andrew Geissler73f93652022-04-15 13:32:04 -050011 obmc-host-graceful-quiesce@{}.target.wants/obmc-host-quiesce@{}.target \
12 obmc-host-graceful-quiesce@{}.target.wants/pldmSoftPowerOff.service \
Patrick Williams3952f8b2022-04-20 16:25:53 -050013 obmc-host-quiesce@{}.target.wants/phosphor-reset-sensor-states@{}.service \
Patrick Williams3952f8b2022-04-20 16:25:53 -050014 obmc-host-reboot@{}.target.requires/obmc-host-shutdown@{}.target \
15 obmc-host-reboot@{}.target.requires/phosphor-reboot-host@{}.service \
16 obmc-host-warm-reboot@{}.target.requires/xyz.openbmc_project.Ipmi.Internal.SoftPowerOff.service \
17 obmc-host-force-warm-reboot@{}.target.requires/obmc-host-stop@{}.target \
18 obmc-host-force-warm-reboot@{}.target.requires/phosphor-reboot-host@{}.service \
19 obmc-host-warm-reboot@{}.target.requires/obmc-host-force-warm-reboot@{}.target \
Delphine CC Chiudb86eb12022-12-21 15:37:28 +080020"
21
22CHASSIS_DEFAULT_TARGETS = " \
Delphine CC Chiudb86eb12022-12-21 15:37:28 +080023 obmc-chassis-poweron@{}.target.wants/phosphor-reset-host-recovery@{}.service \
24 obmc-chassis-poweron@{}.target.requires/obmc-power-start@{}.service \
Andrew Geisslerdcdd5ec2023-12-08 10:40:15 -060025 obmc-chassis-poweron@{}.target.requires/phosphor-set-chassis-transition-to-on@{}.service \
Delphine CC Chiudb86eb12022-12-21 15:37:28 +080026 obmc-host-shutdown@{}.target.requires/obmc-chassis-poweroff@{}.target \
27 obmc-chassis-poweroff@{}.target.requires/obmc-power-stop@{}.service \
28 obmc-chassis-poweroff@{}.target.requires/obmc-powered-off@{}.service \
Patrick Williams3952f8b2022-04-20 16:25:53 -050029 obmc-chassis-poweroff@{}.target.wants/phosphor-clear-one-time@{}.service \
Andrew Geisslerdcdd5ec2023-12-08 10:40:15 -060030 obmc-chassis-poweroff@{}.target.requires/phosphor-set-chassis-transition-to-off@{}.service \
Andrew Geisslere0ba7fb2022-07-06 14:51:03 -050031 obmc-chassis-blackout@{}.target.wants/phosphor-reset-sensor-states@{}.service \
Thu Nguyen1859f252022-12-29 11:21:48 +070032 obmc-chassis-powerreset@{}.target.requires/phosphor-reset-chassis-on@{}.service \
33 obmc-chassis-powerreset@{}.target.requires/phosphor-reset-chassis-running@{}.service \
Patrick Williams3952f8b2022-04-20 16:25:53 -050034"
Patrick Williams4c7b3e62022-03-09 15:56:34 -060035
36# TODO: There are some targets that are chassis oriented, but there is no
37# obvious way to map HOST<->CHASSIS relationships. Making an assumption
38# currently that there is a 1-to-1 relationship between the two.
39
Patrick Williams12fc9392021-08-06 09:16:53 -050040pkg_postinst:${PN}-obmc-targets:append() {
Patrick Williams4c7b3e62022-03-09 15:56:34 -060041 for i in ${OBMC_HOST_INSTANCES};
42 do
Delphine CC Chiudb86eb12022-12-21 15:37:28 +080043 for j in ${HOST_DEFAULT_TARGETS};
44 do
45 LINK="$D$systemd_system_unitdir/${j}"
46 LINK="$(echo ${LINK} | sed s/{}/${i}/g )"
47 TARGET="../$(basename ${j} | sed s/{}//g )"
48 mkdir -p "$(dirname ${LINK})"
49 ln -s "${TARGET}" "${LINK}"
50 done
51 done
52
53 for i in ${OBMC_CHASSIS_INSTANCES};
54 do
55 for j in ${CHASSIS_DEFAULT_TARGETS};
Patrick Williams3952f8b2022-04-20 16:25:53 -050056 do
57 LINK="$D$systemd_system_unitdir/${j}"
58 LINK="$(echo ${LINK} | sed s/{}/${i}/g )"
59 TARGET="../$(basename ${j} | sed s/{}//g )"
60 mkdir -p "$(dirname ${LINK})"
61 ln -s "${TARGET}" "${LINK}"
62 done
Patrick Williams4c7b3e62022-03-09 15:56:34 -060063 done
Andrew Geissler20cff702020-03-09 16:51:27 -050064}
65
Patrick Williams12fc9392021-08-06 09:16:53 -050066pkg_prerm:${PN}-obmc-targets:append() {
Patrick Williams4c7b3e62022-03-09 15:56:34 -060067 for i in ${OBMC_HOST_INSTANCES};
68 do
Delphine CC Chiudb86eb12022-12-21 15:37:28 +080069 for j in ${HOST_DEFAULT_TARGETS};
70 do
71 LINK="$D$systemd_system_unitdir/${j}"
72 LINK="$(echo ${LINK} | sed s/{}/${i}/g )"
73 rm "${LINK}"
74 done
75 done
76
77 for i in ${OBMC_CHASSIS_INSTANCES};
78 do
79 for j in ${CHASSIS_DEFAULT_TARGETS};
Patrick Williams3952f8b2022-04-20 16:25:53 -050080 do
81 LINK="$D$systemd_system_unitdir/${j}"
82 LINK="$(echo ${LINK} | sed s/{}/${i}/g )"
83 rm "${LINK}"
84 done
Patrick Williams4c7b3e62022-03-09 15:56:34 -060085 done
Andrew Geissler20cff702020-03-09 16:51:27 -050086}
Andrew Geisslera02a18a2022-02-21 23:00:20 +000087
Patrick Williams4040b542022-04-20 16:35:25 -050088pkg_postinst:${PN}-chassis:append() {
89 for i in ${OBMC_CHASSIS_INSTANCES};
90 do
91 mkdir -p $D$systemd_system_unitdir/multi-user.target.requires
92 LINK="$D$systemd_system_unitdir/multi-user.target.requires/xyz.openbmc_project.State.Chassis@${i}.service"
93 TARGET="../xyz.openbmc_project.State.Chassis@.service"
94 ln -s $TARGET $LINK
95 done
96}
97
Patrick Williams83a7aa92022-04-20 13:48:37 -050098pkg_prerm:${PN}-chassis:append() {
Patrick Williams954512d2022-04-20 15:01:07 -050099 for i in ${OBMC_CHASSIS_INSTANCES};
Patrick Williams83a7aa92022-04-20 13:48:37 -0500100 do
Patrick Williams83a7aa92022-04-20 13:48:37 -0500101 LINK="$D$systemd_system_unitdir/multi-user.target.requires/xyz.openbmc_project.State.Chassis@${i}.service"
102 rm $LINK
Patrick Williams4040b542022-04-20 16:35:25 -0500103 done
104}
Patrick Williams83a7aa92022-04-20 13:48:37 -0500105
Patrick Williams4040b542022-04-20 16:35:25 -0500106pkg_postinst:${PN}-chassis-check-power-status:append() {
Delphine CC Chiudb86eb12022-12-21 15:37:28 +0800107 for i in ${OBMC_CHASSIS_INSTANCES};
Patrick Williams4040b542022-04-20 16:35:25 -0500108 do
109 mkdir -p $D$systemd_system_unitdir/obmc-chassis-poweron@${i}.target.requires
110 LINK="$D$systemd_system_unitdir/obmc-chassis-poweron@${i}.target.requires/phosphor-chassis-check-power-status@${i}.service"
111 TARGET="../phosphor-chassis-check-power-status@.service"
112 ln -s $TARGET $LINK
Patrick Williams83a7aa92022-04-20 13:48:37 -0500113 done
114}
115
Andrew Geisslera02a18a2022-02-21 23:00:20 +0000116pkg_prerm:${PN}-chassis-check-power-status:append() {
Delphine CC Chiudb86eb12022-12-21 15:37:28 +0800117 for i in ${OBMC_CHASSIS_INSTANCES};
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600118 do
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600119 LINK="$D$systemd_system_unitdir/obmc-chassis-poweron@${i}.target.requires/phosphor-chassis-check-power-status@${i}.service"
120 rm $LINK
Patrick Williams4040b542022-04-20 16:35:25 -0500121 done
122}
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600123
Andrew Geissler19a6a522023-05-03 13:30:45 -0500124pkg_postinst:${PN}-chassis-poweron-log:append() {
125 for i in ${OBMC_CHASSIS_INSTANCES};
126 do
127 mkdir -p $D$systemd_system_unitdir/obmc-chassis-poweron@${i}.target.wants
128 LINK="$D$systemd_system_unitdir/obmc-chassis-poweron@${i}.target.wants/phosphor-create-chassis-poweron-log@${i}.service"
129 TARGET="../phosphor-create-chassis-poweron-log@.service"
130 ln -s $TARGET $LINK
131 done
132}
133
134pkg_prerm:${PN}-chassis-poweron-log:append() {
135 for i in ${OBMC_CHASSIS_INSTANCES};
136 do
137 LINK="$D$systemd_system_unitdir/obmc-chassis-poweron@${i}.target.wants/phosphor-create-chassis-poweron-log@${i}.service"
138 rm $LINK
139 done
140}
141
Patrick Williams4040b542022-04-20 16:35:25 -0500142pkg_postinst:${PN}-host:append() {
143 for i in ${OBMC_HOST_INSTANCES};
144 do
145 mkdir -p $D$systemd_system_unitdir/multi-user.target.requires
146 LINK="$D$systemd_system_unitdir/multi-user.target.requires/xyz.openbmc_project.State.Host@${i}.service"
147 TARGET="../xyz.openbmc_project.State.Host@.service"
148 ln -s $TARGET $LINK
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600149 done
Andrew Geisslera02a18a2022-02-21 23:00:20 +0000150}
Patrick Williamsad7adea2022-04-20 13:48:37 -0500151
152pkg_prerm:${PN}-host:append() {
153 for i in ${OBMC_HOST_INSTANCES};
154 do
Patrick Williamsad7adea2022-04-20 13:48:37 -0500155 LINK="$D$systemd_system_unitdir/multi-user.target.requires/xyz.openbmc_project.State.Host@${i}.service"
156 rm $LINK
Patrick Williamsad7adea2022-04-20 13:48:37 -0500157 done
158}
Andrew Geissler7f90ad82023-01-17 15:31:08 -0600159
160pkg_postinst:${PN}-scheduled-host-transition:append() {
161 for i in ${OBMC_HOST_INSTANCES};
162 do
163 mkdir -p $D$systemd_system_unitdir/multi-user.target.wants
164 LINK="$D$systemd_system_unitdir/multi-user.target.wants/xyz.openbmc_project.State.ScheduledHostTransition@${i}.service"
165 TARGET="../xyz.openbmc_project.State.ScheduledHostTransition@.service"
166 ln -s $TARGET $LINK
167 done
168}
169
170pkg_prerm:${PN}-scheduled-host-transition:append() {
171 for i in ${OBMC_HOST_INSTANCES};
172 do
173 LINK="$D$systemd_system_unitdir/multi-user.target.wants/xyz.openbmc_project.State.ScheduledHostTransition@${i}.service"
174 rm $LINK
175 done
176}