Skip to content

Instantly share code, notes, and snippets.

@Hayao0819
Last active April 1, 2022 06:52
Show Gist options
  • Save Hayao0819/9a2ae7c8ba500d547ebfc5c502d04905 to your computer and use it in GitHub Desktop.
Save Hayao0819/9a2ae7c8ba500d547ebfc5c502d04905 to your computer and use it in GitHub Desktop.
r8168-dkms for linux 5.17
PACKAGE_NAME="@PKGNAME@"
PACKAGE_VERSION="@PKGVER@"
MAKE[0]="make -C $kernel_source_dir M=$dkms_tree/$module/$module_version/build/src EXTRA_CFLAGS='-DCONFIG_R8168_NAPI -DCONFIG_R8168_VLAN' modules"
CLEAN="rm src/@PKGNAME@.ko src/*.o || true"
BUILT_MODULE_NAME[0]="@PKGNAME@"
BUILT_MODULE_LOCATION[0]="src/"
DEST_MODULE_LOCATION[0]="/kernel/drivers/net/ethernet/realtek"
AUTOINSTALL="yes"
# Maintainer: René Wagner <rwa at clttr dot info>
# Contributor: Juan Simón <play4pro at protonmail dot com>
# Contributor: alium
# Contributor: angelsl
# Contributer: hayao <hayao@fascode.net>
_pkgbase=r8168
pkgname=${_pkgbase}-dkms
pkgver=8.049.02
pkgrel=1
pkgdesc="A kernel module for Realtek 8168 network cards (DKMS version)"
url="https://github.com/mtorromeo/r8168"
license=("GPL")
arch=('i686' 'x86_64')
depends=('glibc' 'dkms')
makedepends=('git')
conflicts=("${pkgname}")
source=("r8168-dkms::git+https://github.com/mtorromeo/r8168.git"
"linux517.patch::https://raw.githubusercontent.com/archlinux/svntogit-community/packages/r8168/trunk/linux517.patch"
"dkms.conf")
install=r8168-dkms.install
prepare() {
cd "r8168-dkms"
patch -Np1 -i ../linux517.patch
}
package() {
install -Dm644 dkms.conf "${pkgdir}/usr/src/${_pkgbase}-${pkgver}/dkms.conf"
sed -e "s/@PKGNAME@/${_pkgbase}/g" \
-e "s/@PKGVER@/${pkgver}/g" \
-i "${pkgdir}/usr/src/${_pkgbase}-${pkgver}/dkms.conf"
cd "${pkgname}"
cp -dr --no-preserve='ownership' src "${pkgdir}/usr/src/${_pkgbase}-${pkgver}/src"
}
sha256sums=('SKIP'
'SKIP'
'e33abcbc8fbe3129459ebc60be3b2f8ed55ddc53755f4956d6feb16c61c43250')
post_install() {
dkms add r8168/${1%-*}
cat << EOF
==> The module r8168 conflicts with r8169. You can blacklist it with:
==> echo "blacklist r8169" > /etc/modprobe.d/r8169_blacklist.conf
EOF
}
pre_upgrade() {
pre_remove "$2"
}
post_upgrade() {
post_install "$1"
}
pre_remove() {
[ -n "${1%-*}" ] && dkms remove r8168/${1%-*} --all &>/dev/null || true
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment