summaryrefslogtreecommitdiffstats
path: root/meta-agl/recipes-graphics/wayland/weston-init.bbappend
blob: 2e87572b3d1df3e90e90ec894f53ac083652e8d0 (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}:"

inherit agl-graphical

WESTONSTART ??= "/usr/bin/weston --idle-time=4294967 --tty=${WESTONTTY}"
WESTONSTART_append = " ${@bb.utils.contains("IMAGE_FEATURES", "debug-tweaks", " --log=${DISPLAY_XDG_RUNTIME_DIR}/weston.log", "",d)}"

SRC_URI += " \
    file://weston_tmpfiles.conf \
    file://weston.service.add \
"

do_install_append() {
    sed -i "/\[Unit\]/aConflicts=getty@tty${WESTONTTY}.service" \
           ${D}${systemd_system_unitdir}/weston.service

    sed -i "/\[Service\]/r ${S}/weston.service.add" \
           ${D}${systemd_system_unitdir}/weston.service

    sed -e 's,User=root,User=${WESTONUSER},g' \
        -e 's,ExecStart=.*,ExecStart=${WESTONSTART},g' \
        -e 's,@WESTONTTY@,${WESTONTTY},g' \
        -e 's,@XDG_RUNTIME_DIR@,${DISPLAY_XDG_RUNTIME_DIR},g' \
        -i ${D}${systemd_system_unitdir}/weston.service

    # Add a rule to ensure the 'display' user has permissions to
    # open the graphics device
    install -d ${D}${sysconfdir}/init.d
    install -d ${D}${sysconfdir}/udev/rules.d
    cat >${D}${sysconfdir}/udev/rules.d/zz-dri.rules <<'EOF'
SUBSYSTEM=="drm", MODE="0660", GROUP="${WESTONGROUP}", SECLABEL{smack}="*"
EOF

    # user 'display' must own /dev/tty${WESTONTTY} for weston to start correctly
    cat >${D}${sysconfdir}/udev/rules.d/zz-tty.rules <<'EOF'
SUBSYSTEM=="tty", KERNEL=="tty${WESTONTTY}", OWNER="${WESTONUSER}", SECLABEL{smack}="^"
EOF

    # user 'display' must also be able to access /dev/input/*
    cat >${D}${sysconfdir}/udev/rules.d/zz-input.rules <<'EOF'
SUBSYSTEM=="input", MODE="0660", GROUP="input", SECLABEL{smack}="^"
EOF

    # user 'display' must also be able to access /dev/media*, etc.
    cat >${D}${sysconfdir}/udev/rules.d/zz-remote-display.rules <<'EOF'
SUBSYSTEM=="media", MODE="0660", GROUP="display", SECLABEL{smack}="*"
SUBSYSTEM=="video4linux", MODE="0660", GROUP="display", SECLABEL{smack}="*"
KERNEL=="uvcs", SUBSYSTEM=="misc", MODE="0660", GROUP="display", SECLABEL{smack}="*"
KERNEL=="rgnmm", SUBSYSTEM=="misc", MODE="0660", GROUP="display", SECLABEL{smack}="*"
EOF

    install -d ${D}${sysconfdir}/tmpfiles.d
    install -Dm755 ${WORKDIR}/weston_tmpfiles.conf ${D}/${libdir}/tmpfiles.d/weston.conf

    sed -e 's,@WESTONUSER@,${WESTONUSER},g' \
        -e 's,@WESTONGROUP@,${WESTONGROUP},g' \
        -i ${D}/${libdir}/tmpfiles.d/weston.conf
}

