aboutsummarylogtreecommitdiffstats
path: root/linux-modules-restore
blob: baceebfeea48a7fd9f7124b885e12ba9a110a2ee (plain)
1
2
3
4
5
6
7
8
9
10
11
#!/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 "${line/$kver/running-kernel}" ]];then
        mount --mkdir --bind --options ro /usr/lib/modules/{running-kernel,$kver}
        # Mounting read-only since the only modification here should be unmounting
        # when rebooting or reinstalling the running kernel
    fi
done