Line | |
---|
1 | #!/bin/bash |
---|
2 | |
---|
3 | # Insert the vnet module if it can be found and |
---|
4 | # it's not already there. |
---|
5 | vnet_insert () { |
---|
6 | local module="vnet_module" |
---|
7 | local mod_dir=/lib/modules/$(uname -r) |
---|
8 | local mod_obj="" |
---|
9 | |
---|
10 | if lsmod | grep -q ${module} ; then |
---|
11 | echo "VNET: ${module} loaded" |
---|
12 | return |
---|
13 | fi |
---|
14 | local mods=$(find ${mod_dir} -name "${module}.*o") |
---|
15 | if [[ ${mods} ]] ; then |
---|
16 | for mod_obj in ${mods} ; do |
---|
17 | break |
---|
18 | done |
---|
19 | fi |
---|
20 | if [ -z "${mod_obj}" ] ; then |
---|
21 | echo "VNET: ${module} not found" |
---|
22 | exit 1 |
---|
23 | fi |
---|
24 | echo "VNET: Loading ${module} from ${mod_obj}" |
---|
25 | insmod ${mod_obj} "$@" |
---|
26 | } |
---|
27 | |
---|
28 | vnet_insert "$@" |
---|
Note: See
TracBrowser
for help on using the repository browser.