SUMMARY = "Belgian Keyboard Layout Configuration"
DESCRIPTION = "Sets up Belgian keyboard layout on boot"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"

SRC_URI = "file://keyboard-setup.sh"

S = "${WORKDIR}"

do_install() {
    # Install keyboard setup script
    install -d ${D}${bindir}
    install -m 0755 ${WORKDIR}/keyboard-setup.sh ${D}${bindir}/
    
    # Create keyboard setup service
    install -d ${D}${sysconfdir}/systemd/system
    cat > ${D}${sysconfdir}/systemd/system/keyboard-setup.service << EOF
[Unit]
Description=Setup Belgian Keyboard Layout
DefaultDependencies=false
Before=sysinit.target

[Service]
Type=oneshot
ExecStart=${bindir}/keyboard-setup.sh
RemainAfterExit=yes

[Install]
WantedBy=sysinit.target
EOF

    # Enable service
    install -d ${D}${sysconfdir}/systemd/system/sysinit.target.wants
    ln -sf ${sysconfdir}/systemd/system/keyboard-setup.service ${D}${sysconfdir}/systemd/system/sysinit.target.wants/keyboard-setup.service
}

FILES:${PN} = "${bindir}/keyboard-setup.sh \
               ${sysconfdir}/systemd/system/keyboard-setup.service \
               ${sysconfdir}/systemd/system/sysinit.target.wants/*"

RDEPENDS:${PN} = "systemd kbd"