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