xbps-triggers: improve the dkms trigger, bump to 0.16.

This commit is contained in:
Juan RP 2011-02-20 00:28:33 +01:00
parent 5317bf60bc
commit e683c257db
2 changed files with 13 additions and 8 deletions

View file

@ -22,18 +22,19 @@ DKMS=usr/sbin/dkms
remove_modules() remove_modules()
{ {
local ver local _modver _kver
# Remove the specified modules from all kernels. # Remove the specified modules from all kernels.
set -- ${dkms_modules} set -- ${dkms_modules}
while [ $# -gt 0 ]; do while [ $# -gt 0 ]; do
$DKMS status -m $1 | while read line; do $DKMS status -m "$1" | while read line; do
if $(echo $line | egrep -vq '(added|built|installed)'); then if $(echo "$line" | egrep -vq '(added|built|installed)'); then
shift; shift; continue shift; shift; continue
fi fi
ver=$(echo "$line" | sed "s/$1,\([^,]*\)[,:].*/\1/;t;d") _modver=$(echo "$line"|sed "s/$1,[[:blank:]]\([^,]*\)[,:].*/\1/;t;d")
echo -n "Removing DKMS module '$1-$ver'... " _kver=$(echo "$line"|awk '{print $3}'|sed "s/\(.*\),$/\1/")
$DKMS remove -m $1 -v $ver --all >/dev/null 2>&1 echo -n "Removing DKMS module '${1}-${_modver}' for kernel-${_kver}... "
$DKMS remove -m "$1" -v "${_modver}" -k "${_kver}" >/dev/null 2>&1
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "done." echo "done."
else else
@ -62,9 +63,13 @@ add_modules()
for f in $(echo lib/modules/*); do for f in $(echo lib/modules/*); do
_kver=$(basename $f) _kver=$(basename $f)
if [ ! -e "${f}/build/include" ]; then
echo "Skipping kernel-${_kver}. kernel-headers package not installed..."
continue
fi
set -- ${dkms_modules} set -- ${dkms_modules}
while [ $# -gt 0 ]; do while [ $# -gt 0 ]; do
echo -n "Installing DKMS module '$1-$2' for kernel ${_kver}... " echo -n "Installing DKMS module '$1-$2' for kernel-${_kver}... "
$DKMS build -m "$1" -v "$2" -k "${_kver}" >/dev/null 2>&1 && \ $DKMS build -m "$1" -v "$2" -k "${_kver}" >/dev/null 2>&1 && \
$DKMS install -m "$1" -v "$2" -k "${_kver}" >/dev/null 2>&1 $DKMS install -m "$1" -v "$2" -k "${_kver}" >/dev/null 2>&1
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then

View file

@ -1,6 +1,6 @@
# Template file for 'xbps-triggers' # Template file for 'xbps-triggers'
pkgname=xbps-triggers pkgname=xbps-triggers
version=0.15 version=0.16
build_style=custom-install build_style=custom-install
short_desc="XBPS triggers" short_desc="XBPS triggers"
maintainer="Juan RP <xtraeme@gmail.com>" maintainer="Juan RP <xtraeme@gmail.com>"