1*86a1ebf9SAndrew Geissler[Unit]
2*86a1ebf9SAndrew GeisslerDescription=Check Chassis%i pgood and create a file to indicate it
3*86a1ebf9SAndrew GeisslerWants=mapper-wait@-org-openbmc-control-power%i.service
4*86a1ebf9SAndrew GeisslerAfter=mapper-wait@-org-openbmc-control-power%i.service
5*86a1ebf9SAndrew GeisslerWants=obmc-power-reset-on@%i.target
6*86a1ebf9SAndrew GeisslerBefore=obmc-power-reset-on@%i.target
7*86a1ebf9SAndrew GeisslerConflicts=obmc-chassis-poweroff@%i.target
8*86a1ebf9SAndrew Geissler
9*86a1ebf9SAndrew Geissler[Service]
10*86a1ebf9SAndrew GeisslerRemainAfterExit=no
11*86a1ebf9SAndrew GeisslerType=oneshot
12*86a1ebf9SAndrew GeisslerExecStart=/bin/sh -c "if [ $(busctl get-property `mapper get-service /org/openbmc/control/power%i` /org/openbmc/control/power%i org.openbmc.control.Power pgood | sed 's/i\s*[1]/on/' | grep on | wc -l) != 0 ]; then mkdir -p /run/openbmc/ && touch /run/openbmc/chassis@%i-on; fi"
13*86a1ebf9SAndrew Geissler
14*86a1ebf9SAndrew Geissler[Install]
15*86a1ebf9SAndrew GeisslerWantedBy=obmc-chassis-powerreset@%i.target
16