summaryrefslogtreecommitdiffstats
path: root/perl-install/network/smb.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2002-02-14 20:39:15 +0000
committerPascal Rigaux <pixel@mandriva.com>2002-02-14 20:39:15 +0000
commit8cb17de0ec7ac28ca28562c5a5475594b5e5ba9b (patch)
treebf3b8bec65d6e3b16ea822aab9a01a470f90b97b /perl-install/network/smb.pm
parent036bfccc67f49edf02b6fdb0153036ebe0353989 (diff)
downloaddrakx-8cb17de0ec7ac28ca28562c5a5475594b5e5ba9b.tar
drakx-8cb17de0ec7ac28ca28562c5a5475594b5e5ba9b.tar.gz
drakx-8cb17de0ec7ac28ca28562c5a5475594b5e5ba9b.tar.bz2
drakx-8cb17de0ec7ac28ca28562c5a5475594b5e5ba9b.tar.xz
drakx-8cb17de0ec7ac28ca28562c5a5475594b5e5ba9b.zip
cleaner & OOed code, with more code sharing
Diffstat (limited to 'perl-install/network/smb.pm')
-rw-r--r--perl-install/network/smb.pm42
1 files changed, 25 insertions, 17 deletions
diff --git a/perl-install/network/smb.pm b/perl-install/network/smb.pm
index 1e141fe48..0061f94b2 100644
--- a/perl-install/network/smb.pm
+++ b/perl-install/network/smb.pm
@@ -1,26 +1,34 @@
-package network::smb;
+package network::smb; # $Id$
+
+use strict;
+use diagnostics;
use common;
use network::network;
+use network::smbnfs;
-sub check {
- my ($in) = @_;
+our @ISA = 'network::smbnfs';
- my $pkg = 'samba-client';
- my $f = '/usr/bin/nmblookup';
- if (! -e $f) {
- $in->ask_okcancel('', _("The package %s needs to be installed. Do you want to install it?", $pkg), 1) or return;
- $in->do_pkgs->install($pkg);
- }
- if (! -e $f) {
- $in->ask_warn('', _("Mandatory package %s is missing", $pkg));
- return;
- }
- 1;
+sub to_fstab_entry {
+ my ($class, $e) = @_;
+ $class->to_fstab_entry_raw($e, 'nfs');
+}
+sub from_dev {
+ my ($class, $dev) = @_;
+ $dev =~ m|//(.*?)/(.*)|;
+}
+sub to_dev_raw {
+ my ($class, $server, $name) = @_;
+ '//' . $server . '/' . $name;
+}
+
+sub check {
+ my ($class, $in) = @_;
+ $class->raw_check($in, 'samba-client', '/usr/bin/nmblookup');
}
-sub find_servers() {
+sub find_servers {
my (undef, @l) = `nmblookup "*"`;
s/\s.*\n// foreach @l;
my @servers = grep { network::network::is_ip($_) } @l;
@@ -41,7 +49,7 @@ sub find_servers() {
}
sub find_exports {
- my ($server) = @_;
+ my ($class, $server) = @_;
my @l;
my $name = $server->{name} || $server->{ip};
my $ip = $server->{ip} ? "-I $server->{ip}" : '';
@@ -55,7 +63,7 @@ sub find_exports {
s/^\t//;
my ($name, $type, $comment) = unpack "A15 A10 A*", $_;
if ($name eq '---------' && $type eq '----' && $comment eq '-------' .. /^$/) {
- push @l, { name => $name, type => $type, comment => $comment }
+ push @l, { name => $name, type => $type, comment => $comment, server => $server }
if $type eq 'Disk' && $name !~ /\$$/;
}
}
n252'>252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566
#!/usr/bin/perl

#
# Guillaume Cottenceau (gc@mandrakesoft.com)
#
# Copyright 2000-2002 MandrakeSoft
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2, as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#

use strict;
use lib qw(/usr/lib/libDrakX);

use standalone;     #- warning, standalone must be loaded very first, for 'explanations'

use common;
use detect_devices;
use interactive;
use network;
use log;
use c;
use network::netconnect;
use network::shorewall;

$::isInstall and die "Not supported during install.\n";


local $_ = join '', @ARGV;

$::Wizard_pix_up = "wiz_drakgw.png";
$::Wizard_title = N("Internet Connection Sharing");
$::direct = /-direct/;


my $sysconf_network = "/etc/sysconfig/network";
my $sysconf_dhcpd = "/etc/sysconfig/dhcpd";
my $rc_firewall_generic = "/etc/rc.d/rc.firewall";
my $rc_firewall_drakgw = "/etc/rc.d/rc.firewall.inet_sharing";
my $rc_firewall_24 = "/etc/rc.d/rc.firewall.inet_sharing-2.4";
my $masq_file = "/etc/shorewall/masq";
my $dhcpd_conf = "/etc/dhcpd.conf";
my $cups_conf = "/etc/cups/cupsd.conf";

my $shorewall = network::shorewall::read();

my $in = 'interactive'->vnew('su', 'default');

!$::isEmbedded && $in->isa('interactive::gtk') and $::isWizard = 1;

pur_gtk_mode() if $::isEmbedded && $in->isa('interactive::gtk');

sub sys { system(@_) == 0 or log::l("[drakgw] Warning, sys failed for $_[0]") }

sub outpend { 
    standalone::explanations("modified file $_[0]");
    my $f = shift; local *F; open F, ">>$f" or die "outpend in file $f failed: $!\n"; print F foreach @_;
}

sub start_daemons () {
    my $cups_used = 0;
    standalone::explanations("Starting daemons");
    if (-f "/etc/rc.d/init.d/cups") {
        if (system("/etc/rc.d/init.d/cups status >/dev/null") == 0) {
           $cups_used = 1;
           sys("/etc/rc.d/init.d/cups stop");
        }
    }
    system("/etc/rc.d/init.d/dhcpd status >/dev/null") == 0 and sys("/etc/rc.d/init.d/dhcpd stop");
    system("/etc/rc.d/init.d/named status >/dev/null 2>/dev/null") == 0 and sys("/etc/rc.d/init.d/named stop");

    my $netscripts = '/etc/sysconfig/network-scripts';
    sys("$netscripts/net_cnx_down >/dev/null");
    sys("/etc/rc.d/init.d/network restart >/dev/null");
    sys("$netscripts/net_cnx_up >/dev/null");

    sys("/etc/init.d/shorewall restart >/dev/null");

    sys("/etc/rc.d/init.d/$_ start >/dev/null"), sys("/sbin/chkconfig --level 345 $_ on") foreach 'named', 'dhcpd', 'shorewall';
    sys("/etc/rc.d/init.d/cups start >/dev/null") if $cups_used;
}

sub stop_daemons () {
    standalone::explanations("Stopping daemons");
    foreach (qw(dhcpd named)) {
	system("/etc/rc.d/init.d/$_ status >/dev/null 2>/dev/null") == 0 and sys("/etc/rc.d/init.d/$_ stop");
    }
    system("/etc/rc.d/init.d/shorewall status >/dev/null 2>/dev/null") == 0 and sys("/etc/rc.d/init.d/shorewall clear >/dev/null");
    sys("/sbin/chkconfig --level 345 $_ off") foreach 'named', 'dhcpd';
}

my $wait_configuring;

sub fatal_quit ($) {
    log::l("[drakgw] FATAL: $_[0]");
    undef $wait_configuring;
    $in->ask_warn('', $_[0]);
    quit_global($in, -1);
}

my ($kernel_version) = c::kernel_version() =~ /(...)/;
log::l("[drakgw] kernel_version $kernel_version");

$kernel_version eq '2.4' or fatal_quit(N("Sorry, we support only 2.4 kernels."));

begin:

#- **********************************
#- * 0th step: verify if we are already set up

if ($shorewall && $shorewall->{masquerade}) {
    $::Wizard_no_previous = 1;

    if (!$shorewall->{disabled}) {
	my $r = $in->ask_from_list_(N("Internet Connection Sharing currently enabled"),
N("The setup of Internet connection sharing has already been done.
It's currently enabled.

What would you like to do?"),
				   [ N_("disable"), N_("reconfigure"), N_("dismiss") ]) or quit_global($in, 0);
	if ($r eq "disable") {
	    {
		my $wait_disabl = $in->wait_message('', N("Disabling servers..."));
		stop_daemons();
	    }
	    foreach ($dhcpd_conf, $masq_file) {
		renamef($_, "$_.drakgwdisable") or die "Could not rename $_ to $_.drakgwdisable" 
	    }
	    sys("/etc/init.d/shorewall restart >/dev/null");
	    log::l("[drakgw] Disabled");
	    $::Wizard_finished = 1;
	    $in->ask_okcancel('', N("Internet connection sharing is now disabled."));
	    quit_global($in, 0);
	}
	if ($r eq "dismiss") {
	    quit_global($in, 0);
	}
    } else {
	my $r = $in->ask_from_list_(N("Internet Connection Sharing currently disabled"),
N("The setup of Internet connection sharing has already been done.
It's currently disabled.

What would you like to do?"),
				   [ N_("enable"), N_("reconfigure"), N_("dismiss") ]);
	if ($r eq "enable") {
	    foreach ($dhcpd_conf, $masq_file) {
		rename($_, "$_.old") if -f $_;
		rename("$_.drakgwdisable", $_) or die "Could not find configuration. Please reconfigure.";
	    }
	    {
		my $wait_enabl = $in->wait_message('', N("Enabling servers..."));
		start_daemons();
	    }
            log::l("[drakgw] Enabled");
	    $::Wizard_finished = 1;
	    $in->ask_okcancel('', N("Internet connection sharing is now enabled."));
	    quit_global($in, 0);
	}
	if ($r eq "dismiss") {
	    quit_global($in, 0);
	}
    }
}


#- **********************************
#- * 1st step: detect/setup
step_ask_confirm:

$::Wizard_no_previous = 1;
    
$::direct or $in->ask_okcancel(N("Internet Connection Sharing"),
N("You are about to configure your computer to share its Internet connection.
With that feature, other computers on your local network will be able to use this computer's Internet connection.

Make sure you have configured your Network/Internet access using drakconnect before going any further.

Note: you need a dedicated Network Adapter to set up a Local Area Network (LAN)."), 1) or quit_global($in, 0);

undef $::Wizard_no_previous;


step_detectsetup:

my @configured_devices = map { /ifcfg-(\S+)/ } glob('/etc/sysconfig/network-scripts/ifcfg*');

my %aliased_devices; 
/^\s*alias\s+(eth[0-9])\s+(\S+)/ and $aliased_devices{$1} = $2 foreach cat_("/etc/modules.conf");

my $card_netconnect = network::netconnect::get_net_device();
defined $card_netconnect and log::l("[drakgw] Information from netconnect: ignore card $card_netconnect");

my @cards = grep {
    log::l("[drakgw] Have network card: $_");
    $_ ne $card_netconnect
} detect_devices::getNet();
log::l("[drakgw] Available network cards: ", join(", ", @cards));

my $format = sub {
    $aliased_devices{$_[0]} ?
      N("Interface %s (using module %s)", $_[0], $aliased_devices{$_[0]}) :
      N("Interface %s", $_[0]);
};

#- setup the network interface we shall use

my $device;
if (!@cards)
{
    $in->ask_warn(N("No network adapter on your system!"), 
		  N("No ethernet network adapter has been detected on your system. Please run the hardware configuration tool."));
    quit_global($in, 0);
}
elsif (@cards == 1)
{
    $device = $cards[0];
    $in->ask_okcancel(N("Network interface"),
N("There is only one configured network adapter on your system:

%s

I am about to setup your Local Area Network with that adapter.", $format->($device)), 1) or goto step_ask_confirm;
} else {
    $device = $in->ask_from_listf(N("Choose the network interface"),
				    N("Please choose what network adapter will be connected to your Local Area Network."),
				     $format,
				    \@cards,
				    ) or goto step_ask_confirm;
    defined $device or quit_global($in, 0);
}
standalone::explanations("Choosing network device: $device");


my $lan_address = "192.168.1.0";
my $server_ip = "192.168.1.1";
my $nameserver_ip = "192.168.1.1";
my $netmask = "255.255.255.0";
my $start_range = "16";
my $end_range = "253";
my $default_lease = "21600";
my $max_lease = "43200";
my $internal_domain_name = "homeland.net";

my $reconf_dhcp_server_intf = 1;

if (grep(/$device/, @configured_devices)) {
  step_warning_already_conf:
    my $auto = N("Yes");
		my $dhcp_details = N("Yes");
    my $conf = network::read_interface_conf("/etc/sysconfig/network-scripts/ifcfg-$device");
    $in->ask_from(N("Network interface already configured"),
		  N("Warning, the network adapter (%s) is already configured.

Do you want an automatic re-configuration?

You can do it manually but you need to know what you're doing.", $device),
		  [ { label => N("Automatic reconfiguration"), val => \$auto, list => [ N("Yes"), N("No (experts only)") ] },
		    { val => N("Show current interface configuration"), clicked =>
		      sub { $in->ask_warn(N("Current interface configuration"),
					  N("Current configuration of `%s':

Network: %s
IP address: %s
IP attribution: %s
Driver: %s", $device, $conf->{NETWORK}, $conf->{IPADDR}, $conf->{BOOTPROTO}, $aliased_devices{$device} || '(unknown)')) } } ]) or goto step_detectsetup;
    
    if ($auto ne N("Yes")) {
	$reconf_dhcp_server_intf = 0;
	$server_ip = $conf->{IPADDR};
	$nameserver_ip = $conf->{IPADDR};
	$lan_address = $conf->{NETWORK};
	$in->ask_from('',
		      N("I can keep your current configuration and assume you already set up a DHCP server; in that case please verify I correctly read the Network that you use for your local network; I will not reconfigure it and I will not touch your DHCP server configuration.

The default DNS entry is the Caching Nameserver configured on the firewall. You can replace that with your ISP DNS IP, for example.
		      
Else, I can reconfigure your interface and (re)configure a DHCP server for you.

", $device),
      [ { label => N("Local Network adress"), val => \$lan_address, type => 'entry' },
			{ label => N("Netmask"), val => \$netmask, type => 'entry' } ])
		  or goto step_warning_already_conf;
	$in->ask_from('',
		      N("DHCP Server Configuration.

Here you can select different options for the DHCP server configuration.
If you don't know the meaning of an option, simply leave it as it is.

", $device),
			[ { label => N("(This) DHCP Server IP"), val => \$server_ip, type => 'entry' },
			{ label => N("The DNS Server IP"), val => \$nameserver_ip, type => 'entry' },
			{ label => N("The internal domain name"), val => \$internal_domain_name, type => 'entry' },
			{ label => N("The DHCP start range"), val => \$start_range, type => 'entry' },
			{ label => N("The DHCP end range"), val => \$end_range, type => 'entry' },
			{ label => N("The default lease (in seconds)"), val => \$default_lease, type => 'entry' },
			{ label => N("The maximum lease (in seconds)"), val => \$max_lease, type => 'entry' },
			{ label => N("Re-configure interface and DHCP server"), val => \$reconf_dhcp_server_intf, type => 'bool' } ])
	  or goto step_warning_already_conf;
    }
}
    
if (!($lan_address =~ s/\.0$//)) {
    $in->ask_warn('', 
		  N("The Local Network did not finish with `.0', bailing out."));
    quit_global($in, 0);
}
standalone::explanations("Using LAN address <$lan_address>");


#- test for potential conflict with other networks

foreach (grep { $_ ne $device } @configured_devices)
{
    grep(/$lan_address/, cat_("/etc/sysconfig/network-scripts/ifcfg-$_")) and
      ($in->ask_warn('', N("Potential LAN address conflict found in current config of %s!\n", $_)) or goto step_detectsetup);
}


#- test for potential conflict with previous firewall config
network::shorewall::check_iptables($in) or goto step_detectsetup;

#- **********************************
#- * 2nd step: configure

$wait_configuring = $in->wait_message(N("Configuring..."), 
				      N("Configuring scripts, installing software, starting servers..."));


#- setup the /etc/sysconfig/network-script/ script

if ($reconf_dhcp_server_intf) {
    standalone::explanations("Reconfiguring network parameters of $device");
    my $network_scripts = "/etc/sysconfig/network-scripts";
    my $ifcfg = "$network_scripts/ifcfg-$device";
    renamef($ifcfg, "$network_scripts/old.ifcfg-$device");
    output($ifcfg, qq(DEVICE=$device
BOOTPROTO=static
IPADDR=$server_ip
NETMASK=$netmask
NETWORK=$lan_address.0
BROADCAST=$lan_address.255
ONBOOT=yes
));
}


#- install and setup the RPM packages

my $rpms_to_install;
my %rpm2file = ('dhcp-server' => '/usr/sbin/dhcpd',
		bind => '/usr/sbin/named',
		shorewall => '/sbin/shorewall',
		'caching-nameserver' => '/var/named/named.local');

#- first: try to install all in one step
my @needed_to_install = grep { !-e $rpm2file{$_} } keys %rpm2file;
@needed_to_install and $in->do_pkgs->install(@needed_to_install);
#- second: try one by one if failure detected
if (grep { !-e $rpm2file{$_} } keys %rpm2file) {
    foreach (keys %rpm2file) {
	-e $rpm2file{$_} or $in->do_pkgs->install($_);
	-e $rpm2file{$_} or fatal_quit(N("Problems installing package %s", $_));
    }
}

put_in_hash($shorewall ||= {}, {
    disabled => 0,
    net_interface => $card_netconnect,
    if_(@cards > 1, loc_interface => [ grep { $_ ne $device } @cards ]),
    masquerade => { interface => $device, subnet => "$lan_address.0/$netmask" },
});

network::shorewall::write($shorewall);

#- be sure that FORWARD_IPV4 is enabled in /etc/sysconfig/network

substInFile { s/^FORWARD_IPV4.*\n//; $_ .= "FORWARD_IPV4=true\n" if eof } $sysconf_network;


#- setup the DHCP server

if ($reconf_dhcp_server_intf) {
    standalone::explanations("Configuring a DHCP server on $lan_address.0");
    renamef($dhcpd_conf, "$dhcpd_conf.old");
    output($dhcpd_conf, qq(subnet $lan_address.0 netmask $netmask {
	# default gateway
	option routers $server_ip;
	option subnet-mask $netmask;

	option domain-name "$internal_domain_name";
	option domain-name-servers $nameserver_ip;

	range dynamic-bootp $lan_address.$start_range $lan_address.$end_range;
	default-lease-time $default_lease;
	max-lease-time $max_lease;
}
));
}

my $update_dhcp = '/usr/sbin/update_dhcp.pl';
-e $update_dhcp and system($update_dhcp);


#- put the interface for the dhcp server in the sysconfig-dhcp config, for the /etc/init.d script of dhcpd

substInFile { s/^INTERFACES\n//; $_ .= "INTERFACES=\"$device\"\n" if eof } $sysconf_dhcpd;


#- Set up /etc/cups/cupsd.conf to make the broadcasting of the printer info
#- working correctly: 
#- 
#-  1. ServerName <server's IP address>  # because clients do necessarily 
#-                                       # know the server's name
#-
#-  2. BrowseAddress <server's Broadcast IP> # broadcast printer info into
#-                                           # the local network.
#-
#-  3. BrowseOrder Deny,Allow
#-     BrowseDeny All
#-     BrowseAllow <IP mask for local net> # Only accept broadcast signals 
#-                                         # coming from local network
#-
#-  4. <Location />
#-     Order Deny,Allow
#-     Deny From All
#-     Allow From <IP mask for local net> # Allow only machines of local 
#-     </Location>                        # network to access the server
#-     
#- These steps are only done when the CUPS package is installed.

#- Modify the root location block in /etc/cups/cupsd.conf

if (-f $cups_conf) {
    standalone::explanations("Updating CUPS configuration accordingly");

    substInFile {
        s/^ServerName[^:].*\n//; $_ .= "ServerName $server_ip\n" if eof;
        s/^BrowseAddress.*\n//; $_ .= "BrowseAddress $lan_address.255\n" if eof;
        s/^BrowseOrder.*\n//; $_ .= "BrowseOrder Deny,Allow\n" if eof;
        s/^BrowseDeny.*\n//; $_ .= "BrowseDeny All\n" if eof;
        s/^BrowseAllow.*\n//; $_ .= "BrowseAllow $lan_address.*\n" if eof;
    } $cups_conf;

    my @cups_conf_content = cat_($cups_conf);
    my @root_location; my $root_location_start; my $root_location_end;

    # Cut out the root location block so that it can be treated seperately
    # without affecting the rest of the file
    if (grep(m|^\s*<Location\s+/\s*>|, @cups_conf_content)) {
	$root_location_start = -1;
	$root_location_end = -1;
	# Go through all the lines, bail out when start and end line found
	for (my $i = 0; $i < @cups_conf_content && $root_location_end == -1; $i++) {
	    if ($cups_conf_content[$i] =~ m|^\s*<\s*Location\s+/\s*>|) {
		$root_location_start = $i;
	    } elsif (($cups_conf_content[$i] =~ m|^\s*<\s*/Location\s*>|) && $root_location_start != -1) {
		$root_location_end = $i;
	    }
	}
	# Rip out the block and store it seperately
	@root_location = splice(@cups_conf_content, $root_location_start, $root_location_end - $root_location_start + 1);
    } else {
	# If there is no root location block, create one
	$root_location_start = @cups_conf_content;
	@root_location = ("<Location />\n", "</Location>\n");
    }
 
    # Delete all former "Order", "Allow", and "Deny" lines from the root location block
    s/^\s*Order.*//, s/^\s*Allow.*//, s/^\s*Deny.*// foreach @root_location;
 
    # Add the new "Order" and "Deny" lines, add an "Allow" line for the local network
    splice(@root_location, -1, 0, $_) foreach ("Order Deny,Allow\n", "Deny From All\n", "Allow From 127.0.0.1\n",
					       "Allow From $lan_address.*\n");
 
    # Put the changed root location block back into the file
    splice(@cups_conf_content, $root_location_start, 0, @root_location);
 
    output $cups_conf, @cups_conf_content;
}


#- start the daemons

start_daemons();


#- bye-bye message

undef $wait_configuring;

$::Wizard_no_previous = 1;
$::Wizard_finished = 1;

$in->ask_okcancel(N("Congratulations!"), 
N("Everything has been configured.
You may now share Internet connection with other computers on your Local Area Network, using automatic network configuration (DHCP)."));


log::l("[drakgw] Installation complete, exiting");
quit_global($in, 0);

sub quit_global {
    my ($in, $exitcode) = @_;
    $in->exit($exitcode);
    goto begin
}

sub pur_gtk_mode {
    require my_gtk;
    import my_gtk qw(:helpers :wrappers);
    my $setup_state = $shorewall && $shorewall->{masquerade} ? 
                         ($shorewall->{disabled} ? 
			  N("The setup has already been done, but it's currently disabled.") :
			  N("The setup has already been done, and it's currently enabled.")) :
			 N("No Internet Connection Sharing has ever been configured.");
    
    my $window1 = my_gtk->new('drakgw');
    $window1->{rwindow}->signal_connect(delete_event => sub { my_gtk->exit(0) });
    unless ($::isEmbedded) {
        $window1->{rwindow}->set_position(1);
        $window1->{rwindow}->set_title(N("Internet connection sharing configuration"));
    }
    $window1->{rwindow}->border_width(10);
    my $vbox1 = new Gtk::VBox(0,0);
    $window1->{rwindow}->add($vbox1);
    my $hbox1 = new Gtk::HBox(0,0);
    $vbox1->pack_start($hbox1,1,1,0);
    my $label1 = new Gtk::Label(
N("Welcome to the Internet Connection Sharing utility!

%s

Click on Configure to launch the setup wizard.", $setup_state));
    $hbox1->pack_start($label1,1,1,0);
    my $hbox2 = new Gtk::HBox(0,0);
    $vbox1->pack_start($hbox2,1,1,0);
    
    my $bbox1 = new Gtk::HButtonBox;
    $vbox1->pack_start($bbox1,0,0,0);
    $bbox1->set_layout(-end);
    my $button_conf = new Gtk::Button N("Configure");
    $button_conf->signal_connect(clicked => sub {
				       system("/usr/sbin/drakgw --wizard");
				       kill('USR1', $::CCPID);
				   });
    $bbox1->add($button_conf);
    my $button_cancel = new Gtk::Button N("Cancel");
    $button_cancel->signal_connect(clicked => sub {
					 kill('USR1', $::CCPID);
				     });
    $bbox1->add($button_cancel);
    $window1->{rwindow}->show_all();
    $window1->main;
    my_gtk->exit(0);
    
}