Patrick Williams | 3952f8b | 2022-04-20 16:25:53 -0500 | [diff] [blame] | 1 | DEFAULT_TARGETS = " \ |
Patrick Williams | 3952f8b | 2022-04-20 16:25:53 -0500 | [diff] [blame] | 2 | multi-user.target.requires/obmc-host-reset@{}.target \ |
Andrew Geissler | dee0025 | 2022-05-12 11:42:27 -0400 | [diff] [blame] | 3 | multi-user.target.wants/phosphor-discover-system-state@{}.service \ |
Patrick Williams | 3952f8b | 2022-04-20 16:25:53 -0500 | [diff] [blame] | 4 | obmc-chassis-poweron@{}.target.wants/phosphor-reset-host-recovery@{}.service \ |
| 5 | obmc-host-start@{}.target.requires/obmc-host-startmin@{}.target \ |
| 6 | obmc-host-start@{}.target.requires/phosphor-reset-host-reboot-attempts@{}.service \ |
| 7 | obmc-host-startmin@{}.target.wants/phosphor-set-host-transition-to-running@{}.service \ |
| 8 | obmc-host-stop@{}.target.wants/phosphor-set-host-transition-to-off@{}.service \ |
| 9 | obmc-host-reset@{}.target.requires/phosphor-reset-host-running@{}.service \ |
| 10 | obmc-host-stop@{}.target.wants/phosphor-reset-sensor-states@{}.service \ |
Andrew Geissler | 73f9365 | 2022-04-15 13:32:04 -0500 | [diff] [blame] | 11 | obmc-host-graceful-quiesce@{}.target.wants/obmc-host-quiesce@{}.target \ |
| 12 | obmc-host-graceful-quiesce@{}.target.wants/pldmSoftPowerOff.service \ |
Patrick Williams | 3952f8b | 2022-04-20 16:25:53 -0500 | [diff] [blame] | 13 | obmc-host-quiesce@{}.target.wants/phosphor-reset-sensor-states@{}.service \ |
| 14 | obmc-host-shutdown@{}.target.requires/obmc-chassis-poweroff@{}.target \ |
| 15 | obmc-host-reboot@{}.target.requires/obmc-host-shutdown@{}.target \ |
| 16 | obmc-host-reboot@{}.target.requires/phosphor-reboot-host@{}.service \ |
| 17 | obmc-host-warm-reboot@{}.target.requires/xyz.openbmc_project.Ipmi.Internal.SoftPowerOff.service \ |
| 18 | obmc-host-force-warm-reboot@{}.target.requires/obmc-host-stop@{}.target \ |
| 19 | obmc-host-force-warm-reboot@{}.target.requires/phosphor-reboot-host@{}.service \ |
| 20 | obmc-host-warm-reboot@{}.target.requires/obmc-host-force-warm-reboot@{}.target \ |
| 21 | obmc-chassis-poweroff@{}.target.wants/phosphor-clear-one-time@{}.service \ |
Andrew Geissler | e0ba7fb | 2022-07-06 14:51:03 -0500 | [diff] [blame] | 22 | obmc-chassis-blackout@{}.target.wants/phosphor-reset-sensor-states@{}.service \ |
Patrick Williams | 3952f8b | 2022-04-20 16:25:53 -0500 | [diff] [blame] | 23 | " |
Patrick Williams | 4c7b3e6 | 2022-03-09 15:56:34 -0600 | [diff] [blame] | 24 | |
| 25 | # TODO: There are some targets that are chassis oriented, but there is no |
| 26 | # obvious way to map HOST<->CHASSIS relationships. Making an assumption |
| 27 | # currently that there is a 1-to-1 relationship between the two. |
| 28 | |
Patrick Williams | 12fc939 | 2021-08-06 09:16:53 -0500 | [diff] [blame] | 29 | pkg_postinst:${PN}-obmc-targets:append() { |
Patrick Williams | 4c7b3e6 | 2022-03-09 15:56:34 -0600 | [diff] [blame] | 30 | for i in ${OBMC_HOST_INSTANCES}; |
| 31 | do |
Patrick Williams | 3952f8b | 2022-04-20 16:25:53 -0500 | [diff] [blame] | 32 | for j in ${DEFAULT_TARGETS}; |
| 33 | do |
| 34 | LINK="$D$systemd_system_unitdir/${j}" |
| 35 | LINK="$(echo ${LINK} | sed s/{}/${i}/g )" |
| 36 | TARGET="../$(basename ${j} | sed s/{}//g )" |
| 37 | mkdir -p "$(dirname ${LINK})" |
| 38 | ln -s "${TARGET}" "${LINK}" |
| 39 | done |
Patrick Williams | 4c7b3e6 | 2022-03-09 15:56:34 -0600 | [diff] [blame] | 40 | done |
Andrew Geissler | 20cff70 | 2020-03-09 16:51:27 -0500 | [diff] [blame] | 41 | } |
| 42 | |
Patrick Williams | 12fc939 | 2021-08-06 09:16:53 -0500 | [diff] [blame] | 43 | pkg_prerm:${PN}-obmc-targets:append() { |
Patrick Williams | 4c7b3e6 | 2022-03-09 15:56:34 -0600 | [diff] [blame] | 44 | for i in ${OBMC_HOST_INSTANCES}; |
| 45 | do |
Patrick Williams | 3952f8b | 2022-04-20 16:25:53 -0500 | [diff] [blame] | 46 | for j in ${DEFAULT_TARGETS}; |
| 47 | do |
| 48 | LINK="$D$systemd_system_unitdir/${j}" |
| 49 | LINK="$(echo ${LINK} | sed s/{}/${i}/g )" |
| 50 | rm "${LINK}" |
| 51 | done |
Patrick Williams | 4c7b3e6 | 2022-03-09 15:56:34 -0600 | [diff] [blame] | 52 | done |
Andrew Geissler | 20cff70 | 2020-03-09 16:51:27 -0500 | [diff] [blame] | 53 | } |
Andrew Geissler | a02a18a | 2022-02-21 23:00:20 +0000 | [diff] [blame] | 54 | |
Patrick Williams | 4040b54 | 2022-04-20 16:35:25 -0500 | [diff] [blame] | 55 | pkg_postinst:${PN}-chassis:append() { |
| 56 | for i in ${OBMC_CHASSIS_INSTANCES}; |
| 57 | do |
| 58 | mkdir -p $D$systemd_system_unitdir/multi-user.target.requires |
| 59 | LINK="$D$systemd_system_unitdir/multi-user.target.requires/xyz.openbmc_project.State.Chassis@${i}.service" |
| 60 | TARGET="../xyz.openbmc_project.State.Chassis@.service" |
| 61 | ln -s $TARGET $LINK |
| 62 | done |
| 63 | } |
| 64 | |
Patrick Williams | 83a7aa9 | 2022-04-20 13:48:37 -0500 | [diff] [blame] | 65 | pkg_prerm:${PN}-chassis:append() { |
Patrick Williams | 954512d | 2022-04-20 15:01:07 -0500 | [diff] [blame] | 66 | for i in ${OBMC_CHASSIS_INSTANCES}; |
Patrick Williams | 83a7aa9 | 2022-04-20 13:48:37 -0500 | [diff] [blame] | 67 | do |
Patrick Williams | 83a7aa9 | 2022-04-20 13:48:37 -0500 | [diff] [blame] | 68 | LINK="$D$systemd_system_unitdir/multi-user.target.requires/xyz.openbmc_project.State.Chassis@${i}.service" |
| 69 | rm $LINK |
Patrick Williams | 4040b54 | 2022-04-20 16:35:25 -0500 | [diff] [blame] | 70 | done |
| 71 | } |
Patrick Williams | 83a7aa9 | 2022-04-20 13:48:37 -0500 | [diff] [blame] | 72 | |
Patrick Williams | 4040b54 | 2022-04-20 16:35:25 -0500 | [diff] [blame] | 73 | pkg_postinst:${PN}-chassis-check-power-status:append() { |
| 74 | for i in ${OBMC_HOST_INSTANCES}; |
| 75 | do |
| 76 | mkdir -p $D$systemd_system_unitdir/obmc-chassis-poweron@${i}.target.requires |
| 77 | LINK="$D$systemd_system_unitdir/obmc-chassis-poweron@${i}.target.requires/phosphor-chassis-check-power-status@${i}.service" |
| 78 | TARGET="../phosphor-chassis-check-power-status@.service" |
| 79 | ln -s $TARGET $LINK |
Patrick Williams | 83a7aa9 | 2022-04-20 13:48:37 -0500 | [diff] [blame] | 80 | done |
| 81 | } |
| 82 | |
Andrew Geissler | a02a18a | 2022-02-21 23:00:20 +0000 | [diff] [blame] | 83 | pkg_prerm:${PN}-chassis-check-power-status:append() { |
Patrick Williams | 4c7b3e6 | 2022-03-09 15:56:34 -0600 | [diff] [blame] | 84 | for i in ${OBMC_HOST_INSTANCES}; |
| 85 | do |
Patrick Williams | 4c7b3e6 | 2022-03-09 15:56:34 -0600 | [diff] [blame] | 86 | LINK="$D$systemd_system_unitdir/obmc-chassis-poweron@${i}.target.requires/phosphor-chassis-check-power-status@${i}.service" |
| 87 | rm $LINK |
Patrick Williams | 4040b54 | 2022-04-20 16:35:25 -0500 | [diff] [blame] | 88 | done |
| 89 | } |
Patrick Williams | 4c7b3e6 | 2022-03-09 15:56:34 -0600 | [diff] [blame] | 90 | |
Patrick Williams | 4040b54 | 2022-04-20 16:35:25 -0500 | [diff] [blame] | 91 | pkg_postinst:${PN}-host:append() { |
| 92 | for i in ${OBMC_HOST_INSTANCES}; |
| 93 | do |
| 94 | mkdir -p $D$systemd_system_unitdir/multi-user.target.requires |
| 95 | LINK="$D$systemd_system_unitdir/multi-user.target.requires/xyz.openbmc_project.State.Host@${i}.service" |
| 96 | TARGET="../xyz.openbmc_project.State.Host@.service" |
| 97 | ln -s $TARGET $LINK |
Patrick Williams | 4c7b3e6 | 2022-03-09 15:56:34 -0600 | [diff] [blame] | 98 | done |
Andrew Geissler | a02a18a | 2022-02-21 23:00:20 +0000 | [diff] [blame] | 99 | } |
Patrick Williams | ad7adea | 2022-04-20 13:48:37 -0500 | [diff] [blame] | 100 | |
| 101 | pkg_prerm:${PN}-host:append() { |
| 102 | for i in ${OBMC_HOST_INSTANCES}; |
| 103 | do |
Patrick Williams | ad7adea | 2022-04-20 13:48:37 -0500 | [diff] [blame] | 104 | LINK="$D$systemd_system_unitdir/multi-user.target.requires/xyz.openbmc_project.State.Host@${i}.service" |
| 105 | rm $LINK |
Patrick Williams | ad7adea | 2022-04-20 13:48:37 -0500 | [diff] [blame] | 106 | done |
| 107 | } |