2023-04-02 11:04:23 +08:00
|
|
|
#!/bin/bash -e
|
|
|
|
|
|
|
|
kver=$(uname -r)
|
|
|
|
while read -r line; do
|
|
|
|
# We only care about the running kernel
|
2023-09-19 16:04:35 +08:00
|
|
|
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
|
2023-04-02 11:04:23 +08:00
|
|
|
# Mounting read-only since the only modification here should be unmounting
|
|
|
|
# when rebooting or reinstalling the running kernel
|
2023-05-31 14:02:04 +08:00
|
|
|
# LazyUnmount at shutdown in case udevd is blocking us
|
2023-04-02 11:04:23 +08:00
|
|
|
fi
|
|
|
|
done
|