summaryrefslogtreecommitdiff
path: root/recipes-core/set-hostname/set-hostname_1.0.bb
blob: 15fa66b55a7e05ff994e1f3a57c4c6739a89e1d5 (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
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"

PACKAGE_ARCH = "${MACHINE_ARCH}"

inherit systemd

SRC_URI += " \
    file://sethostname \
    file://set-hostname.service \
"

FILES_${PN} = " \
    ${bindir} \
    ${systemd_system_unitdir} \
"

SYSTEMD_SERVICE_${PN} = " \
    set-hostname.service \
"

do_install () {
    install -d ${D}${bindir}
    install -m 0755 ${WORKDIR}/sethostname ${D}${bindir}
    sed -i "s/@@MACHINE@@/${MACHINE}/g" ${D}${bindir}/sethostname
    if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
        install -d ${D}${systemd_system_unitdir}
        install -m 0644 ${WORKDIR}/set-hostname.service ${D}${systemd_system_unitdir}
    fi
}