1 2# TODO: There are some targets that are chassis oriented, but there is no 3# obvious way to map HOST<->CHASSIS relationships. Making an assumption 4# currently that there is a 1-to-1 relationship between the two. 5 6pkg_postinst:${PN}-obmc-targets:append() { 7 8 for i in ${OBMC_HOST_INSTANCES}; 9 do 10 mkdir -p $D$systemd_system_unitdir/multi-user.target.requires 11 LINK="$D$systemd_system_unitdir/multi-user.target.requires/obmc-host-reset@${i}.target" 12 TARGET="../obmc-host-reset@.target" 13 ln -s $TARGET $LINK 14 15 LINK="$D$systemd_system_unitdir/multi-user.target.requires/phosphor-discover-system-state@${i}.service" 16 TARGET="../phosphor-discover-system-state@.service" 17 ln -s $TARGET $LINK 18 19 LINK="$D$systemd_system_unitdir/obmc-bmc-service-quiesce@${i}.target" 20 TARGET="./obmc-bmc-service-quiesce@.target" 21 ln -s $TARGET $LINK 22 23 mkdir -p $D$systemd_system_unitdir/obmc-chassis-poweron@${i}.target.wants 24 LINK="$D$systemd_system_unitdir/obmc-chassis-poweron@${i}.target.wants/phosphor-reset-host-recovery@${i}.service" 25 TARGET="../phosphor-reset-host-recovery@.service" 26 ln -s $TARGET $LINK 27 28 mkdir -p $D$systemd_system_unitdir/obmc-host-start@${i}.target.requires 29 LINK="$D$systemd_system_unitdir/obmc-host-start@${i}.target.requires/obmc-host-startmin@${i}.target" 30 TARGET="../obmc-host-startmin@.target" 31 ln -s $TARGET $LINK 32 33 LINK="$D$systemd_system_unitdir/obmc-host-start@${i}.target.requires/phosphor-reset-host-reboot-attempts@${i}.service" 34 TARGET="../phosphor-reset-host-reboot-attempts@.service" 35 ln -s $TARGET $LINK 36 37 mkdir -p $D$systemd_system_unitdir/obmc-host-startmin@${i}.target.wants 38 LINK="$D$systemd_system_unitdir/obmc-host-startmin@${i}.target.wants/phosphor-set-host-transition-to-running@${i}.service" 39 TARGET="../phosphor-set-host-transition-to-running@.service" 40 ln -s $TARGET $LINK 41 42 mkdir -p $D$systemd_system_unitdir/obmc-host-stop@${i}.target.wants 43 LINK="$D$systemd_system_unitdir/obmc-host-stop@${i}.target.wants/phosphor-set-host-transition-to-off@${i}.service" 44 TARGET="../phosphor-set-host-transition-to-off@.service" 45 ln -s $TARGET $LINK 46 47 mkdir -p $D$systemd_system_unitdir/obmc-host-reset@${i}.target.requires 48 LINK="$D$systemd_system_unitdir/obmc-host-reset@${i}.target.requires/phosphor-reset-host-running@${i}.service" 49 TARGET="../phosphor-reset-host-running@.service" 50 ln -s $TARGET $LINK 51 52 mkdir -p $D$systemd_system_unitdir/obmc-host-stop@${i}.target.wants 53 LINK="$D$systemd_system_unitdir/obmc-host-stop@${i}.target.wants/phosphor-reset-sensor-states@${i}.service" 54 TARGET="../phosphor-reset-sensor-states@.service" 55 ln -s $TARGET $LINK 56 57 mkdir -p $D$systemd_system_unitdir/obmc-host-quiesce@${i}.target.wants 58 LINK="$D$systemd_system_unitdir/obmc-host-quiesce@${i}.target.wants/phosphor-reset-sensor-states@${i}.service" 59 TARGET="../phosphor-reset-sensor-states@.service" 60 ln -s $TARGET $LINK 61 62 mkdir -p $D$systemd_system_unitdir/obmc-host-shutdown@${i}.target.requires 63 LINK="$D$systemd_system_unitdir/obmc-host-shutdown@${i}.target.requires/obmc-chassis-poweroff@${i}.target" 64 TARGET="../obmc-chassis-poweroff@.target" 65 ln -s $TARGET $LINK 66 67 mkdir -p $D$systemd_system_unitdir/obmc-host-reboot@${i}.target.requires 68 LINK="$D$systemd_system_unitdir/obmc-host-reboot@${i}.target.requires/obmc-host-shutdown@${i}.target" 69 TARGET="../obmc-host-shutdown@.target" 70 ln -s $TARGET $LINK 71 72 LINK="$D$systemd_system_unitdir/obmc-host-reboot@${i}.target.requires/phosphor-reboot-host@${i}.service" 73 TARGET="../phosphor-reboot-host@.service" 74 ln -s $TARGET $LINK 75 76 mkdir -p $D$systemd_system_unitdir/obmc-host-warm-reboot@${i}.target.requires 77 LINK="$D$systemd_system_unitdir/obmc-host-warm-reboot@${i}.target.requires/xyz.openbmc_project.Ipmi.Internal.SoftPowerOff.service" 78 TARGET="../xyz.openbmc_project.Ipmi.Internal.SoftPowerOff.service" 79 ln -s $TARGET $LINK 80 81 mkdir -p $D$systemd_system_unitdir/obmc-host-force-warm-reboot@${i}.target.requires 82 LINK="$D$systemd_system_unitdir/obmc-host-force-warm-reboot@${i}.target.requires/obmc-host-stop@${i}.target" 83 TARGET="../obmc-host-stop@.target" 84 ln -s $TARGET $LINK 85 86 LINK="$D$systemd_system_unitdir/obmc-host-force-warm-reboot@${i}.target.requires/phosphor-reboot-host@${i}.service" 87 TARGET="../phosphor-reboot-host@.service" 88 ln -s $TARGET $LINK 89 90 LINK="$D$systemd_system_unitdir/obmc-host-warm-reboot@${i}.target.requires/obmc-host-force-warm-reboot@${i}.target" 91 TARGET="../obmc-host-force-warm-reboot@.target" 92 ln -s $TARGET $LINK 93 94 mkdir -p $D$systemd_system_unitdir/obmc-chassis-poweroff@${i}.target.wants 95 LINK="$D$systemd_system_unitdir/obmc-chassis-poweroff@${i}.target.wants/phosphor-clear-one-time@${i}.service" 96 TARGET="../phosphor-clear-one-time@.service" 97 ln -s $TARGET $LINK 98 done 99} 100 101pkg_postinst:${PN}-chassis-check-power-status:append() { 102 103 for i in ${OBMC_HOST_INSTANCES}; 104 do 105 mkdir -p $D$systemd_system_unitdir/obmc-chassis-poweron@${i}.target.requires 106 LINK="$D$systemd_system_unitdir/obmc-chassis-poweron@${i}.target.requires/phosphor-chassis-check-power-status@${i}.service" 107 TARGET="../phosphor-chassis-check-power-status@.service" 108 ln -s $TARGET $LINK 109 done 110} 111 112pkg_prerm:${PN}-obmc-targets:append() { 113 114 for i in ${OBMC_HOST_INSTANCES}; 115 do 116 117 LINK="$D$systemd_system_unitdir/multi-user.target.requires/obmc-host-reset@${i}.target" 118 rm $LINK 119 120 LINK="$D$systemd_system_unitdir/multi-user.target.requires/phosphor-discover-system-state@${i}.service" 121 rm $LINK 122 123 LINK="$D$systemd_system_unitdir/obmc-chassis-poweron@${i}.target.wants/phosphor-reset-host-recovery@${i}.service" 124 rm $LINK 125 126 LINK="$D$systemd_system_unitdir/obmc-host-start@${i}.target.requires/obmc-host-startmin@${i}.target" 127 rm $LINK 128 129 LINK="$D$systemd_system_unitdir/obmc-host-start@${i}.target.requires/phosphor-reset-host-reboot-attempts@${i}.service" 130 rm $LINK 131 132 LINK="$D$systemd_system_unitdir/obmc-host-startmin@${i}.target.wants/phosphor-set-host-transition-to-running@${i}.service" 133 rm $LINK 134 135 LINK="$D$systemd_system_unitdir/obmc-host-stop@${i}.target.wants/phosphor-set-host-transition-to-off@${i}.service" 136 rm $LINK 137 138 LINK="$D$systemd_system_unitdir/obmc-host-stop@${i}.target.wants/phosphor-reset-sensor-states@${i}.service" 139 rm $LINK 140 141 LINK="$D$systemd_system_unitdir/obmc-host-quiesce@${i}.target.wants/phosphor-reset-sensor-states@${i}.service" 142 rm $LINK 143 144 LINK="$D$systemd_system_unitdir/obmc-host-reset@${i}.target.requires/phosphor-reset-host-running@${i}.service" 145 rm $LINK 146 147 LINK="$D$systemd_system_unitdir/obmc-host-shutdown@${i}.target.requires/obmc-chassis-poweroff@${i}.target" 148 rm $LINK 149 150 LINK="$D$systemd_system_unitdir/obmc-host-reboot@${i}.target.requires/obmc-host-shutdown@${i}.target" 151 rm $LINK 152 153 LINK="$D$systemd_system_unitdir/obmc-host-reboot@${i}.target.requires/phosphor-reboot-host@${i}.service" 154 rm $LINK 155 156 LINK="$D$systemd_system_unitdir/obmc-host-warm-reboot@${i}.target.requires/xyz.openbmc_project.Ipmi.Internal.SoftPowerOff.service" 157 rm $LINK 158 159 LINK="$D$systemd_system_unitdir/obmc-host-force-warm-reboot@${i}.target.requires/obmc-host-stop@${i}.target" 160 rm $LINK 161 162 LINK="$D$systemd_system_unitdir/obmc-host-force-warm-reboot@${i}.target.requires/phosphor-reboot-host@${i}.service" 163 rm $LINK 164 165 LINK="$D$systemd_system_unitdir/obmc-host-warm-reboot@${i}.target.requires/obmc-host-force-warm-reboot@${i}.target" 166 rm $LINK 167 168 LINK="$D$systemd_system_unitdir/obmc-chassis-poweroff@${i}.target.wants/phosphor-clear-one-time@${i}.service" 169 rm $LINK 170 171 done 172} 173 174pkg_prerm:${PN}-chassis-check-power-status:append() { 175 176 for i in ${OBMC_HOST_INSTANCES}; 177 do 178 179 LINK="$D$systemd_system_unitdir/obmc-chassis-poweron@${i}.target.requires/phosphor-chassis-check-power-status@${i}.service" 180 rm $LINK 181 182 done 183} 184