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
moduleloader=modprobe
local uname
local extras
if ! qt mywhich modprobe; then
moduleloader=insmod
@ -323,9 +324,25 @@ reload_kernel_modules() {
[ -n "${MODULE_SUFFIX:=ko ko.gz ko.xz o o.gz o.xz gz xz}" ]
[ -z "$MODULESDIR" ] && \
uname=$(uname -r) && \
if [ -n "$MODULESDIR" ]; then
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
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)
@ -355,6 +372,7 @@ load_kernel_modules() # $1 = Yes, if we are to save moduleinfo in $VARDIR
local savemoduleinfo
savemoduleinfo=${1:-Yes} # So old compiled scripts still work
local uname
local extras
if ! qt mywhich modprobe; then
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}" ]
[ -z "$MODULESDIR" ] && \
uname=$(uname -r) && \
if [ -n "$MODULESDIR" ]; then
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
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
[ -d $directory ] && moduledirectories="$moduledirectories $directory"

View File

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

View File

@ -1442,9 +1442,11 @@ LOG:info:,bar net fw</programlisting>
<listitem>
<para>This parameter specifies the directory/directories where your
kernel netfilter modules may be found. If you leave the variable
empty, Shorewall6 will supply "/lib/modules/`uname
-r`/kernel/net/ipv4/netfilter:/lib/modules/`uname
-r`/kernel/net/ipv4/netfilter".</para>
empty, Shorewall will supply the value
"/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"
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>
</varlistentry>