Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
add hook for kernel modules
  • Loading branch information
donald committed Aug 24, 2016
1 parent 0e08cee commit bc116c0
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
1 change: 1 addition & 0 deletions Makefile
Expand Up @@ -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
Expand Down
36 changes: 36 additions & 0 deletions 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

0 comments on commit bc116c0

Please sign in to comment.