blob: a1276e9167f00b73070eda8d379ba856b253d697 [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 \
Andrew Geissler73f93652022-04-15 13:32:04 -050010 obmc-host-graceful-quiesce@{}.target.wants/obmc-host-quiesce@{}.target \
11 obmc-host-graceful-quiesce@{}.target.wants/pldmSoftPowerOff.service \
Patrick Williams3952f8b2022-04-20 16:25:53 -050012 obmc-host-quiesce@{}.target.wants/phosphor-reset-sensor-states@{}.service \
Patrick Williams3952f8b2022-04-20 16:25:53 -050013 obmc-host-reboot@{}.target.requires/obmc-host-shutdown@{}.target \
14 obmc-host-reboot@{}.target.requires/phosphor-reboot-host@{}.service \
15 obmc-host-warm-reboot@{}.target.requires/xyz.openbmc_project.Ipmi.Internal.SoftPowerOff.service \
16 obmc-host-force-warm-reboot@{}.target.requires/obmc-host-stop@{}.target \
17 obmc-host-force-warm-reboot@{}.target.requires/phosphor-reboot-host@{}.service \
18 obmc-host-warm-reboot@{}.target.requires/obmc-host-force-warm-reboot@{}.target \
Delphine CC Chiudb86eb12022-12-21 15:37:28 +080019"
20
21CHASSIS_DEFAULT_TARGETS = " \
Delphine CC Chiudb86eb12022-12-21 15:37:28 +080022 obmc-chassis-poweron@{}.target.wants/phosphor-reset-host-recovery@{}.service \
23 obmc-chassis-poweron@{}.target.requires/obmc-power-start@{}.service \
Andrew Geisslerdcdd5ec2023-12-08 10:40:15 -060024 obmc-chassis-poweron@{}.target.requires/phosphor-set-chassis-transition-to-on@{}.service \
Delphine CC Chiudb86eb12022-12-21 15:37:28 +080025 obmc-host-shutdown@{}.target.requires/obmc-chassis-poweroff@{}.target \
26 obmc-chassis-poweroff@{}.target.requires/obmc-power-stop@{}.service \
27 obmc-chassis-poweroff@{}.target.requires/obmc-powered-off@{}.service \
Patrick Williams3952f8b2022-04-20 16:25:53 -050028 obmc-chassis-poweroff@{}.target.wants/phosphor-clear-one-time@{}.service \
Andrew Geisslerdcdd5ec2023-12-08 10:40:15 -060029 obmc-chassis-poweroff@{}.target.requires/phosphor-set-chassis-transition-to-off@{}.service \
Andrew Geisslere0ba7fb2022-07-06 14:51:03 -050030 obmc-chassis-blackout@{}.target.wants/phosphor-reset-sensor-states@{}.service \
Thu Nguyen1859f252022-12-29 11:21:48 +070031 obmc-chassis-powerreset@{}.target.requires/phosphor-reset-chassis-on@{}.service \
32 obmc-chassis-powerreset@{}.target.requires/phosphor-reset-chassis-running@{}.service \
Patrick Williams3952f8b2022-04-20 16:25:53 -050033"
Patrick Williams4c7b3e62022-03-09 15:56:34 -060034
35# TODO: There are some targets that are chassis oriented, but there is no
36# obvious way to map HOST<->CHASSIS relationships. Making an assumption
37# currently that there is a 1-to-1 relationship between the two.
38
Patrick Williams12fc9392021-08-06 09:16:53 -050039pkg_postinst:${PN}-obmc-targets:append() {
Patrick Williams4c7b3e62022-03-09 15:56:34 -060040 for i in ${OBMC_HOST_INSTANCES};
41 do
Delphine CC Chiudb86eb12022-12-21 15:37:28 +080042 for j in ${HOST_DEFAULT_TARGETS};
43 do
44 LINK="$D$systemd_system_unitdir/${j}"
45 LINK="$(echo ${LINK} | sed s/{}/${i}/g )"
46 TARGET="../$(basename ${j} | sed s/{}//g )"
47 mkdir -p "$(dirname ${LINK})"
48 ln -s "${TARGET}" "${LINK}"
49 done
50 done
51
52 for i in ${OBMC_CHASSIS_INSTANCES};
53 do
54 for j in ${CHASSIS_DEFAULT_TARGETS};
Patrick Williams3952f8b2022-04-20 16:25:53 -050055 do
56 LINK="$D$systemd_system_unitdir/${j}"
57 LINK="$(echo ${LINK} | sed s/{}/${i}/g )"
58 TARGET="../$(basename ${j} | sed s/{}//g )"
59 mkdir -p "$(dirname ${LINK})"
60 ln -s "${TARGET}" "${LINK}"
61 done
Patrick Williams4c7b3e62022-03-09 15:56:34 -060062 done
Andrew Geissler20cff702020-03-09 16:51:27 -050063}
64
Patrick Williams12fc9392021-08-06 09:16:53 -050065pkg_prerm:${PN}-obmc-targets:append() {
Patrick Williams4c7b3e62022-03-09 15:56:34 -060066 for i in ${OBMC_HOST_INSTANCES};
67 do
Delphine CC Chiudb86eb12022-12-21 15:37:28 +080068 for j in ${HOST_DEFAULT_TARGETS};
69 do
70 LINK="$D$systemd_system_unitdir/${j}"
71 LINK="$(echo ${LINK} | sed s/{}/${i}/g )"
72 rm "${LINK}"
73 done
74 done
75
76 for i in ${OBMC_CHASSIS_INSTANCES};
77 do
78 for j in ${CHASSIS_DEFAULT_TARGETS};
Patrick Williams3952f8b2022-04-20 16:25:53 -050079 do
80 LINK="$D$systemd_system_unitdir/${j}"
81 LINK="$(echo ${LINK} | sed s/{}/${i}/g )"
82 rm "${LINK}"
83 done
Patrick Williams4c7b3e62022-03-09 15:56:34 -060084 done
Andrew Geissler20cff702020-03-09 16:51:27 -050085}
Andrew Geisslera02a18a2022-02-21 23:00:20 +000086
Patrick Williams4040b542022-04-20 16:35:25 -050087pkg_postinst:${PN}-chassis:append() {
88 for i in ${OBMC_CHASSIS_INSTANCES};
89 do
90 mkdir -p $D$systemd_system_unitdir/multi-user.target.requires
91 LINK="$D$systemd_system_unitdir/multi-user.target.requires/xyz.openbmc_project.State.Chassis@${i}.service"
92 TARGET="../xyz.openbmc_project.State.Chassis@.service"
93 ln -s $TARGET $LINK
94 done
95}
96
Patrick Williams83a7aa92022-04-20 13:48:37 -050097pkg_prerm:${PN}-chassis:append() {
Patrick Williams954512d2022-04-20 15:01:07 -050098 for i in ${OBMC_CHASSIS_INSTANCES};
Patrick Williams83a7aa92022-04-20 13:48:37 -050099 do
Patrick Williams83a7aa92022-04-20 13:48:37 -0500100 LINK="$D$systemd_system_unitdir/multi-user.target.requires/xyz.openbmc_project.State.Chassis@${i}.service"
101 rm $LINK
Patrick Williams4040b542022-04-20 16:35:25 -0500102 done
103}
Patrick Williams83a7aa92022-04-20 13:48:37 -0500104
Patrick Williams4040b542022-04-20 16:35:25 -0500105pkg_postinst:${PN}-chassis-check-power-status:append() {
Delphine CC Chiudb86eb12022-12-21 15:37:28 +0800106 for i in ${OBMC_CHASSIS_INSTANCES};
Patrick Williams4040b542022-04-20 16:35:25 -0500107 do
108 mkdir -p $D$systemd_system_unitdir/obmc-chassis-poweron@${i}.target.requires
109 LINK="$D$systemd_system_unitdir/obmc-chassis-poweron@${i}.target.requires/phosphor-chassis-check-power-status@${i}.service"
110 TARGET="../phosphor-chassis-check-power-status@.service"
111 ln -s $TARGET $LINK
Patrick Williams83a7aa92022-04-20 13:48:37 -0500112 done
113}
114
Andrew Geisslera02a18a2022-02-21 23:00:20 +0000115pkg_prerm:${PN}-chassis-check-power-status:append() {
Delphine CC Chiudb86eb12022-12-21 15:37:28 +0800116 for i in ${OBMC_CHASSIS_INSTANCES};
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600117 do
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600118 LINK="$D$systemd_system_unitdir/obmc-chassis-poweron@${i}.target.requires/phosphor-chassis-check-power-status@${i}.service"
119 rm $LINK
Patrick Williams4040b542022-04-20 16:35:25 -0500120 done
121}
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600122
Andrew Geissler19a6a522023-05-03 13:30:45 -0500123pkg_postinst:${PN}-chassis-poweron-log:append() {
124 for i in ${OBMC_CHASSIS_INSTANCES};
125 do
126 mkdir -p $D$systemd_system_unitdir/obmc-chassis-poweron@${i}.target.wants
127 LINK="$D$systemd_system_unitdir/obmc-chassis-poweron@${i}.target.wants/phosphor-create-chassis-poweron-log@${i}.service"
128 TARGET="../phosphor-create-chassis-poweron-log@.service"
129 ln -s $TARGET $LINK
130 done
131}
132
133pkg_prerm:${PN}-chassis-poweron-log:append() {
134 for i in ${OBMC_CHASSIS_INSTANCES};
135 do
136 LINK="$D$systemd_system_unitdir/obmc-chassis-poweron@${i}.target.wants/phosphor-create-chassis-poweron-log@${i}.service"
137 rm $LINK
138 done
139}
140
Patrick Williams4040b542022-04-20 16:35:25 -0500141pkg_postinst:${PN}-host:append() {
142 for i in ${OBMC_HOST_INSTANCES};
143 do
144 mkdir -p $D$systemd_system_unitdir/multi-user.target.requires
145 LINK="$D$systemd_system_unitdir/multi-user.target.requires/xyz.openbmc_project.State.Host@${i}.service"
146 TARGET="../xyz.openbmc_project.State.Host@.service"
147 ln -s $TARGET $LINK
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600148 done
Andrew Geisslera02a18a2022-02-21 23:00:20 +0000149}
Patrick Williamsad7adea2022-04-20 13:48:37 -0500150
151pkg_prerm:${PN}-host:append() {
152 for i in ${OBMC_HOST_INSTANCES};
153 do
Patrick Williamsad7adea2022-04-20 13:48:37 -0500154 LINK="$D$systemd_system_unitdir/multi-user.target.requires/xyz.openbmc_project.State.Host@${i}.service"
155 rm $LINK
Patrick Williamsad7adea2022-04-20 13:48:37 -0500156 done
157}
Andrew Geissler7f90ad82023-01-17 15:31:08 -0600158
159pkg_postinst:${PN}-scheduled-host-transition:append() {
160 for i in ${OBMC_HOST_INSTANCES};
161 do
162 mkdir -p $D$systemd_system_unitdir/multi-user.target.wants
163 LINK="$D$systemd_system_unitdir/multi-user.target.wants/xyz.openbmc_project.State.ScheduledHostTransition@${i}.service"
164 TARGET="../xyz.openbmc_project.State.ScheduledHostTransition@.service"
165 ln -s $TARGET $LINK
166 done
167}
168
169pkg_prerm:${PN}-scheduled-host-transition:append() {
170 for i in ${OBMC_HOST_INSTANCES};
171 do
172 LINK="$D$systemd_system_unitdir/multi-user.target.wants/xyz.openbmc_project.State.ScheduledHostTransition@${i}.service"
173 rm $LINK
174 done
175}