cloudstack/vnet/src/examples/vnet-insert
Manuel Amador (Rudd-O) 05c020e1f6 Source code committed
2010-08-11 09:13:29 -07:00

29 lines
652 B
Bash

#!/bin/bash
# Insert the vnet module if it can be found and
# it's not already there.
vnet_insert () {
local module="vnet_module"
local mod_dir=/lib/modules/$(uname -r)
local mod_obj=""
if lsmod | grep -q ${module} ; then
echo "VNET: ${module} loaded"
return
fi
local mods=$(find ${mod_dir} -name "${module}.*o")
if [[ ${mods} ]] ; then
for mod_obj in ${mods} ; do
break
done
fi
if [ -z "${mod_obj}" ] ; then
echo "VNET: ${module} not found"
exit 1
fi
echo "VNET: Loading ${module} from ${mod_obj}"
insmod ${mod_obj} "$@"
}
vnet_insert "$@"