summaryrefslogblamecommitdiffstats
path: root/builder/dnbd3-rootfs/hooks/pre-udev/load-custom-kernel-modules.sh
blob: 21cff17ca0d6e32eca281ff248348bd6821914f3 (plain) (tree)
1
2
3
4
5
6
7
8
9
10




                                                        


                                                     

                                     


                                                       



                                           


                                                

  
                                   


                                              


        
NBD_MOD_PATH="/usr/lib/modules/current/extra/nbd.ko"
DNBD3_MOD_PATH="/usr/lib/modules/current/extra/dnbd3.ko"

# do we actually have our modules?
if [ ! -e "${NBD_MOD_PATH}" ]; then
    warn "No such file of directory: ${NBD_MOD_PATH}"
    emergency_shell -n "Error in $0"
    return 1
fi
if [ ! -e "${DNBD3_MOD_PATH}" ]; then
    warn "No such file of directory: ${DNBD3_MOD_PATH}"
    emergency_shell -n "Error in $0"
    return 1
fi

# load the kernel modules for dnbd3 and nbd
if ! insmod "${DNBD3_MOD_PATH}"; then
    warn "Failed to load DNBD3 kernel module..."
    emergency_shell -n "Error in $0"
    return 1
fi

if ! modprobe nbd max_part=16; then
    warn "Failed to load NBD kernel module..."
    emergency_shell -n "Error in $0"
    return 1
fi

return 0