From 1d763c84dfb418e924307f094580c87b00019da7 Mon Sep 17 00:00:00 2001 From: teastep Date: Fri, 9 Sep 2005 16:52:10 +0000 Subject: [PATCH] Fix param handling in restore-base git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@2654 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb --- Shorewall/firewall | 2 +- Shorewall/functions | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/Shorewall/firewall b/Shorewall/firewall index 35b07840e..88ed68ec7 100755 --- a/Shorewall/firewall +++ b/Shorewall/firewall @@ -8359,7 +8359,7 @@ define_firewall() # $1 = Command (Start or Restart) f=$(find_file params) [ -f $f ] && \ - save_command ". $f" + save_command ". $(resolve_file $f)" save_command "#" save_command "COMMAND=restore" diff --git a/Shorewall/functions b/Shorewall/functions index d8b9156e1..d062eb965 100755 --- a/Shorewall/functions +++ b/Shorewall/functions @@ -162,6 +162,31 @@ find_file() esac } +# +# Get fully-qualified name of file +# +resolve_file() # $1 = file name +{ + local pwd=$PWD + + case $1 in + /*) + echo $1 + ;; + ./*) + echo ${pwd}${1#.} + ;; + ../*) + cd .. + echo ${PWD}${1#..} + cd $pwd + ;; + *) + echo $pwd/$1 + ;; + esac +} + # # Replace commas with spaces and echo the result #