]> git.friedersdorff.com Git - max/gentoo-overlay.git/commitdiff
net-wireless/rtl8812au: Add ebuild for wifi driver
authorMaximilian Friedersdorff <max@friedersdorff.com>
Tue, 19 Feb 2019 12:15:42 +0000 (12:15 +0000)
committerMaximilian Friedersdorff <max@friedersdorff.com>
Tue, 19 Feb 2019 12:15:42 +0000 (12:15 +0000)
net-wireless/rtl8812au/metadata.xml [new file with mode: 0644]
net-wireless/rtl8812au/rtl8812au-9999.ebuild [new file with mode: 0644]

diff --git a/net-wireless/rtl8812au/metadata.xml b/net-wireless/rtl8812au/metadata.xml
new file mode 100644 (file)
index 0000000..5816a63
--- /dev/null
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+       <maintainer type="person">
+               <email>max@friedersdorff.com</email>
+               <name>Maximilian Friedersdorff</name>
+       </maintainer>
+       <use>
+               <flag name="module">Compile the actual rtl8812AU kernel module. Most certainly you want this enabled, unless you're doing something strange.</flag>
+               <flag name="module-src">Install the module source code to /usr/src, in case you like building kernel modules yourself.</flag>
+       </use>
+</pkgmetadata>
diff --git a/net-wireless/rtl8812au/rtl8812au-9999.ebuild b/net-wireless/rtl8812au/rtl8812au-9999.ebuild
new file mode 100644 (file)
index 0000000..e46580d
--- /dev/null
@@ -0,0 +1,82 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+MODULES_OPTIONAL_USE="module"
+inherit linux-mod bash-completion-r1
+
+DESCRIPTION="Driver module for Realtek 8811, 8812, 8814 and 8821 chipsets. From aircrack-ng"
+HOMEPAGE="https://github.com/aircrack-ng/rtl8812au.git"
+
+if [[ ${PV} == 9999 ]]; then
+       inherit git-r3
+       EGIT_REPO_URI="https://github.com/aircrack-ng/rtl8812au"
+       KEYWORDS=""
+else
+       die "Only support building directly from git for now"
+fi
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE="+module module-src"
+
+MODULE_NAMES="88XXau(kernel/drivers/net/wireless)"
+BUILD_TARGETS="modules"
+CONFIG_CHECK=""
+
+pkg_setup() {
+       if use module; then
+               linux-mod_pkg_setup
+               kernel_is -lt 3 10 0 && die "This version of ${PN} requires Linux >= 3.10"
+       fi
+}
+
+src_compile() {
+       BUILD_PARAMS="KERNELDIR=${KERNEL_DIR}"
+       use module && linux-mod_src_compile
+}
+
+src_install() {
+       use module && linux-mod_src_install
+       use module-src && dodir /usr/src && cp -r "${S}" "${ED}/usr/src/${PN}"
+}
+
+pkg_postinst() {
+       if use module-src && ! use module; then
+               einfo
+               einfo "You have enabled the module-src USE flag without the module USE"
+               einfo "flag. This means that sources are installed to"
+               einfo "${ROOT}usr/src/88XXau instead of having the"
+               einfo "kernel module compiled. You will need to compile the module"
+               einfo "yourself. Most likely, you don't want this USE flag, and should"
+               einfo "rather use USE=module"
+               einfo
+       fi
+       use module && linux-mod_pkg_postinst
+
+       if use module; then
+               local old new
+               if [[ $(uname -r) != "${KV_FULL}" ]]; then
+                       ewarn
+                       ewarn "You have just built the rtl8812AU driver for kernel ${KV_FULL}, yet the currently running"
+                       ewarn "kernel is $(uname -r). If you intend to use this driver module on the currently"
+                       ewarn "running machine, you will first need to reboot it into the kernel ${KV_FULL}, for"
+                       ewarn "which this module was built."
+                       ewarn
+               elif [[ -f /sys/module/88XXau/version ]] && \
+                    old="$(< /sys/module/88XXau/version)" && \
+                    new="$(modinfo -F version "${ROOT}/lib/modules/${KV_FULL}/net/wireless/88XXau.ko" 2>/dev/null)" && \
+                    [[ $old != "$new" ]]; then
+                       ewarn
+                       ewarn "You appear to have just upgraded rtl8812AU from version v$old to v$new."
+                       ewarn "However, the old version is still running on your system. In order to use the"
+                       ewarn "new version, you will need to remove the old module and load the new one. As"
+                       ewarn "root, you can accomplish this with the following commands:"
+                       ewarn
+                       ewarn "    # rmmod 88XXau"
+                       ewarn "    # modprobe 88XXau"
+                       ewarn
+               fi
+       fi
+}