check for existing kernel module built by dkms

From: Michael Prokop <mprokop@sipwise.com>
ksolomko/vlan
Michael Prokop 14 years ago
parent 96bf363bd0
commit 008c3aca14

@ -938,18 +938,22 @@ EOT
# we require those packages for dkms, so do NOT remove them:
# binutils cpp-4.3 gcc-4.3-base linux-kbuild-2.6.32
if chroot $TARGET dkms status | grep ngcp-mediaproxy-ng ; then
# brrrr, don't tell this anyone or i'll commit with http://whatthecommit.com/ as commit msg!
KERNELHEADERS=$(basename $(ls -d ${TARGET}/usr/src/linux-headers*amd64 | sort -u | head -1))
if [ -z "$KERNELHEADERS" ] ; then
echo "Error: no kernel headers found for building the ngcp-mediaproxy-ng kernel module." >&2
exit 1
if chroot $TARGET dkms status | grep -q ngcp-mediaproxy-ng ; then
if chroot $TARGET dkms status | grep -q '^ngcp-mediaproxy-ng.*: installed' ; then
echo "ngcp-mediaproxy-ng. kernel package already installed, skipping"
else
# brrrr, don't tell this anyone or i'll commit with http://whatthecommit.com/ as commit msg!
KERNELHEADERS=$(basename $(ls -d ${TARGET}/usr/src/linux-headers*amd64 | sort -u | head -1))
if [ -z "$KERNELHEADERS" ] ; then
echo "Error: no kernel headers found for building the ngcp-mediaproxy-ng kernel module." >&2
exit 1
fi
KERNELVERSION=${KERNELHEADERS##linux-headers-}
NGCPVERSION=$(chroot $TARGET dkms status | grep ngcp-mediaproxy-ng | awk -F, '{print $2}' | sed 's/:.*//')
chroot $TARGET dkms build -k $KERNELVERSION --kernelsourcedir /usr/src/$KERNELHEADERS \
-m ngcp-mediaproxy-ng -v $NGCPVERSION
chroot $TARGET dkms install -k $KERNELVERSION -m ngcp-mediaproxy-ng -v $NGCPVERSION
fi
KERNELVERSION=${KERNELHEADERS##linux-headers-}
NGCPVERSION=$(chroot $TARGET dkms status | grep ngcp-mediaproxy-ng | awk -F, '{print $2}' | sed 's/:.*//')
chroot $TARGET dkms build -k $KERNELVERSION --kernelsourcedir /usr/src/$KERNELHEADERS \
-m ngcp-mediaproxy-ng -v $NGCPVERSION
chroot $TARGET dkms install -k $KERNELVERSION -m ngcp-mediaproxy-ng -v $NGCPVERSION
fi
# make sure all services are stopped

Loading…
Cancel
Save