diff --git a/Shorewall-perl/Shorewall/Config.pm b/Shorewall-perl/Shorewall/Config.pm index 6ae09479f..b40b31f0f 100644 --- a/Shorewall-perl/Shorewall/Config.pm +++ b/Shorewall-perl/Shorewall/Config.pm @@ -361,7 +361,7 @@ sub find_file($) { my $filename=$_[0]; - return $filename if substr( $filename, 0, 1 ) eq '/'; + return $filename if $filename =~ '/'; my $directory; diff --git a/Shorewall-perl/buildports.pl b/Shorewall-perl/buildports.pl index 4f03b8acf..180e89a97 100755 --- a/Shorewall-perl/buildports.pl +++ b/Shorewall-perl/buildports.pl @@ -65,10 +65,14 @@ sub print_service( $$ ) { $service_hash{$service} = $number; } } +# +# E x e c u t i o n B e g i n s H e r e +# +set_config_path( '/etc' ); -set_config_path( '/etc/shorewall:/usr/share/shorewall' ); +our $dir = $ARGV[0] || '/etc'; -set_shorewall_dir($ARGV[0] || '/etc'); +$dir =~ s|/+$|| unless $dir eq '/'; our $date = localtime; @@ -116,7 +120,7 @@ our $VERSION = '1.00'; our %protocols = ( EOF -open_file 'protocols' or fatal_error "Cannot open protocols: $!"; +open_file "$dir/protocols" or fatal_error "Cannot open $dir/protocols: $!"; while ( read_a_line1 ) { my ( $proto1, $number, @aliases ) = split_line( 2, 10, '/etc/protocols entry'); @@ -133,7 +137,7 @@ print "\t\t );\n\n"; print "our %services = (\n"; -open_file 'services' or fatal_error "Cannot open services: $!"; +open_file "$dir/services" or fatal_error "Cannot open $dir/services: $!"; while ( read_a_line1 ) { my ( $name1, $proto_number, @names ) = split_line( 2, 10, '/etc/services entry');