update: kernel-modules-hook-hardlinks: remove mountpoint before reinstall

This commit is contained in:
JerryXiao 2023-05-31 23:19:32 +08:00
parent d49e7113e2
commit f69c1abf35
Signed by: Jerry
GPG Key ID: 22618F758B5BE2E5
2 changed files with 4 additions and 3 deletions

View File

@ -19,7 +19,7 @@ sha256sums=('950f851eba08dac4d0b93ff62b3fb16ddacd4f8ebb98a2435f80bf05f2ea5a29'
'087e5ed70b2fc512d814fbded9e873955b1da5b6bf1e31975174d704ad143156'
'fc4d53dec520c80fe97dfda65b238c7d678e7ef26aaebffc5b43f924477ea4f4'
'a902b49c67df16ba69c246b589b89598dff3edd5fe9965c107140e4e7e98110a'
'af7df16af22dd759495518e6d28484ff656458e505f04cf5aacfc6d7d3935d82')
'aa0ce16a6fc4c41e175557e6ce5f885244e8c48e4015bcbc5f04bb82f7442a9d')
package() {
install -Dm644 'linux-modules-cleanup.conf' "${pkgdir}/usr/lib/tmpfiles.d/linux-modules-cleanup.conf"

View File

@ -4,13 +4,14 @@ kver=$(uname -r)
while read -r line; do
# We only care about the running kernel
if [[ "$line" == "usr/lib/modules/$kver/vmlinuz" ]];then
if mountpoint --nofollow --quiet ${line%vmlinuz};then
if mountpoint --nofollow --quiet /${line%vmlinuz};then
# Mount point is already present
# This means we already ran that hook during 'remove case'
#
# Remove the mount so we can reinstall the kernel
# 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}
umount /${line%vmlinuz} 2>/dev/null || umount --lazy /${line%vmlinuz}
rmdir /${line%vmlinuz}
elif [[ -f "$line" && ! -d "/usr/lib/modules/running-kernel/" ]];then
# Kernel install is present and we do not have a copy
#