FILES_${PN} += "${libdir}/tmpfiles.d/*.conf"
lt;cc:Work rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs id="defs92" /><sodipodi:namedview pagecolor="#ffffff" bordercolor="#666666" borderopacity="1" objecttolerance="10" gridtolerance="10" guidetolerance="10" inkscape:pageopacity="0" inkscape:pageshadow="2" inkscape:window-width="2560" inkscape:window-height="1464" id="namedview90" showgrid="false" inkscape:zoom="1.372093" inkscape:cx="-266.38136" inkscape:cy="86" inkscape:window-x="0" inkscape:window-y="0" inkscape:window-maximized="1" inkscape:current-layer="svg2" /><style type="text/css" id="style4"> .st0{display:none;} .st1{display:inline;} .st2{opacity:0.15;fill:url(#SVGID_1_);} .st3{opacity:0.15;fill:url(#SVGID_2_);stroke:url(#SVGID_3_);stroke-miterlimit:10;} .st4{fill:url(#SVGID_4_);} .st5{display:inline;fill:#66FF99;} .st6{font-family:'Roboto-Light';} .st7{font-size:78.8169px;} .st8{opacity:0.15;fill:url(#SVGID_5_);} .st9{opacity:0.35;fill:url(#SVGID_6_);} .st10{opacity:0.15;fill:url(#SVGID_7_);} .st11{opacity:0.15;fill:url(#SVGID_8_);stroke:url(#SVGID_9_);stroke-miterlimit:10;} .st12{fill:url(#SVGID_10_);} .st13{fill:#FFFFFF;} </style><switch id="switch6"><g i:extraneous="self" id="g8"><g id="Active"><linearGradient id="SVGID_5_" gradientUnits="userSpaceOnUse" x1="1.2348" y1="170.7652" x2="170.7652" y2="1.2348"><stop offset="0" style="stop-color:#FFFFFF;stop-opacity:0" id="stop45" /><stop offset="1" style="stop-color:#000000" id="stop47" /></linearGradient><rect x="1.2" y="1.2" class="st8" width="169.5" height="169.5" id="rect49" /><linearGradient id="SVGID_6_" gradientUnits="userSpaceOnUse" x1="-0.9569" y1="168.4538" x2="172.9569" y2="3.5462"><stop offset="0.136" style="stop-color:#5DFE9F;stop-opacity:0.94" id="stop52" /><stop offset="0.6043" style="stop-color:#6BFBFF;stop-opacity:0.6" id="stop54" /></linearGradient><rect x="1.2" y="1.2" class="st9" width="169.5" height="169.5" id="rect56" /><g id="g58"><linearGradient id="SVGID_7_" gradientUnits="userSpaceOnUse" x1="1.2348" y1="170.7652" x2="170.7652" y2="1.2348"><stop offset="0" style="stop-color:#FFFFFF;stop-opacity:0" id="stop61" /><stop offset="1" style="stop-color:#000000" id="stop63" /></linearGradient><rect x="1.2" y="1.2" class="st10" width="169.5" height="169.5" id="rect65" /><linearGradient id="SVGID_8_" gradientUnits="userSpaceOnUse" x1="1" y1="171" x2="171" y2="1"><stop offset="0" style="stop-color:#FFFFFF;stop-opacity:0" id="stop68" /><stop offset="1" style="stop-color:#000000" id="stop70" /></linearGradient><linearGradient id="SVGID_9_" gradientUnits="userSpaceOnUse" x1="-1.7107" y1="169.1686" x2="173.7107" y2="2.8314"><stop offset="0" style="stop-color:#8BC53F" id="stop73" /><stop offset="1" style="stop-color:#0DF9FF" id="stop75" /></linearGradient><rect x="1" y="1" class="st11" width="170" height="170" id="rect77" /><g id="g79"><linearGradient id="SVGID_10_" gradientUnits="userSpaceOnUse" x1="-2.2236" y1="169.6549" x2="174.2236" y2="2.3451"><stop offset="0" style="stop-color:#59FF7F" id="stop82" /><stop offset="1" style="stop-color:#6BFBFF" id="stop84" /></linearGradient><path class="st12" d="M171,1v170H1V1H171 M172,0h-1H1H0v1v170v1h1h170h1v-1V1V0L172,0z" id="path86" /></g></g><text transform="matrix(1 5.460000e-03 -5.460000e-03 1 64.0738 111.6182)" class="st13 st6 st7" id="text88">9</text> </g></g></switch></svg>