blob: fee2daa2a140a527cb37303f1403fbdc3e6cdd76 [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 \
24 obmc-host-shutdown@{}.target.requires/obmc-chassis-poweroff@{}.target \
25 obmc-chassis-poweroff@{}.target.requires/obmc-power-stop@{}.service \
26 obmc-chassis-poweroff@{}.target.requires/obmc-powered-off@{}.service \
Patrick Williams3952f8b2022-04-20 16:25:53 -050027 obmc-chassis-poweroff@{}.target.wants/phosphor-clear-one-time@{}.service \
Andrew Geisslere0ba7fb2022-07-06 14:51:03 -050028 obmc-chassis-blackout@{}.target.wants/phosphor-reset-sensor-states@{}.service \
Thu Nguyen1859f252022-12-29 11:21:48 +070029 obmc-chassis-powerreset@{}.target.requires/phosphor-reset-chassis-on@{}.service \
30 obmc-chassis-powerreset@{}.target.requires/phosphor-reset-chassis-running@{}.service \
Patrick Williams3952f8b2022-04-20 16:25:53 -050031"
Patrick Williams4c7b3e62022-03-09 15:56:34 -060032
33# TODO: There are some targets that are chassis oriented, but there is no
34# obvious way to map HOST<->CHASSIS relationships. Making an assumption
35# currently that there is a 1-to-1 relationship between the two.
36
Patrick Williams12fc9392021-08-06 09:16:53 -050037pkg_postinst:${PN}-obmc-targets:append() {
Patrick Williams4c7b3e62022-03-09 15:56:34 -060038 for i in ${OBMC_HOST_INSTANCES};
39 do
Delphine CC Chiudb86eb12022-12-21 15:37:28 +080040 for j in ${HOST_DEFAULT_TARGETS};
41 do
42 LINK="$D$systemd_system_unitdir/${j}"
43 LINK="$(echo ${LINK} | sed s/{}/${i}/g )"
44 TARGET="../$(basename ${j} | sed s/{}//g )"
45 mkdir -p "$(dirname ${LINK})"
46 ln -s "${TARGET}" "${LINK}"
47 done
48 done
49
50 for i in ${OBMC_CHASSIS_INSTANCES};
51 do
52 for j in ${CHASSIS_DEFAULT_TARGETS};
Patrick Williams3952f8b2022-04-20 16:25:53 -050053 do
54 LINK="$D$systemd_system_unitdir/${j}"
55 LINK="$(echo ${LINK} | sed s/{}/${i}/g )"
56 TARGET="../$(basename ${j} | sed s/{}//g )"
57 mkdir -p "$(dirname ${LINK})"
58 ln -s "${TARGET}" "${LINK}"
59 done
Patrick Williams4c7b3e62022-03-09 15:56:34 -060060 done
Andrew Geissler20cff702020-03-09 16:51:27 -050061}
62
Patrick Williams12fc9392021-08-06 09:16:53 -050063pkg_prerm:${PN}-obmc-targets:append() {
Patrick Williams4c7b3e62022-03-09 15:56:34 -060064 for i in ${OBMC_HOST_INSTANCES};
65 do
Delphine CC Chiudb86eb12022-12-21 15:37:28 +080066 for j in ${HOST_DEFAULT_TARGETS};
67 do
68 LINK="$D$systemd_system_unitdir/${j}"
69 LINK="$(echo ${LINK} | sed s/{}/${i}/g )"
70 rm "${LINK}"
71 done
72 done
73
74 for i in ${OBMC_CHASSIS_INSTANCES};
75 do
76 for j in ${CHASSIS_DEFAULT_TARGETS};
Patrick Williams3952f8b2022-04-20 16:25:53 -050077 do
78 LINK="$D$systemd_system_unitdir/${j}"
79 LINK="$(echo ${LINK} | sed s/{}/${i}/g )"
80 rm "${LINK}"
81 done
Patrick Williams4c7b3e62022-03-09 15:56:34 -060082 done
Andrew Geissler20cff702020-03-09 16:51:27 -050083}
Andrew Geisslera02a18a2022-02-21 23:00:20 +000084
Patrick Williams4040b542022-04-20 16:35:25 -050085pkg_postinst:${PN}-chassis:append() {
86 for i in ${OBMC_CHASSIS_INSTANCES};
87 do
88 mkdir -p $D$systemd_system_unitdir/multi-user.target.requires
89 LINK="$D$systemd_system_unitdir/multi-user.target.requires/xyz.openbmc_project.State.Chassis@${i}.service"
90 TARGET="../xyz.openbmc_project.State.Chassis@.service"
91 ln -s $TARGET $LINK
92 done
93}
94
Patrick Williams83a7aa92022-04-20 13:48:37 -050095pkg_prerm:${PN}-chassis:append() {
Patrick Williams954512d2022-04-20 15:01:07 -050096 for i in ${OBMC_CHASSIS_INSTANCES};
Patrick Williams83a7aa92022-04-20 13:48:37 -050097 do
Patrick Williams83a7aa92022-04-20 13:48:37 -050098 LINK="$D$systemd_system_unitdir/multi-user.target.requires/xyz.openbmc_project.State.Chassis@${i}.service"
99 rm $LINK
Patrick Williams4040b542022-04-20 16:35:25 -0500100 done
101}
Patrick Williams83a7aa92022-04-20 13:48:37 -0500102
Patrick Williams4040b542022-04-20 16:35:25 -0500103pkg_postinst:${PN}-chassis-check-power-status:append() {
Delphine CC Chiudb86eb12022-12-21 15:37:28 +0800104 for i in ${OBMC_CHASSIS_INSTANCES};
Patrick Williams4040b542022-04-20 16:35:25 -0500105 do
106 mkdir -p $D$systemd_system_unitdir/obmc-chassis-poweron@${i}.target.requires
107 LINK="$D$systemd_system_unitdir/obmc-chassis-poweron@${i}.target.requires/phosphor-chassis-check-power-status@${i}.service"
108 TARGET="../phosphor-chassis-check-power-status@.service"
109 ln -s $TARGET $LINK
Patrick Williams83a7aa92022-04-20 13:48:37 -0500110 done
111}
112
Andrew Geisslera02a18a2022-02-21 23:00:20 +0000113pkg_prerm:${PN}-chassis-check-power-status:append() {
Delphine CC Chiudb86eb12022-12-21 15:37:28 +0800114 for i in ${OBMC_CHASSIS_INSTANCES};
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600115 do
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600116 LINK="$D$systemd_system_unitdir/obmc-chassis-poweron@${i}.target.requires/phosphor-chassis-check-power-status@${i}.service"
117 rm $LINK
Patrick Williams4040b542022-04-20 16:35:25 -0500118 done
119}
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600120
Andrew Geissler19a6a522023-05-03 13:30:45 -0500121pkg_postinst:${PN}-chassis-poweron-log:append() {
122 for i in ${OBMC_CHASSIS_INSTANCES};
123 do
124 mkdir -p $D$systemd_system_unitdir/obmc-chassis-poweron@${i}.target.wants
125 LINK="$D$systemd_system_unitdir/obmc-chassis-poweron@${i}.target.wants/phosphor-create-chassis-poweron-log@${i}.service"
126 TARGET="../phosphor-create-chassis-poweron-log@.service"
127 ln -s $TARGET $LINK
128 done
129}
130
131pkg_prerm:${PN}-chassis-poweron-log:append() {
132 for i in ${OBMC_CHASSIS_INSTANCES};
133 do
134 LINK="$D$systemd_system_unitdir/obmc-chassis-poweron@${i}.target.wants/phosphor-create-chassis-poweron-log@${i}.service"
135 rm $LINK
136 done
137}
138
Patrick Williams4040b542022-04-20 16:35:25 -0500139pkg_postinst:${PN}-host:append() {
140 for i in ${OBMC_HOST_INSTANCES};
141 do
142 mkdir -p $D$systemd_system_unitdir/multi-user.target.requires
143 LINK="$D$systemd_system_unitdir/multi-user.target.requires/xyz.openbmc_project.State.Host@${i}.service"
144 TARGET="../xyz.openbmc_project.State.Host@.service"
145 ln -s $TARGET $LINK
Patrick Williams4c7b3e62022-03-09 15:56:34 -0600146 done
Andrew Geisslera02a18a2022-02-21 23:00:20 +0000147}
Patrick Williamsad7adea2022-04-20 13:48:37 -0500148
149pkg_prerm:${PN}-host:append() {
150 for i in ${OBMC_HOST_INSTANCES};
151 do
Patrick Williamsad7adea2022-04-20 13:48:37 -0500152 LINK="$D$systemd_system_unitdir/multi-user.target.requires/xyz.openbmc_project.State.Host@${i}.service"
153 rm $LINK
Patrick Williamsad7adea2022-04-20 13:48:37 -0500154 done
155}
Andrew Geissler7f90ad82023-01-17 15:31:08 -0600156
157pkg_postinst:${PN}-scheduled-host-transition:append() {
158 for i in ${OBMC_HOST_INSTANCES};
159 do
160 mkdir -p $D$systemd_system_unitdir/multi-user.target.wants
161 LINK="$D$systemd_system_unitdir/multi-user.target.wants/xyz.openbmc_project.State.ScheduledHostTransition@${i}.service"
162 TARGET="../xyz.openbmc_project.State.ScheduledHostTransition@.service"
163 ln -s $TARGET $LINK
164 done
165}
166
167pkg_prerm:${PN}-scheduled-host-transition:append() {
168 for i in ${OBMC_HOST_INSTANCES};
169 do
170 LINK="$D$systemd_system_unitdir/multi-user.target.wants/xyz.openbmc_project.State.ScheduledHostTransition@${i}.service"
171 rm $LINK
172 done
173}