# Maintainer: Joan Figueras # Contributor: Torge Matthies # Contributor: Jan Alexander Steffens (heftig) # Contributor: SoftExpert _arch=x64v1 _pkgbase=linux-xanmod _major=6.8 _minor=7 _branch=6.x _xanmodrel=1 _xanmodrev= pkgrel=2 pkgbase=${_pkgbase}-linux-bin-${_arch} pkgver=${_major}.${_minor} pkgname=("${pkgbase}" "${_pkgbase}-linux-headers-bin-${_arch}") pkgdesc="The Linux kernel and modules with Xanmod patches - Current Stable (MAIN) - Prebuilt version - ${_arch}" url="http://www.xanmod.org/" arch=(x86_64) license=(GPL2) options=('!strip') makedepends=('curl' 'libxml2') # Resolve URL of sources from SourceForge provider and cache the response of the API to reduce the number of calls made _xml_data=$(curl -L -s "https://sourceforge.net/projects/xanmod/rss?path=/releases/main") # retrieve the headers URL and remove the "/download" suffix _t=$(echo "${_xml_data}" | xmllint --debug --xpath "string(//*[local-name()='content'][@type='application/x-debian-package; charset=binary' and contains(@url, '"${_arch}"') and contains(@url, 'linux-headers') and contains(@url, '"${pkgver}"')]/@url)" -) _url_headers="${_t//'/download'}" # retrieve the image URL and remove the "/download" suffix _t=$(echo "${_xml_data}" | xmllint --debug --xpath "string(//*[local-name()='content'][@type='application/x-debian-package; charset=binary' and contains(@url, '"${_arch}"') and contains(@url, 'linux-image') and not(contains(@url, '-dbg_')) and contains(@url, '"${pkgver}"')]/@url)" -) _url_image="${_t//'/download'}" # Resolve URL of sources from GiHub provider # cache the response of the API to reduce the number of calls made to GitHub; not authenticated calls are limited to 60 per hour #_json_data=$(curl -L -s https://api.github.com/repos/xanmod/linux/releases/tags/${pkgver}-xanmod${_xanmodrel}${_xanmodrev}) #_url_image=$(echo "${_json_data}" | jq --arg PKGVER "${pkgver}" --arg PKGREL "${_xanmodrel}" --arg ARCH "${_arch}" -r '.assets[] | select(.name | startswith("linux-image-" + $PKGVER + "-" + $ARCH + "-xanmod" + $PKGREL) and endswith(".deb")).browser_download_url') #_url_headers=$(echo "${_json_data}" | jq --arg PKGVER "${pkgver}" --arg PKGREL "${_xanmodrel}" --arg ARCH "${_arch}" -r '.assets[] | select(.name | startswith("linux-headers-" + $PKGVER + "-" + $ARCH + "-xanmod" + $PKGREL) and endswith(".deb")).browser_download_url') source=("${_url_image}" "${_url_headers}") noextract=("${_url_image}" "${_url_headers}") # Save files we will extract later manually _file_image="${_url_image##*/}" _file_headers="${_url_headers##*/}" prepare() { bsdtar -xf ${_file_image} data.tar.xz bsdtar -xf data.tar.xz rm -f data.tar.xz bsdtar -xf ${_file_headers} data.tar.xz bsdtar -xf data.tar.xz rm -f data.tar.xz } validpgpkeys=( 'ABAF11C65A2970B130ABE3C479BE3E4300411886' # Linux Torvalds '647F28654894E3BD457199BE38DBBDC86092693E' # Greg Kroah-Hartman ) sha256sums=('5e0540dc4b17a2548a96ce8f7f6ddd3a75e4bdbfd3c409ddadd546d644ec303e' 'b93789edc63853fbad485cde35493ab9936558b9e07d10ec1ff70ed26a6ac456') _package() { pkgdesc="The Linux kernel and modules with Xanmod patches - Current Stable (MAIN) - Prebuilt version - ${_arch}" depends=(coreutils kmod initramfs) optdepends=('crda: to set the correct wireless channels of your country' 'linux-firmware: firmware images needed for some devices') provides=(VIRTUALBOX-GUEST-MODULES WIREGUARD-MODULE KSMBD-MODULE NTFS3-MODULE) local kernver="${pkgver}-${_arch}-xanmod${_xanmodrel}" local modulesdir="${pkgdir}/usr/lib/modules/${kernver}" mkdir -p "${modulesdir}" "${pkgdir}/usr/share/doc" mkdir -p "${pkgdir}"/{boot,usr/lib/modules} msg2 "Installing modules..." cp -r lib/modules/${kernver}/* "${modulesdir}/" # Docs cp -r usr/share/doc/linux-image-* "${pkgdir}/usr/share/doc/" msg2 "Installing boot image..." # systemd expects to find the kernel here to allow hibernation # https://github.com/systemd/systemd/commit/edda44605f06a41fb86b7ab8128dcf99161d2344 install -Dm644 "boot/vmlinuz-${kernver}" "${modulesdir}/vmlinuz" # Used by mkinitcpio to name the kernel echo "${pkgbase}" | install -Dm644 /dev/stdin "${modulesdir}/pkgbase" echo "${kernver}" | install -Dm644 /dev/stdin "${modulesdir}/kernelbase" # write kernel version for Grub echo "${kernver}${_xanmodrev}" | install -Dm644 /dev/stdin "${pkgdir}/boot/${pkgbase}.kver" local _extramodules="extramodules-${kernver}" ln -s "../${_extramodules}" "${modulesdir}/extramodules" # add real version for building modules and running depmod from hook echo "${kernver}" | install -Dm644 /dev/stdin "${pkgdir}/usr/lib/modules/${_extramodules}/version" # Remove builddir because is a symbolic link and it belongs to headers rm -f "${modulesdir}/build" } _package-headers() { pkgdesc="Headers and scripts for building modules for the Linux Xanmod - Current Stable (MAIN) - Prebuilt version - ${_arch}" depends=(pahole) local kernver="${pkgver}-${_arch}-xanmod${_xanmodrel}" local builddir="${pkgdir}/usr/lib/modules/${kernver}/build" mkdir -p "${pkgdir}"/usr/share/doc "${pkgdir}"/usr/src "${pkgdir}/usr/lib/modules/${kernver}" cp -r usr/share/doc/linux-headers-* "${pkgdir}/usr/share/doc/" cp -r usr/src/linux-headers-${kernver} "${builddir}" ln -sr "${builddir}" "${pkgdir}/usr/src/${pkgbase}" } eval "package_${pkgname[0]}() { _package \"\$@\"; }" eval "package_${pkgname[1]}() { _package-headers \"\$@\"; }" # vim:set ts=8 sts=2 sw=2 et: