Delphine CC Chiu | db86eb1 | 2022-12-21 15:37:28 +0800 | [diff] [blame] | 1 | HOST_DEFAULT_TARGETS = " \ |
Patrick Williams | 3952f8b | 2022-04-20 16:25:53 -0500 | [diff] [blame] | 2 | multi-user.target.requires/obmc-host-reset@{}.target \ |
Delphine CC Chiu | 6b8809e | 2023-02-07 17:12:26 +0800 | [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-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 \ |
Patrick Williams | 07e91c7 | 2024-02-05 11:11:42 -0600 | [diff] [blame] | 10 | obmc-host-shutdown@{}.target.requires/obmc-host-stop@{}.target \ |
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 \ |
Patrick Williams | 3952f8b | 2022-04-20 16:25:53 -0500 | [diff] [blame] | 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 \ |
Delphine CC Chiu | db86eb1 | 2022-12-21 15:37:28 +0800 | [diff] [blame] | 20 | " |
| 21 | |
| 22 | CHASSIS_DEFAULT_TARGETS = " \ |
Delphine CC Chiu | db86eb1 | 2022-12-21 15:37:28 +0800 | [diff] [blame] | 23 | obmc-chassis-poweron@{}.target.wants/phosphor-reset-host-recovery@{}.service \ |
| 24 | obmc-chassis-poweron@{}.target.requires/obmc-power-start@{}.service \ |
Andrew Geissler | dcdd5ec | 2023-12-08 10:40:15 -0600 | [diff] [blame] | 25 | obmc-chassis-poweron@{}.target.requires/phosphor-set-chassis-transition-to-on@{}.service \ |
Delphine CC Chiu | db86eb1 | 2022-12-21 15:37:28 +0800 | [diff] [blame] | 26 | obmc-host-shutdown@{}.target.requires/obmc-chassis-poweroff@{}.target \ |
| 27 | obmc-chassis-poweroff@{}.target.requires/obmc-power-stop@{}.service \ |
| 28 | obmc-chassis-poweroff@{}.target.requires/obmc-powered-off@{}.service \ |
Patrick Williams | 3952f8b | 2022-04-20 16:25:53 -0500 | [diff] [blame] | 29 | obmc-chassis-poweroff@{}.target.wants/phosphor-clear-one-time@{}.service \ |
Andrew Geissler | dcdd5ec | 2023-12-08 10:40:15 -0600 | [diff] [blame] | 30 | obmc-chassis-poweroff@{}.target.requires/phosphor-set-chassis-transition-to-off@{}.service \ |
Andrew Geissler | e0ba7fb | 2022-07-06 14:51:03 -0500 | [diff] [blame] | 31 | obmc-chassis-blackout@{}.target.wants/phosphor-reset-sensor-states@{}.service \ |
Thu Nguyen | 1859f25 | 2022-12-29 11:21:48 +0700 | [diff] [blame] | 32 | obmc-chassis-powerreset@{}.target.requires/phosphor-reset-chassis-on@{}.service \ |
| 33 | obmc-chassis-powerreset@{}.target.requires/phosphor-reset-chassis-running@{}.service \ |
Patrick Williams | 3952f8b | 2022-04-20 16:25:53 -0500 | [diff] [blame] | 34 | " |
Patrick Williams | 4c7b3e6 | 2022-03-09 15:56:34 -0600 | [diff] [blame] | 35 | |
| 36 | # TODO: There are some targets that are chassis oriented, but there is no |
| 37 | # obvious way to map HOST<->CHASSIS relationships. Making an assumption |
| 38 | # currently that there is a 1-to-1 relationship between the two. |
| 39 | |
Patrick Williams | 12fc939 | 2021-08-06 09:16:53 -0500 | [diff] [blame] | 40 | pkg_postinst:${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 |
Delphine CC Chiu | db86eb1 | 2022-12-21 15:37:28 +0800 | [diff] [blame] | 43 | for j in ${HOST_DEFAULT_TARGETS}; |
| 44 | do |
| 45 | LINK="$D$systemd_system_unitdir/${j}" |
| 46 | LINK="$(echo ${LINK} | sed s/{}/${i}/g )" |
| 47 | TARGET="../$(basename ${j} | sed s/{}//g )" |
| 48 | mkdir -p "$(dirname ${LINK})" |
| 49 | ln -s "${TARGET}" "${LINK}" |
| 50 | done |
| 51 | done |
| 52 | |
| 53 | for i in ${OBMC_CHASSIS_INSTANCES}; |
| 54 | do |
| 55 | for j in ${CHASSIS_DEFAULT_TARGETS}; |
Patrick Williams | 3952f8b | 2022-04-20 16:25:53 -0500 | [diff] [blame] | 56 | do |
| 57 | LINK="$D$systemd_system_unitdir/${j}" |
| 58 | LINK="$(echo ${LINK} | sed s/{}/${i}/g )" |
| 59 | TARGET="../$(basename ${j} | sed s/{}//g )" |
| 60 | mkdir -p "$(dirname ${LINK})" |
| 61 | ln -s "${TARGET}" "${LINK}" |
| 62 | done |
Patrick Williams | 4c7b3e6 | 2022-03-09 15:56:34 -0600 | [diff] [blame] | 63 | done |
Andrew Geissler | 20cff70 | 2020-03-09 16:51:27 -0500 | [diff] [blame] | 64 | } |
| 65 | |
Patrick Williams | 12fc939 | 2021-08-06 09:16:53 -0500 | [diff] [blame] | 66 | pkg_prerm:${PN}-obmc-targets:append() { |
Patrick Williams | 4c7b3e6 | 2022-03-09 15:56:34 -0600 | [diff] [blame] | 67 | for i in ${OBMC_HOST_INSTANCES}; |
| 68 | do |
Delphine CC Chiu | db86eb1 | 2022-12-21 15:37:28 +0800 | [diff] [blame] | 69 | for j in ${HOST_DEFAULT_TARGETS}; |
| 70 | do |
| 71 | LINK="$D$systemd_system_unitdir/${j}" |
| 72 | LINK="$(echo ${LINK} | sed s/{}/${i}/g )" |
| 73 | rm "${LINK}" |
| 74 | done |
| 75 | done |
| 76 | |
| 77 | for i in ${OBMC_CHASSIS_INSTANCES}; |
| 78 | do |
| 79 | for j in ${CHASSIS_DEFAULT_TARGETS}; |
Patrick Williams | 3952f8b | 2022-04-20 16:25:53 -0500 | [diff] [blame] | 80 | do |
| 81 | LINK="$D$systemd_system_unitdir/${j}" |
| 82 | LINK="$(echo ${LINK} | sed s/{}/${i}/g )" |
| 83 | rm "${LINK}" |
| 84 | done |
Patrick Williams | 4c7b3e6 | 2022-03-09 15:56:34 -0600 | [diff] [blame] | 85 | done |
Andrew Geissler | 20cff70 | 2020-03-09 16:51:27 -0500 | [diff] [blame] | 86 | } |
Andrew Geissler | a02a18a | 2022-02-21 23:00:20 +0000 | [diff] [blame] | 87 | |
Patrick Williams | 4040b54 | 2022-04-20 16:35:25 -0500 | [diff] [blame] | 88 | pkg_postinst:${PN}-chassis:append() { |
| 89 | for i in ${OBMC_CHASSIS_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.Chassis@${i}.service" |
| 93 | TARGET="../xyz.openbmc_project.State.Chassis@.service" |
| 94 | ln -s $TARGET $LINK |
| 95 | done |
| 96 | } |
| 97 | |
Patrick Williams | 83a7aa9 | 2022-04-20 13:48:37 -0500 | [diff] [blame] | 98 | pkg_prerm:${PN}-chassis:append() { |
Patrick Williams | 954512d | 2022-04-20 15:01:07 -0500 | [diff] [blame] | 99 | for i in ${OBMC_CHASSIS_INSTANCES}; |
Patrick Williams | 83a7aa9 | 2022-04-20 13:48:37 -0500 | [diff] [blame] | 100 | do |
Patrick Williams | 83a7aa9 | 2022-04-20 13:48:37 -0500 | [diff] [blame] | 101 | LINK="$D$systemd_system_unitdir/multi-user.target.requires/xyz.openbmc_project.State.Chassis@${i}.service" |
| 102 | rm $LINK |
Patrick Williams | 4040b54 | 2022-04-20 16:35:25 -0500 | [diff] [blame] | 103 | done |
| 104 | } |
Patrick Williams | 83a7aa9 | 2022-04-20 13:48:37 -0500 | [diff] [blame] | 105 | |
Patrick Williams | 4040b54 | 2022-04-20 16:35:25 -0500 | [diff] [blame] | 106 | pkg_postinst:${PN}-chassis-check-power-status:append() { |
Delphine CC Chiu | db86eb1 | 2022-12-21 15:37:28 +0800 | [diff] [blame] | 107 | for i in ${OBMC_CHASSIS_INSTANCES}; |
Patrick Williams | 4040b54 | 2022-04-20 16:35:25 -0500 | [diff] [blame] | 108 | do |
| 109 | mkdir -p $D$systemd_system_unitdir/obmc-chassis-poweron@${i}.target.requires |
| 110 | LINK="$D$systemd_system_unitdir/obmc-chassis-poweron@${i}.target.requires/phosphor-chassis-check-power-status@${i}.service" |
| 111 | TARGET="../phosphor-chassis-check-power-status@.service" |
| 112 | ln -s $TARGET $LINK |
Patrick Williams | 83a7aa9 | 2022-04-20 13:48:37 -0500 | [diff] [blame] | 113 | done |
| 114 | } |
| 115 | |
Andrew Geissler | a02a18a | 2022-02-21 23:00:20 +0000 | [diff] [blame] | 116 | pkg_prerm:${PN}-chassis-check-power-status:append() { |
Delphine CC Chiu | db86eb1 | 2022-12-21 15:37:28 +0800 | [diff] [blame] | 117 | for i in ${OBMC_CHASSIS_INSTANCES}; |
Patrick Williams | 4c7b3e6 | 2022-03-09 15:56:34 -0600 | [diff] [blame] | 118 | do |
Patrick Williams | 4c7b3e6 | 2022-03-09 15:56:34 -0600 | [diff] [blame] | 119 | LINK="$D$systemd_system_unitdir/obmc-chassis-poweron@${i}.target.requires/phosphor-chassis-check-power-status@${i}.service" |
| 120 | rm $LINK |
Patrick Williams | 4040b54 | 2022-04-20 16:35:25 -0500 | [diff] [blame] | 121 | done |
| 122 | } |
Patrick Williams | 4c7b3e6 | 2022-03-09 15:56:34 -0600 | [diff] [blame] | 123 | |
Andrew Geissler | 19a6a52 | 2023-05-03 13:30:45 -0500 | [diff] [blame] | 124 | pkg_postinst:${PN}-chassis-poweron-log:append() { |
| 125 | for i in ${OBMC_CHASSIS_INSTANCES}; |
| 126 | do |
| 127 | mkdir -p $D$systemd_system_unitdir/obmc-chassis-poweron@${i}.target.wants |
| 128 | LINK="$D$systemd_system_unitdir/obmc-chassis-poweron@${i}.target.wants/phosphor-create-chassis-poweron-log@${i}.service" |
| 129 | TARGET="../phosphor-create-chassis-poweron-log@.service" |
| 130 | ln -s $TARGET $LINK |
| 131 | done |
| 132 | } |
| 133 | |
| 134 | pkg_prerm:${PN}-chassis-poweron-log:append() { |
| 135 | for i in ${OBMC_CHASSIS_INSTANCES}; |
| 136 | do |
| 137 | LINK="$D$systemd_system_unitdir/obmc-chassis-poweron@${i}.target.wants/phosphor-create-chassis-poweron-log@${i}.service" |
| 138 | rm $LINK |
| 139 | done |
| 140 | } |
| 141 | |
Patrick Williams | 4040b54 | 2022-04-20 16:35:25 -0500 | [diff] [blame] | 142 | pkg_postinst:${PN}-host:append() { |
| 143 | for i in ${OBMC_HOST_INSTANCES}; |
| 144 | do |
| 145 | mkdir -p $D$systemd_system_unitdir/multi-user.target.requires |
| 146 | LINK="$D$systemd_system_unitdir/multi-user.target.requires/xyz.openbmc_project.State.Host@${i}.service" |
| 147 | TARGET="../xyz.openbmc_project.State.Host@.service" |
| 148 | ln -s $TARGET $LINK |
Patrick Williams | 4c7b3e6 | 2022-03-09 15:56:34 -0600 | [diff] [blame] | 149 | done |
Andrew Geissler | a02a18a | 2022-02-21 23:00:20 +0000 | [diff] [blame] | 150 | } |
Patrick Williams | ad7adea | 2022-04-20 13:48:37 -0500 | [diff] [blame] | 151 | |
| 152 | pkg_prerm:${PN}-host:append() { |
| 153 | for i in ${OBMC_HOST_INSTANCES}; |
| 154 | do |
Patrick Williams | ad7adea | 2022-04-20 13:48:37 -0500 | [diff] [blame] | 155 | LINK="$D$systemd_system_unitdir/multi-user.target.requires/xyz.openbmc_project.State.Host@${i}.service" |
| 156 | rm $LINK |
Patrick Williams | ad7adea | 2022-04-20 13:48:37 -0500 | [diff] [blame] | 157 | done |
| 158 | } |
Andrew Geissler | 7f90ad8 | 2023-01-17 15:31:08 -0600 | [diff] [blame] | 159 | |
| 160 | pkg_postinst:${PN}-scheduled-host-transition:append() { |
| 161 | for i in ${OBMC_HOST_INSTANCES}; |
| 162 | do |
| 163 | mkdir -p $D$systemd_system_unitdir/multi-user.target.wants |
| 164 | LINK="$D$systemd_system_unitdir/multi-user.target.wants/xyz.openbmc_project.State.ScheduledHostTransition@${i}.service" |
| 165 | TARGET="../xyz.openbmc_project.State.ScheduledHostTransition@.service" |
| 166 | ln -s $TARGET $LINK |
| 167 | done |
| 168 | } |
| 169 | |
| 170 | pkg_prerm:${PN}-scheduled-host-transition:append() { |
| 171 | for i in ${OBMC_HOST_INSTANCES}; |
| 172 | do |
| 173 | LINK="$D$systemd_system_unitdir/multi-user.target.wants/xyz.openbmc_project.State.ScheduledHostTransition@${i}.service" |
| 174 | rm $LINK |
| 175 | done |
| 176 | } |