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


                       
                                
                      
                   
                                                                 
           

              

                                                        
                                     
                                                               
          



                                           
                                                        
          
  


                
                                              

                                                



                                                     
#!/usr/bin/env bash
# -*- coding: utf-8 -*-
# region imports
source '/usr/lib/rebash/core.sh'
core.import exceptions
core.import logging
type emergency_shell >/dev/null 2>&1 || source /lib/dracut-lib.sh
# endregion
exceptions.try
{
DNBD3_MOD_PATH="/usr/lib/modules/current/extra/dnbd3.ko"

if [ ! -e "${DNBD3_MOD_PATH}" ]; then
    logging.warn "No such file of directory: ${DNBD3_MOD_PATH}"
    exit 1
fi

# load the kernel modules for dnbd3 and nbd
if ! insmod "${DNBD3_MOD_PATH}"; then
    logging.warn "Failed to load DNBD3 kernel module..."
    exit 1
fi
}
exceptions.catch
{
    logging.error "$exceptions_last_traceback"
    emergency_shell "error in ${BASH_SOURCE[0]}"
}
# region vim modline
# vim: set tabstop=4 shiftwidth=4 expandtab:
# vim: foldmethod=marker foldmarker=region,endregion:
# endregion