mirror of
https://gitlab.com/shorewall/code.git
synced 2024-12-23 14:48:51 +01:00
Add variable expansion to INCLUDE
git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@1783 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
parent
d00fda4e1f
commit
40dd271a84
@ -89,3 +89,5 @@ Changes in 2.0.12
|
||||
1) Correct typo in shorewall.conf.
|
||||
|
||||
2) Fix "shorewall add" and "shorewall delete" with bridging.
|
||||
|
||||
3) Implement variable expansion in INCLUDE directives
|
||||
|
@ -52,9 +52,9 @@ qt()
|
||||
#
|
||||
# Perform variable substitution on the passed argument and echo the result
|
||||
#
|
||||
expand() # $1 = contents of variable which may be the name of another variable
|
||||
expand() # $@ = contents of variable which may be the name of another variable
|
||||
{
|
||||
eval echo \"$1\"
|
||||
eval echo \"$@\"
|
||||
}
|
||||
|
||||
#
|
||||
@ -104,7 +104,8 @@ ensure_config_path() {
|
||||
#
|
||||
# Find a File -- For relative file name, look first in $SHOREWALL_DIR then in /etc/shorewall
|
||||
#
|
||||
find_file()
|
||||
find_file
|
||||
()
|
||||
{
|
||||
local saveifs= directory
|
||||
|
||||
@ -434,7 +435,7 @@ read_file() # $1 = file name, $2 = nest count
|
||||
while read first rest; do
|
||||
if [ "x$first" = "xINCLUDE" ]; then
|
||||
if [ $2 -lt 4 ]; then
|
||||
read_file $(find_file ${rest%#*}) $(($2 + 1))
|
||||
read_file $(find_file $(expand ${rest%#*})) $(($2 + 1))
|
||||
else
|
||||
echo " WARNING: INCLUDE in $1 ignored (nested too deeply)" >&2
|
||||
fi
|
||||
@ -452,7 +453,7 @@ read_file() # $1 = file name, $2 = nest count
|
||||
# Function for including one file into another
|
||||
#
|
||||
INCLUDE() {
|
||||
. $(find_file $@)
|
||||
. $(find_file $(expand $@))
|
||||
}
|
||||
|
||||
#
|
||||
|
@ -204,3 +204,17 @@ Problems corrected in 2.0.12
|
||||
|
||||
shorewall add br0:eth2:192.168.1.3 OK
|
||||
shorewall delete br0:eth2:192.168.1.3 OK
|
||||
-----------------------------------------------------------------------
|
||||
New Features in 2.0.12
|
||||
|
||||
1) Variable expansion may now be used with the INCLUDE directive.
|
||||
|
||||
Example:
|
||||
|
||||
/etc/shorewall/params
|
||||
|
||||
FILE=/etc/foo/bar
|
||||
|
||||
Any other config file:
|
||||
|
||||
INCLUDE $FILE
|
||||
|
@ -158,3 +158,6 @@ Changes since 2.0.3
|
||||
76) Add "shorewall show zones"
|
||||
|
||||
77) Remove dependency of "show zones" on dynamic zones.
|
||||
|
||||
78) Implement variable expansion in INCLUDE directives
|
||||
|
||||
|
@ -73,9 +73,9 @@ qt()
|
||||
#
|
||||
# Perform variable substitution on the passed argument and echo the result
|
||||
#
|
||||
expand() # $1 = contents of variable which may be the name of another variable
|
||||
expand() # $@ = contents of variable which may be the name of another variable
|
||||
{
|
||||
eval echo \"$1\"
|
||||
eval echo \"$@\"
|
||||
}
|
||||
|
||||
#
|
||||
@ -459,7 +459,7 @@ read_file() # $1 = file name, $2 = nest count
|
||||
while read first rest; do
|
||||
if [ "x$first" = "xINCLUDE" ]; then
|
||||
if [ $2 -lt 4 ]; then
|
||||
read_file $(find_file ${rest%#*}) $(($2 + 1))
|
||||
read_file $(find_file $(expand ${rest%#*})) $(($2 + 1))
|
||||
else
|
||||
echo " WARNING: INCLUDE in $1 ignored (nested too deeply)" >&2
|
||||
fi
|
||||
@ -477,7 +477,7 @@ read_file() # $1 = file name, $2 = nest count
|
||||
# Function for including one file into another
|
||||
#
|
||||
INCLUDE() {
|
||||
. $(find_file $@)
|
||||
. $(find_file $(expand $@))
|
||||
}
|
||||
|
||||
#
|
||||
|
@ -734,4 +734,14 @@ New Features:
|
||||
|
||||
ursa:/etc/shorewall #
|
||||
|
||||
32) Variable expansion may now be used with the INCLUDE directive.
|
||||
|
||||
Example:
|
||||
|
||||
/etc/shorewall/params
|
||||
|
||||
FILE=/etc/foo/bar
|
||||
|
||||
Any other config file:
|
||||
|
||||
INCLUDE $FILE
|
||||
|
Loading…
Reference in New Issue
Block a user