diskimage-builder/elements/nova-vm/install.d/20-dkms-iscsi

28 lines
608 B
Text
Raw Normal View History

2012-11-09 11:04:13 +00:00
#!/bin/sh
# Build iscsi modules with installed kernel
set -e
set -o xtrace
package=iscsitarget-dkms
name=iscsitarget
kernel_version=`ls /boot/vmlinuz-* -r -1| head -n1 | xargs basename |sed 's/vmlinuz-//'`
version=`dpkg-query -W -f='${Version}' "$package" \
|rev|cut -d- -f2-|rev|cut -d':' -f2|tr -d "\n"`
isadded=`dkms status -m "$cd name" -v "$version"`
if [ "x${isadded}" = "x" ] ; then
dkms add -m "$name" -v "$version" -k "$kernel_version" || true
fi
dkms build -m "$name" -v "$version" -k "$kernel_version" && dkms install -m "$name" -v "$version" -k "$kernel_version" || true