diff options
Diffstat (limited to 'meta-phosphor/recipes-x86/chassis/x86-power-control_git.bb')
-rwxr-xr-x | meta-phosphor/recipes-x86/chassis/x86-power-control_git.bb | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/meta-phosphor/recipes-x86/chassis/x86-power-control_git.bb b/meta-phosphor/recipes-x86/chassis/x86-power-control_git.bb index 897c3a72f5..553a96b2d4 100755 --- a/meta-phosphor/recipes-x86/chassis/x86-power-control_git.bb +++ b/meta-phosphor/recipes-x86/chassis/x86-power-control_git.bb @@ -12,12 +12,6 @@ S = "${WORKDIR}/git" inherit meson systemd pkgconfig inherit obmc-phosphor-dbus-service -def get_service(d): - if(d.getVar('OBMC_HOST_INSTANCES') == '0'): - return "xyz.openbmc_project.Chassis.Control.Power@0.service" - else: - return " ".join(["xyz.openbmc_project.Chassis.Control.Power@{}.service".format(x) for x in d.getVar('OBMC_HOST_INSTANCES').split()]) -SYSTEMD_SERVICE:${PN} = "${@get_service(d)}" SYSTEMD_SERVICE:${PN} += "chassis-system-reset.service \ chassis-system-reset.target" DEPENDS += " \ @@ -29,3 +23,21 @@ DEPENDS += " \ phosphor-logging \ " FILES:${PN} += "${systemd_system_unitdir}/xyz.openbmc_project.Chassis.Control.Power@.service" + +pkg_postinst:${PN}:append() { + mkdir -p $D$systemd_system_unitdir/sysinit.target.wants + for i in ${OBMC_HOST_INSTANCES}; + do + LINK="$D$systemd_system_unitdir/sysinit.target.wants/xyz.openbmc_project.Chassis.Control.Power@${i}.service" + TARGET="../xyz.openbmc_project.Chassis.Control.Power@.service" + ln -s $TARGET $LINK + done +} + +pkg_prerm:${PN}:append() { + for i in ${OBMC_HOST_INSTANCES}; + do + LINK="$D$systemd_system_unitdir/sysinit.target.requires/xyz.openbmc_project.Chassis.Control.Power@${i}.service" + rm $LINK + done +} |