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