diff --git a/Makefile b/Makefile index 0c181ff..d760e9f 100644 --- a/Makefile +++ b/Makefile @@ -99,6 +99,7 @@ HELPER_HOOKS_SHELL+=mandb HELPER_HOOKS_SHELL+=systemd-tmpfiles HELPER_HOOKS_SHELL+=gconf-install-schemas HELPER_HOOKS_SHELL+=info-dir +HELPER_HOOKS_SHELL+=kernel-modules MANPAGES+=bee.1 MANPAGES+=bee-check.1 diff --git a/hooks/kernel-modules.sh b/hooks/kernel-modules.sh new file mode 100755 index 0000000..65e1f98 --- /dev/null +++ b/hooks/kernel-modules.sh @@ -0,0 +1,36 @@ +#!/bin/bash +# +action=${1} +pkg=${2} +content=${3} +: ${content:=${BEE_METADIR}/${pkg}/CONTENT} + +if [ -z ${BEE_VERSION} ] ; then + echo >&2 "BEE-ERROR: cannot call $0 from the outside of bee .." + exit 1 +fi + +: ${DEPMOD:=depmod} + +if [ ! type -p ${DEPMOD} >/dev/null 2>&1 ; then + exit 0 +fi + +if [ ! -r "${BEE_METADIR}/${pkg}/META" ] ; then + exit 0 +fi + +. ${BEE_METADIR}/${pkg}/META + +if [ ! "${BEEMETAFORMAT:=0}" -ge 2 ] ; then + exit 0 +fi + +case "${action}" in + "post-install"|"post-remove") + for ver in $(grep -Po ':file=/lib/modules/\K([^/]+)(?=/)' ${content}|sort -u) ; do + echo "$DEPMOD $ver" + test -e /lib/modules/$ver/modules.builtin && $DEPMOD $ver + done + ;; +esac