update: kernel-modules-hook-bindmount

move /usr/lib/modules/running-kernel to /usr/lib/running-kernel-modules
dkms hook confuses a lot when /usr/lib/running-kernel-modules is present
This commit is contained in:
JerryXiao 2023-09-19 16:04:35 +08:00
parent 9626eceaee
commit aab1eb6f55
Signed by: Jerry
GPG key ID: 22618F758B5BE2E5
4 changed files with 10 additions and 10 deletions

View file

@ -3,7 +3,7 @@
# Contributor: Artoria Pendragon <saber-nyan@ya.ru>
_pkgname=kernel-modules-hook
pkgname=${_pkgname}-bindmount
pkgver=0.2.3
pkgver=0.2.4
pkgrel=1
pkgdesc="Keeps your system fully functional after a kernel upgrade"
arch=('any')
@ -17,11 +17,11 @@ source=("linux-modules-cleanup.conf"
"linux-modules-restore"
"linux-modules-save"
)
sha256sums=('950f851eba08dac4d0b93ff62b3fb16ddacd4f8ebb98a2435f80bf05f2ea5a29'
sha256sums=('cfc97c05f0a178574505f2c31b30b2e771546e8223e58a37d9273793faa484b8'
'c3f75396f98caf9b13511290e29ce9d1d6827999ca49f0eca6c44a6702fd8d70'
'fc4d53dec520c80fe97dfda65b238c7d678e7ef26aaebffc5b43f924477ea4f4'
'a902b49c67df16ba69c246b589b89598dff3edd5fe9965c107140e4e7e98110a'
'aa0ce16a6fc4c41e175557e6ce5f885244e8c48e4015bcbc5f04bb82f7442a9d')
'21883cfc1c282c927353d0246021fd57697ab8d6c2cc1980108772ee03e5ba3d'
'97a140062df7b3d1ec5b5c51190dfd8a0a79e65db87aba97a97e886cc2733569')
package() {
install -Dm644 'linux-modules-cleanup.conf' "${pkgdir}/usr/lib/tmpfiles.d/linux-modules-cleanup.conf"

View file

@ -1,2 +1,2 @@
R! /usr/lib/modules/running-kernel
R! /usr/lib/running-kernel-modules
r /usr/lib/modules/*

View file

@ -3,8 +3,8 @@
kver=$(uname -r)
while read -r line; do
# We only care about the running kernel
if [[ "$line" == usr/lib/modules/$kver/vmlinuz && -d /usr/lib/modules/running-kernel ]];then
systemd-mount --quiet --options=bind,ro --property=LazyUnmount=1 /usr/lib/modules/{running-kernel,$kver}
if [[ "$line" == usr/lib/modules/$kver/vmlinuz && -d /usr/lib/running-kernel-modules ]];then
systemd-mount --quiet --options=bind,ro --property=LazyUnmount=1 /usr/lib/running-kernel-modules /usr/lib/modules/$kver
# Mounting read-only since the only modification here should be unmounting
# when rebooting or reinstalling the running kernel
# LazyUnmount at shutdown in case udevd is blocking us

View file

@ -12,13 +12,13 @@ while read -r line; do
# Most of the time udevd would block the umount, so suppress the first error message
umount /${line%vmlinuz} 2>/dev/null || umount --lazy /${line%vmlinuz}
rmdir /${line%vmlinuz}
elif [[ -f "$line" && ! -d "/usr/lib/modules/running-kernel/" ]];then
elif [[ -f "$line" && ! -d "/usr/lib/running-kernel-modules" ]];then
# Kernel install is present and we do not have a copy
#
# This is the removal case, so we save the kernel
mkdir /usr/lib/modules/running-kernel
mkdir /usr/lib/running-kernel-modules
cp --archive --link --no-target-directory /usr/lib/modules/${kver}/ \
/usr/lib/modules/running-kernel/
/usr/lib/running-kernel-modules/
fi
# If we are re-removing the running kernel, (after removing + reinstalling),
# we already have a backup and this hook is a no-op