summaryrefslogtreecommitdiff
path: root/meta-ibm/recipes-phosphor/leds/phosphor-led-manager_%.bbappend
blob: b36adcae5a87266788def0a1cca24a2122fbb808 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"

SYSTEMD_SERVICE:${PN}:append:p10bmc = " obmc-led-set-all-groups-asserted@.service obmc-led-create-virtual-leds@.service"

# Copies config file having arguments for led-set-all-groups-asserted.sh
SYSTEMD_ENVIRONMENT_FILE:${PN}:append:p10bmc =" obmc/led/set-all/groups/config"

# Use the JSON configuration file at runtime than the static led.yaml
# Also, enable Lamp Test and OperationalStatus monitor feature for
# p10bmc systems
PACKAGECONFIG:append:p10bmc = " use-lamp-test monitor-operational-status persistent-led-asserted"

# Install the lamp test override file for p10bmc
SRC_URI:append:p10bmc = " file://lamp-test-led-overrides.json"

pkg_postinst:${PN}:p10bmc () {

    # Needed this to run as part of BMC boot
    mkdir -p $D$systemd_system_unitdir/multi-user.target.wants
    LINK="$D$systemd_system_unitdir/multi-user.target.wants/obmc-led-set-all-groups-asserted@false.service"
    TARGET="../obmc-led-set-all-groups-asserted@.service"
    ln -s $TARGET $LINK

    # Needed this to run as part of Power On
    mkdir -p $D$systemd_system_unitdir/obmc-chassis-poweron@0.target.wants
    LINK="$D$systemd_system_unitdir/obmc-chassis-poweron@0.target.wants/obmc-led-set-all-groups-asserted@false.service"
    TARGET="../obmc-led-set-all-groups-asserted@.service"
    ln -s $TARGET $LINK

    # Needed this to run as part of BMC boot
    mkdir -p $D$systemd_system_unitdir/multi-user.target.wants
    LINK_FAULT="$D$systemd_system_unitdir/multi-user.target.wants/obmc-led-create-virtual-leds@sys-class-leds-virtual-enc-fault.service"
    TARGET_FAULT="../obmc-led-create-virtual-leds@.service"
    ln -s $TARGET_FAULT $LINK_FAULT

    # Needed this to run as part of BMC boot
    mkdir -p $D$systemd_system_unitdir/multi-user.target.wants
    LINK_ID="$D$systemd_system_unitdir/multi-user.target.wants/obmc-led-create-virtual-leds@sys-class-leds-virtual-enc-id.service"
    TARGET_ID="../obmc-led-create-virtual-leds@.service"
    ln -s $TARGET_ID $LINK_ID
}

pkg_prerm:${PN}:p10bmc () {

    LINK="$D$systemd_system_unitdir/multi-user.target.wants/obmc-led-set-all-groups-asserted@false.service"
    rm $LINK

    LINK="$D$systemd_system_unitdir/obmc-chassis-poweron@0.target.wants/obmc-led-set-all-groups-asserted@false.service"
    rm $LINK

    LINK_FAULT="$D$systemd_system_unitdir/multi-user.target.wants/obmc-led-create-virtual-leds@sys-class-leds-virtual-enc-fault.service"
    rm $LINK_FAULT

    LINK_ID="$D$systemd_system_unitdir/multi-user.target.wants/obmc-led-create-virtual-leds@sys-class-leds-virtual-enc-id.service"
    rm $LINK_ID
}

# Install lamp test override json
do_install:append:p10bmc() {
    install -d ${D}${datadir}/${BPN}/
    install -m 0644 ${WORKDIR}/lamp-test-led-overrides.json ${D}${datadir}/${BPN}/
}