> On 3/7/2018 8:58 AM, Simon Matter wrote:
>> Hi Tom and all,
>>
>> I've just decided to add some more autodetection code some params file.
>>
>> One of the lines looks something like this:
>> read -rs LOC_NETADDR DUMMY 2> /dev/null < <(ip -o route list proto
>> kernel
>> scope link dev "$LOC_IF" 2> /dev/null)
>>
>> The result was a shell error:
>> /etc/shorewall/params: line 49: syntax error near unexpected token `<'
>> /etc/shorewall/params: line 49: `read -rs LOC_NETADDR DUMMY 2> /dev/null
>> <
>> <(ip -o route list proto kernel scope link dev "$LOC_IF" 2> /dev/null)'
>>
>> Yes of course, because the line contains bashism. But, since the line is
>> not portable anyway and all our systems have bash by default, I've
>> decided
>> to configure it via /etc/shorewall/shorewall.conf:
>> SHOREWALL_SHELL=/bin/bash
>>
>> Retried, and the error was the same. I'm wondering if I missed something
>> because the docs say this:
>> /etc/shorewall/params - use this file to set shell variables that you
>> will
>> expand in other files. It is always processed by /bin/sh or by the shell
>> specified through SHOREWALL_SHELL in /etc/shorewall/shorewall.conf.
>>
>> Something doesn't seem to work as I expected.
>>
>> Anyway, I found a simple workaround, in the params file I do:
>>
>> --%-------
>> set +o posix
>>
>> # Run bashism code here
>>
>> set -o posix
>> --%-------
>>
>> Works fine and I even like it more than modifying shorewall.conf.
>>
>
> According to Tom, the 'SHOREWALL_SHELL' variable in
> /etc/shorewall/shorewall.conf is not used in this context:
>
> https://sourceforge.net/p/shorewall/mailman/shorewall-users/thread/84192d62-6163-94c3-4075-41391601a136%40gmail.com/#msg36160992
>
>
> ... ~/git/shorewall/code
> $ git grep -n /params -- *lib*
> Shorewall/lib.cli-std:1468:     if [ -f $g_shorewalldir/params ]; then
> Shorewall/lib.cli-std:1469:         . $g_shorewalldir/params

Okay, but the man page shorewall-params says something different:

The file is always processed by /bin/sh or by the shell specified through
SHOREWALL_SHELL in shorewall.conf[1] (5) so the full range of shell
capabilities may be used.

Even if I set SHOREWALL_SHELL=/bin/bash then 'params' is still processed
by /bin/sh.

Regards,
Simon


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Shorewall-users mailing list
Shorewall-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/shorewall-users

Reply via email to