Skip to content

Commit

Permalink
fix: refactor modules dir to use version file (#272)
Browse files Browse the repository at this point in the history
refactor modules dir to use version file generated by kernel makefile

that way we use whatever kernel generated for the modules dir name,
rather than guessing the name of the kernel modules ourselfs
  • Loading branch information
vnepogodin authored Jul 21, 2024
1 parent bc3a34d commit 4a0effe
Show file tree
Hide file tree
Showing 11 changed files with 165 additions and 69 deletions.
21 changes: 15 additions & 6 deletions linux-cachyos-bore/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -705,9 +705,12 @@ _package-zfs(){
provides=('ZFS-MODULE')
license=('CDDL')

cd ${srcdir}/$_srcname
local modulesdir="$pkgdir/usr/lib/modules/$(<version)"

cd ${srcdir}/"zfs"
install -dm755 "$pkgdir/usr/lib/modules/${_kernver}-${pkgsuffix}"
install -m644 module/*.ko "$pkgdir/usr/lib/modules/${_kernver}-${pkgsuffix}"
install -dm755 "${modulesdir}"
install -m644 module/*.ko "${modulesdir}"
find "$pkgdir" -name '*.ko' -exec zstd --rm -10 {} +
# sed -i -e "s/EXTRAMODULES='.*'/EXTRAMODULES='${pkgver}-${pkgbase}'/" "$startdir/zfs.install"
}
Expand All @@ -719,9 +722,12 @@ _package-nvidia(){
conflicts=("$pkgbase-nvidia-open")
license=('custom')

cd ${srcdir}/$_srcname
local modulesdir="$pkgdir/usr/lib/modules/$(<version)"

cd "${srcdir}/${_nv_pkg}/"
install -dm755 "$pkgdir/usr/lib/modules/${_kernver}-${pkgsuffix}"
install -m644 kernel/*.ko "$pkgdir/usr/lib/modules/${_kernver}-${pkgsuffix}"
install -dm755 "${modulesdir}"
install -m644 kernel/*.ko "${modulesdir}"
install -Dt "$pkgdir/usr/share/licenses/${pkgname}" -m644 LICENSE
find "$pkgdir" -name '*.ko' -exec zstd --rm -10 {} +
}
Expand All @@ -733,9 +739,12 @@ _package-nvidia-open(){
conflicts=("$pkgbase-nvidia")
license=(GPL-1.0-only)

cd ${srcdir}/$_srcname
local modulesdir="$pkgdir/usr/lib/modules/$(<version)"

cd "${srcdir}/${_nv_open_pkg}"
install -dm755 "$pkgdir/usr/lib/modules/${_kernver}-${pkgsuffix}"
install -m644 kernel-open/*.ko "$pkgdir/usr/lib/modules/${_kernver}-${pkgsuffix}"
install -dm755 "${modulesdir}"
install -m644 kernel-open/*.ko "${modulesdir}"
install -Dt "$pkgdir/usr/share/licenses/${pkgname}" -m644 COPYING

find "$pkgdir" -name '*.ko' -exec zstd --rm -10 {} +
Expand Down
21 changes: 15 additions & 6 deletions linux-cachyos-deckify/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -707,9 +707,12 @@ _package-zfs(){
provides=('ZFS-MODULE')
license=('CDDL')

cd ${srcdir}/$_srcname
local modulesdir="$pkgdir/usr/lib/modules/$(<version)"

cd ${srcdir}/"zfs"
install -dm755 "$pkgdir/usr/lib/modules/${_kernver}-${pkgsuffix}"
install -m644 module/*.ko "$pkgdir/usr/lib/modules/${_kernver}-${pkgsuffix}"
install -dm755 "${modulesdir}"
install -m644 module/*.ko "${modulesdir}"
find "$pkgdir" -name '*.ko' -exec zstd --rm -10 {} +
# sed -i -e "s/EXTRAMODULES='.*'/EXTRAMODULES='${pkgver}-${pkgbase}'/" "$startdir/zfs.install"
}
Expand All @@ -721,9 +724,12 @@ _package-nvidia(){
conflicts=("$pkgbase-nvidia-open")
license=('custom')

cd ${srcdir}/$_srcname
local modulesdir="$pkgdir/usr/lib/modules/$(<version)"

cd "${srcdir}/${_nv_pkg}/"
install -dm755 "$pkgdir/usr/lib/modules/${_kernver}-${pkgsuffix}"
install -m644 kernel/*.ko "$pkgdir/usr/lib/modules/${_kernver}-${pkgsuffix}"
install -dm755 "${modulesdir}"
install -m644 kernel/*.ko "${modulesdir}"
install -Dt "$pkgdir/usr/share/licenses/${pkgname}" -m644 LICENSE
find "$pkgdir" -name '*.ko' -exec zstd --rm -10 {} +
}
Expand All @@ -735,9 +741,12 @@ _package-nvidia-open(){
conflicts=("$pkgbase-nvidia")
license=(GPL-1.0-only)

cd ${srcdir}/$_srcname
local modulesdir="$pkgdir/usr/lib/modules/$(<version)"

cd "${srcdir}/${_nv_open_pkg}"
install -dm755 "$pkgdir/usr/lib/modules/${_kernver}-${pkgsuffix}"
install -m644 kernel-open/*.ko "$pkgdir/usr/lib/modules/${_kernver}-${pkgsuffix}"
install -dm755 "${modulesdir}"
install -m644 kernel-open/*.ko "${modulesdir}"
install -Dt "$pkgdir/usr/share/licenses/${pkgname}" -m644 COPYING

find "$pkgdir" -name '*.ko' -exec zstd --rm -10 {} +
Expand Down
21 changes: 15 additions & 6 deletions linux-cachyos-echo/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -705,9 +705,12 @@ _package-zfs(){
provides=('ZFS-MODULE')
license=('CDDL')

cd ${srcdir}/$_srcname
local modulesdir="$pkgdir/usr/lib/modules/$(<version)"

cd ${srcdir}/"zfs"
install -dm755 "$pkgdir/usr/lib/modules/${_kernver}-${pkgsuffix}"
install -m644 module/*.ko "$pkgdir/usr/lib/modules/${_kernver}-${pkgsuffix}"
install -dm755 "${modulesdir}"
install -m644 module/*.ko "${modulesdir}"
find "$pkgdir" -name '*.ko' -exec zstd --rm -10 {} +
# sed -i -e "s/EXTRAMODULES='.*'/EXTRAMODULES='${pkgver}-${pkgbase}'/" "$startdir/zfs.install"
}
Expand All @@ -719,9 +722,12 @@ _package-nvidia(){
conflicts=("$pkgbase-nvidia-open")
license=('custom')

cd ${srcdir}/$_srcname
local modulesdir="$pkgdir/usr/lib/modules/$(<version)"

cd "${srcdir}/${_nv_pkg}/"
install -dm755 "$pkgdir/usr/lib/modules/${_kernver}-${pkgsuffix}"
install -m644 kernel/*.ko "$pkgdir/usr/lib/modules/${_kernver}-${pkgsuffix}"
install -dm755 "${modulesdir}"
install -m644 kernel/*.ko "${modulesdir}"
install -Dt "$pkgdir/usr/share/licenses/${pkgname}" -m644 LICENSE
find "$pkgdir" -name '*.ko' -exec zstd --rm -10 {} +
}
Expand All @@ -733,9 +739,12 @@ _package-nvidia-open(){
conflicts=("$pkgbase-nvidia")
license=(GPL-1.0-only)

cd ${srcdir}/$_srcname
local modulesdir="$pkgdir/usr/lib/modules/$(<version)"

cd "${srcdir}/${_nv_open_pkg}"
install -dm755 "$pkgdir/usr/lib/modules/${_kernver}-${pkgsuffix}"
install -m644 kernel-open/*.ko "$pkgdir/usr/lib/modules/${_kernver}-${pkgsuffix}"
install -dm755 "${modulesdir}"
install -m644 kernel-open/*.ko "${modulesdir}"
install -Dt "$pkgdir/usr/share/licenses/${pkgname}" -m644 COPYING

find "$pkgdir" -name '*.ko' -exec zstd --rm -10 {} +
Expand Down
21 changes: 15 additions & 6 deletions linux-cachyos-eevdf/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -705,9 +705,12 @@ _package-zfs(){
provides=('ZFS-MODULE')
license=('CDDL')

cd ${srcdir}/$_srcname
local modulesdir="$pkgdir/usr/lib/modules/$(<version)"

cd ${srcdir}/"zfs"
install -dm755 "$pkgdir/usr/lib/modules/${_kernver}-${pkgsuffix}"
install -m644 module/*.ko "$pkgdir/usr/lib/modules/${_kernver}-${pkgsuffix}"
install -dm755 "${modulesdir}"
install -m644 module/*.ko "${modulesdir}"
find "$pkgdir" -name '*.ko' -exec zstd --rm -10 {} +
# sed -i -e "s/EXTRAMODULES='.*'/EXTRAMODULES='${pkgver}-${pkgbase}'/" "$startdir/zfs.install"
}
Expand All @@ -719,9 +722,12 @@ _package-nvidia(){
conflicts=("$pkgbase-nvidia-open")
license=('custom')

cd ${srcdir}/$_srcname
local modulesdir="$pkgdir/usr/lib/modules/$(<version)"

cd "${srcdir}/${_nv_pkg}/"
install -dm755 "$pkgdir/usr/lib/modules/${_kernver}-${pkgsuffix}"
install -m644 kernel/*.ko "$pkgdir/usr/lib/modules/${_kernver}-${pkgsuffix}"
install -dm755 "${modulesdir}"
install -m644 kernel/*.ko "${modulesdir}"
install -Dt "$pkgdir/usr/share/licenses/${pkgname}" -m644 LICENSE
find "$pkgdir" -name '*.ko' -exec zstd --rm -10 {} +
}
Expand All @@ -733,9 +739,12 @@ _package-nvidia-open(){
conflicts=("$pkgbase-nvidia")
license=(GPL-1.0-only)

cd ${srcdir}/$_srcname
local modulesdir="$pkgdir/usr/lib/modules/$(<version)"

cd "${srcdir}/${_nv_open_pkg}"
install -dm755 "$pkgdir/usr/lib/modules/${_kernver}-${pkgsuffix}"
install -m644 kernel-open/*.ko "$pkgdir/usr/lib/modules/${_kernver}-${pkgsuffix}"
install -dm755 "${modulesdir}"
install -m644 kernel-open/*.ko "${modulesdir}"
install -Dt "$pkgdir/usr/share/licenses/${pkgname}" -m644 COPYING

find "$pkgdir" -name '*.ko' -exec zstd --rm -10 {} +
Expand Down
21 changes: 15 additions & 6 deletions linux-cachyos-hardened/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -704,9 +704,12 @@ _package-zfs(){
provides=('ZFS-MODULE')
license=('CDDL')

cd ${srcdir}/$_srcname
local modulesdir="$pkgdir/usr/lib/modules/$(<version)"

cd ${srcdir}/"zfs"
install -dm755 "$pkgdir/usr/lib/modules/${_kernver}-${pkgsuffix}"
install -m644 module/*.ko "$pkgdir/usr/lib/modules/${_kernver}-${pkgsuffix}"
install -dm755 "${modulesdir}"
install -m644 module/*.ko "${modulesdir}"
find "$pkgdir" -name '*.ko' -exec zstd --rm -10 {} +
# sed -i -e "s/EXTRAMODULES='.*'/EXTRAMODULES='${pkgver}-${pkgbase}'/" "$startdir/zfs.install"
}
Expand All @@ -718,9 +721,12 @@ _package-nvidia(){
conflicts=("$pkgbase-nvidia-open")
license=('custom')

cd ${srcdir}/$_srcname
local modulesdir="$pkgdir/usr/lib/modules/$(<version)"

cd "${srcdir}/${_nv_pkg}/"
install -dm755 "$pkgdir/usr/lib/modules/${_kernver}-${pkgsuffix}"
install -m644 kernel/*.ko "$pkgdir/usr/lib/modules/${_kernver}-${pkgsuffix}"
install -dm755 "${modulesdir}"
install -m644 kernel/*.ko "${modulesdir}"
install -Dt "$pkgdir/usr/share/licenses/${pkgname}" -m644 LICENSE
find "$pkgdir" -name '*.ko' -exec zstd --rm -10 {} +
}
Expand All @@ -732,9 +738,12 @@ _package-nvidia-open(){
conflicts=("$pkgbase-nvidia")
license=(GPL-1.0-only)

cd ${srcdir}/$_srcname
local modulesdir="$pkgdir/usr/lib/modules/$(<version)"

cd "${srcdir}/${_nv_open_pkg}"
install -dm755 "$pkgdir/usr/lib/modules/${_kernver}-${pkgsuffix}"
install -m644 kernel-open/*.ko "$pkgdir/usr/lib/modules/${_kernver}-${pkgsuffix}"
install -dm755 "${modulesdir}"
install -m644 kernel-open/*.ko "${modulesdir}"
install -Dt "$pkgdir/usr/share/licenses/${pkgname}" -m644 COPYING

find "$pkgdir" -name '*.ko' -exec zstd --rm -10 {} +
Expand Down
21 changes: 15 additions & 6 deletions linux-cachyos-lts/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -773,9 +773,12 @@ _package-zfs(){
provides=('ZFS-MODULE')
license=('CDDL')

cd ${srcdir}/$_srcname
local modulesdir="$pkgdir/usr/lib/modules/$(<version)"

cd ${srcdir}/"zfs"
install -dm755 "$pkgdir/usr/lib/modules/${_kernver}-${pkgsuffix}"
install -m644 module/*.ko "$pkgdir/usr/lib/modules/${_kernver}-${pkgsuffix}"
install -dm755 "${modulesdir}"
install -m644 module/*.ko "${modulesdir}"
find "$pkgdir" -name '*.ko' -exec zstd --rm -10 {} +
# sed -i -e "s/EXTRAMODULES='.*'/EXTRAMODULES='${pkgver}-${pkgbase}'/" "$startdir/zfs.install"
}
Expand All @@ -787,9 +790,12 @@ _package-nvidia(){
conflicts=("$pkgbase-nvidia-open")
license=('custom')

cd ${srcdir}/$_srcname
local modulesdir="$pkgdir/usr/lib/modules/$(<version)"

cd "${srcdir}/${_nv_pkg}/"
install -dm755 "$pkgdir/usr/lib/modules/${_kernver}-${pkgsuffix}"
install -m644 kernel/*.ko "$pkgdir/usr/lib/modules/${_kernver}-${pkgsuffix}"
install -dm755 "${modulesdir}"
install -m644 kernel/*.ko "${modulesdir}"
install -Dt "$pkgdir/usr/share/licenses/${pkgname}" -m644 LICENSE
find "$pkgdir" -name '*.ko' -exec zstd --rm -10 {} +
}
Expand All @@ -801,9 +807,12 @@ _package-nvidia-open(){
conflicts=("$pkgbase-nvidia")
license=(GPL-1.0-only)

cd ${srcdir}/$_srcname
local modulesdir="$pkgdir/usr/lib/modules/$(<version)"

cd "${srcdir}/${_nv_open_pkg}"
install -dm755 "$pkgdir/usr/lib/modules/${_kernver}-${pkgsuffix}"
install -m644 kernel-open/*.ko "$pkgdir/usr/lib/modules/${_kernver}-${pkgsuffix}"
install -dm755 "${modulesdir}"
install -m644 kernel-open/*.ko "${modulesdir}"
install -Dt "$pkgdir/usr/share/licenses/${pkgname}" -m644 COPYING

find "$pkgdir" -name '*.ko' -exec zstd --rm -10 {} +
Expand Down
24 changes: 15 additions & 9 deletions linux-cachyos-rc/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -704,11 +704,13 @@ _package-zfs(){
depends=('pahole' $pkgbase=$_kernver)
provides=('ZFS-MODULE')
license=('CDDL')
local moduleprefix=${_major}.${_minor}-${_rcver}-${pkgrel}

cd ${srcdir}/$_srcname
local modulesdir="$pkgdir/usr/lib/modules/$(<version)"

cd ${srcdir}/"zfs"
install -dm755 "$pkgdir/usr/lib/modules/${moduleprefix}-${pkgsuffix}"
install -m644 module/*.ko "$pkgdir/usr/lib/modules/${moduleprefix}-${pkgsuffix}"
install -dm755 "${modulesdir}"
install -m644 module/*.ko "${modulesdir}"
find "$pkgdir" -name '*.ko' -exec zstd --rm -10 {} +
# sed -i -e "s/EXTRAMODULES='.*'/EXTRAMODULES='${pkgver}-${pkgbase}'/" "$startdir/zfs.install"
}
Expand All @@ -720,10 +722,12 @@ _package-nvidia(){
conflicts=("$pkgbase-nvidia-open")
license=('custom')

local moduleprefix=${_major}.${_minor}-${_rcver}-${pkgrel}
cd ${srcdir}/$_srcname
local modulesdir="$pkgdir/usr/lib/modules/$(<version)"

cd "${srcdir}/${_nv_pkg}/"
install -dm755 "$pkgdir/usr/lib/modules/${moduleprefix}-${pkgsuffix}"
install -m644 kernel/*.ko "$pkgdir/usr/lib/modules/${moduleprefix}-${pkgsuffix}"
install -dm755 "${modulesdir}"
install -m644 kernel/*.ko "${modulesdir}"
install -Dt "$pkgdir/usr/share/licenses/${pkgname}" -m644 LICENSE
find "$pkgdir" -name '*.ko' -exec zstd --rm -10 {} +
}
Expand All @@ -735,10 +739,12 @@ _package-nvidia-open(){
conflicts=("$pkgbase-nvidia")
license=(GPL-1.0-only)

local moduleprefix=${_major}.${_minor}-${_rcver}-${pkgrel}
cd ${srcdir}/$_srcname
local modulesdir="$pkgdir/usr/lib/modules/$(<version)"

cd "${srcdir}/${_nv_open_pkg}"
install -dm755 "$pkgdir/usr/lib/modules/${moduleprefix}-${pkgsuffix}"
install -m644 kernel-open/*.ko "$pkgdir/usr/lib/modules/${moduleprefix}-${pkgsuffix}"
install -dm755 "${modulesdir}"
install -m644 kernel-open/*.ko "${modulesdir}"
install -Dt "$pkgdir/usr/share/licenses/${pkgname}" -m644 COPYING

find "$pkgdir" -name '*.ko' -exec zstd --rm -10 {} +
Expand Down
21 changes: 15 additions & 6 deletions linux-cachyos-rt-bore/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -705,9 +705,12 @@ _package-zfs(){
provides=('ZFS-MODULE')
license=('CDDL')

cd ${srcdir}/$_srcname
local modulesdir="$pkgdir/usr/lib/modules/$(<version)"

cd ${srcdir}/"zfs"
install -dm755 "$pkgdir/usr/lib/modules/${_kernver}-${pkgsuffix}"
install -m644 module/*.ko "$pkgdir/usr/lib/modules/${_kernver}-${pkgsuffix}"
install -dm755 "${modulesdir}"
install -m644 module/*.ko "${modulesdir}"
find "$pkgdir" -name '*.ko' -exec zstd --rm -10 {} +
# sed -i -e "s/EXTRAMODULES='.*'/EXTRAMODULES='${pkgver}-${pkgbase}'/" "$startdir/zfs.install"
}
Expand All @@ -719,9 +722,12 @@ _package-nvidia(){
conflicts=("$pkgbase-nvidia-open")
license=('custom')

cd ${srcdir}/$_srcname
local modulesdir="$pkgdir/usr/lib/modules/$(<version)"

cd "${srcdir}/${_nv_pkg}/"
install -dm755 "$pkgdir/usr/lib/modules/${_kernver}-${pkgsuffix}"
install -m644 kernel/*.ko "$pkgdir/usr/lib/modules/${_kernver}-${pkgsuffix}"
install -dm755 "${modulesdir}"
install -m644 kernel/*.ko "${modulesdir}"
install -Dt "$pkgdir/usr/share/licenses/${pkgname}" -m644 LICENSE
find "$pkgdir" -name '*.ko' -exec zstd --rm -10 {} +
}
Expand All @@ -733,9 +739,12 @@ _package-nvidia-open(){
conflicts=("$pkgbase-nvidia")
license=(GPL-1.0-only)

cd ${srcdir}/$_srcname
local modulesdir="$pkgdir/usr/lib/modules/$(<version)"

cd "${srcdir}/${_nv_open_pkg}"
install -dm755 "$pkgdir/usr/lib/modules/${_kernver}-${pkgsuffix}"
install -m644 kernel-open/*.ko "$pkgdir/usr/lib/modules/${_kernver}-${pkgsuffix}"
install -dm755 "${modulesdir}"
install -m644 kernel-open/*.ko "${modulesdir}"
install -Dt "$pkgdir/usr/share/licenses/${pkgname}" -m644 COPYING

find "$pkgdir" -name '*.ko' -exec zstd --rm -10 {} +
Expand Down
Loading

0 comments on commit 4a0effe

Please sign in to comment.