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