# $Id$ provide basic-kernel require basic-init help_kernel_module() { mecho "get kernel.module" mecho " prints current list of kernel modules" mecho mecho "set kernel.module [action] [module] [opts]" } get_kernel_module() { return 0 } set_kernel_module() { local action="${CLASS_ARGV[0]}" local module="${CLASS_ARGV[1]}" local opts="${CLASS_ARGV[2]}" [[ -z ${action} ]] && help_kernel_module && return 1 [[ -z ${module} ]] && help_kernel_module && return 1 case "${action}" in add) CONFIG="${MROOT}/etc/modules-load.d/mcore-${module}.conf" clearconfig addconfig "# mcore autogenerated file - do not edit" addconfig "${module}" if [[ -n ${opts} ]] then CONFIG="${MROOT}/etc/modprobe.d/mcore-${module}.conf" clearconfig addconfig "# mcore autogenerated file - do not edit" addconfig "${module}.${opts}" fi # restart systemd modules-load service # systemd if is_provided systemd then mcore-system-service restart systemd-modules-load.service fi # sysvinit if is_provided sysvinit then mcore-system-service restart modules fi ;; del) if [[ -f ${MROOT}/etc/modules-load.d/mcore-${module}.conf ]] then rm ${MROOT}/etc/modules-load.d/mcore-${module}.conf fi if [[ -f ${MROOT}/etc/modprobe.d/mcore-${module}.conf ]] then rm ${MROOT}/etc/modprobe.d/mcore-${module}.conf fi # try to remove the kernel module modprobe -r "${module}" # restart systemd modules-load service # systemd if is_provided systemd then mcore-system-service restart systemd-modules-load.service fi # sysvinit if is_provided sysvinit then mcore-system-service restart modules fi ;; *) help_kernel_module && return 1 ;; esac }