pkgbuilds/kernel-modules-hook-bindmount/linux-modules-restore
Jerry aab1eb6f55
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
2023-09-19 16:05:55 +08:00

12 lines
543 B
Bash

#!/bin/bash -e
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/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
fi
done