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