Redefine MODULESDIR

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2015-11-28 08:36:12 -08:00
parent 42db58c4d6
commit b087cee7f0
3 changed files with 48 additions and 12 deletions

View File

@ -316,6 +316,7 @@ reload_kernel_modules() {
local moduleloader local moduleloader
moduleloader=modprobe moduleloader=modprobe
local uname local uname
local extras
if ! qt mywhich modprobe; then if ! qt mywhich modprobe; then
moduleloader=insmod moduleloader=insmod
@ -323,9 +324,25 @@ reload_kernel_modules() {
[ -n "${MODULE_SUFFIX:=ko ko.gz ko.xz o o.gz o.xz gz xz}" ] [ -n "${MODULE_SUFFIX:=ko ko.gz ko.xz o o.gz o.xz gz xz}" ]
[ -z "$MODULESDIR" ] && \ if [ -n "$MODULESDIR" ]; then
uname=$(uname -r) && \ case "$MODULESDIR" in
+*)
extras="$MODULESDIR"
extras=${extras#+}
MODULESDIR=
;;
esac
fi
if [ -z "$MODULESDIR" ]; then
uname=$(uname -r)
MODULESDIR=/lib/modules/$uname/kernel/net/ipv${g_family}/netfilter:/lib/modules/$uname/kernel/net/netfilter:/lib/modules/$uname/kernel/net/sched:/lib/modules/$uname/extra:/lib/modules/$uname/extra/ipset MODULESDIR=/lib/modules/$uname/kernel/net/ipv${g_family}/netfilter:/lib/modules/$uname/kernel/net/netfilter:/lib/modules/$uname/kernel/net/sched:/lib/modules/$uname/extra:/lib/modules/$uname/extra/ipset
if [ -n "$extras" ]; then
for directory in $(split "$extras"); do
MODULESDIR="$MODULESDIR:/lib/modules/$uname/$directory"
done
fi
fi
[ -d /sys/module/ ] || MODULES=$(lsmod | cut -d ' ' -f1) [ -d /sys/module/ ] || MODULES=$(lsmod | cut -d ' ' -f1)
@ -355,6 +372,7 @@ load_kernel_modules() # $1 = Yes, if we are to save moduleinfo in $VARDIR
local savemoduleinfo local savemoduleinfo
savemoduleinfo=${1:-Yes} # So old compiled scripts still work savemoduleinfo=${1:-Yes} # So old compiled scripts still work
local uname local uname
local extras
if ! qt mywhich modprobe; then if ! qt mywhich modprobe; then
moduleloader=insmod moduleloader=insmod
@ -362,9 +380,25 @@ load_kernel_modules() # $1 = Yes, if we are to save moduleinfo in $VARDIR
[ -n "${MODULE_SUFFIX:=o gz xz ko o.gz o.xz ko.gz ko.xz}" ] [ -n "${MODULE_SUFFIX:=o gz xz ko o.gz o.xz ko.gz ko.xz}" ]
[ -z "$MODULESDIR" ] && \ if [ -n "$MODULESDIR" ]; then
uname=$(uname -r) && \ case "$MODULESDIR" in
+*)
extras="$MODULESDIR"
extras=${extras#+}
MODULESDIR=
;;
esac
fi
if [ -z "$MODULESDIR" ]; then
uname=$(uname -r)
MODULESDIR=/lib/modules/$uname/kernel/net/ipv${g_family}/netfilter:/lib/modules/$uname/kernel/net/netfilter:/lib/modules/$uname/kernel/net/sched:/lib/modules/$uname/extra:/lib/modules/$uname/extra/ipset MODULESDIR=/lib/modules/$uname/kernel/net/ipv${g_family}/netfilter:/lib/modules/$uname/kernel/net/netfilter:/lib/modules/$uname/kernel/net/sched:/lib/modules/$uname/extra:/lib/modules/$uname/extra/ipset
if [ -n "$extras" ]; then
for directory in $(split "$extras"); do
MODULESDIR="$MODULESDIR:/lib/modules/$uname/$directory"
done
fi
fi
for directory in $(split $MODULESDIR); do for directory in $(split $MODULESDIR); do
[ -d $directory ] && moduledirectories="$moduledirectories $directory" [ -d $directory ] && moduledirectories="$moduledirectories $directory"

View File

@ -1625,11 +1625,11 @@ LOG:info:,bar net fw</programlisting>
<listitem> <listitem>
<para>This parameter specifies the directory/directories where your <para>This parameter specifies the directory/directories where your
kernel netfilter modules may be found. If you leave the variable kernel netfilter modules may be found. If you leave the variable
empty, Shorewall will supply the value "/lib/modules/`uname empty, Shorewall will supply the value
-r`/kernel/net/ipv4/netfilter" in versions of Shorewall prior to "/lib/modules/$uname/kernel/net/ipv${g_family}/netfilter:/lib/modules/$uname/kernel/net/netfilter:/lib/modules/$uname/kernel/net/sched:/lib/modules/$uname/extra:/lib/modules/$uname/extra/ipset"
3.2.4 and "/lib/modules/`uname where <emphasis role="bold">uname</emphasis> holds the output of
-r`/kernel/net/ipv4/netfilter:/lib/modules/`uname '<command>uname -r</command>' and <emphasis
-r`/kernel/net/ipv4/netfilter" in later versions.</para> role="bold">g_family</emphasis> holds '4'. </para>
</listitem> </listitem>
</varlistentry> </varlistentry>

View File

@ -1442,9 +1442,11 @@ LOG:info:,bar net fw</programlisting>
<listitem> <listitem>
<para>This parameter specifies the directory/directories where your <para>This parameter specifies the directory/directories where your
kernel netfilter modules may be found. If you leave the variable kernel netfilter modules may be found. If you leave the variable
empty, Shorewall6 will supply "/lib/modules/`uname empty, Shorewall will supply the value
-r`/kernel/net/ipv4/netfilter:/lib/modules/`uname "/lib/modules/$uname/kernel/net/ipv${g_family}/netfilter:/lib/modules/$uname/kernel/net/netfilter:/lib/modules/$uname/kernel/net/sched:/lib/modules/$uname/extra:/lib/modules/$uname/extra/ipset"
-r`/kernel/net/ipv4/netfilter".</para> where <emphasis role="bold">uname</emphasis> holds the output of
'<command>uname -r</command>' and <emphasis
role="bold">g_family</emphasis> holds '6'.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>