summaryrefslogtreecommitdiff
path: root/recipes-connectivity/hostapd/hostapd_%.bbappend
blob: c8f8fabdf41b1e789a93a3bceca89ab143aa215f (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
63
64
65
66
67
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"

PR = "m2"

do_install_append() {
	install -d ${D}{sysconfdir}/modprobe.d
	install -m 644 -D ${WORKDIR}/cfg80211.conf ${D}${sysconfdir}/modprobe.d/cfg80211.conf
}


# -p option is striplevel
SRC_URI += " file://cfg80211.conf \
           file://WiFi-SSID \
           file://setchan \
           file://default \
           file://init \
           file://defconfig \
           "

do_install() {
    install -d ${D}${sbindir} ${D}${sysconfdir}/init.d
    install -d ${D}${sbindir} ${D}${sysconfdir}/default
    install -m 0644 ${B}/hostapd.conf ${D}${sysconfdir}
    install -m 0755 ${B}/hostapd ${D}${sbindir}
    install -m 0755 ${B}/hostapd_cli ${D}${sbindir}
    install -m 755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/hostapd
    install -m 755 ${WORKDIR}/default ${D}${sysconfdir}/default/hostapd

    install -m 644 -D ${WORKDIR}/cfg80211.conf ${D}${sysconfdir}/modprobe.d/cfg80211.conf
    install -d ${D}/usr/share/hostapd
    install -m 0444 ${WORKDIR}/WiFi-SSID ${D}/usr/share/hostapd/WiFi-SSID.patch
    install -d ${D}/usr/local/bin
    install -m 0744 ${WORKDIR}/setchan ${D}/usr/local/bin
}

# ${PN}-extra sets a unique SSID name, and has a channel setting utility
PACKAGES =+ "${PN}-extra ${PN}-cfg"
RDEPENDS_${PN}-extra = "${PN}-cfg bash"

FILES_${PN}-extra = "/usr/local/bin/* /usr/share/hostapd/WiFi-SSID.patch"

# initscripts are unique to mLinux so put into ${PN}-cfg
INITSCRIPT_NAME_${PN}-cfg = "hostapd"
SYSTEMD_SERVICE_${PN}-cfg = "hostapd.service"
SYSTEMD_AUTO_ENABLE_${PN}-cfg = "disable"
INITSCRIPT_PACKAGES = "${PN}-cfg"
SYSTEMD_PACKAGES = "${PN}-cfg"
INITSCRIPT_NAME = ""
SYSTEMD_SERVICE_${PN} = ""
SYSTEMD_AUTO_ENABLE_${PN} = ""
SYSTEMD_SERVICE_${PN}-cfg = "hostapd.service"
SYSTEMD_AUTO_ENABLE_${PN}-cfg = "disable"

# mLinux files
FILES_${PN}-cfg = "/etc/init.d/hostapd /etc/default/hostapd /etc/hostapd.conf"

pkg_postinst_${PN}-extra() {
	cd /$D
    if patch --dry-run -p1 < $D/usr/share/hostapd/WiFi-SSID.patch ; then
        patch -p1 < $D/usr/share/hostapd/WiFi-SSID.patch
    fi
}

pkg_prerm_${PN}-extra() {
	cd /$D
	patch -Rp1 < $D/usr/share/hostapd/WiFi-SSID.patch
}