hackacad / bastille

Bastille is an open-source system for automating deployment and management of containerized applications on FreeBSD.
https://bastillebsd.org
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

[ENHANCEMENT] #1

Open michaelgalassi opened 3 years ago

michaelgalassi commented 3 years ago

Is your feature request related to a problem? Please describe. Some folk like to load kernel modules using /etc/rc.conf's kld_list rather than putting them in /boot/loader.conf, this way we can always boot to single user mode to recover from a module gone wrong.

Describe the solution you'd like To this end, the check you've added to bootstrap.sh could perhaps validate that the modules are loaded rather than that they have been requested from loader.conf. In my little world I would consider something akin to:

isloaded() {
    # The double test is because with FreeBSD 13 tmpfs is built into the
    # default kernel thus doesn't show as a distinct module in kldstat's
    # output
    if [ $(kldstat | grep -q $1) -o $(nm /boot/kernel/kernel | grep -q $1) ]; then
        return 0
    fi
    return 1
}
...
isloaded linprocfs.ko && isloaded linsysfs.ko && isloaded tmpfs.ko || {
    echo "should I fix that for you?"
    read answer
    ...
}
hackacad commented 3 years ago

Great idea. Looks better than the current implementation. Thanks for the snippet. I'll add that after some testing.