summaryrefslogtreecommitdiffstats
path: root/perl-install/standalone/drakgw
diff options
context:
space:
mode:
authorYves Duret <yduret@mandriva.com>2001-04-06 01:34:44 +0000
committerYves Duret <yduret@mandriva.com>2001-04-06 01:34:44 +0000
commitd9f7b675d6135c9f9e929cb7170ce45f1a21ee53 (patch)
treef40f5910cb9addaafa4ad1c48ffb227b9cca6ba8 /perl-install/standalone/drakgw
parent460fb40c05101436e791b2c835be46e09891b6d4 (diff)
downloaddrakx-d9f7b675d6135c9f9e929cb7170ce45f1a21ee53.tar
drakx-d9f7b675d6135c9f9e929cb7170ce45f1a21ee53.tar.gz
drakx-d9f7b675d6135c9f9e929cb7170ce45f1a21ee53.tar.bz2
drakx-d9f7b675d6135c9f9e929cb7170ce45f1a21ee53.tar.xz
drakx-d9f7b675d6135c9f9e929cb7170ce45f1a21ee53.zip
recoded a embedded && gtk mode
Diffstat (limited to 'perl-install/standalone/drakgw')
-rwxr-xr-xperl-install/standalone/drakgw91
1 files changed, 73 insertions, 18 deletions
diff --git a/perl-install/standalone/drakgw b/perl-install/standalone/drakgw
index 9689d9e56..215eda13f 100755
--- a/perl-install/standalone/drakgw
+++ b/perl-install/standalone/drakgw
@@ -52,14 +52,13 @@ log::l("[drakgw] kernel_version $kernel_version");
$kernel_version eq '2.2' || $kernel_version eq '2.4' or die "Only for 2.2 or 2.4 kernels.\n";
-
my $in = interactive::vnew('su');
+pur_gtk_mode() if $::isEmbedded && ref($in) =~ /gtk/;
sub sys { system(@_) == 0 or die "sys: $_[0]" }
-
-sub start_daemons()
+sub start_daemons ()
{
my $cups_used = 0;
log::l("[drakgw] Starting daemons");
@@ -79,7 +78,7 @@ sub start_daemons()
output $drakgw_setup, "INET_SHARING=enabled\n";
}
-sub stop_daemons()
+sub stop_daemons ()
{
log::l("[drakgw] Stopping daemons");
grep /is running/, `/etc/rc.d/init.d/dhcpd status` and sys("/etc/rc.d/init.d/dhcpd stop");
@@ -94,7 +93,7 @@ sub stop_daemons()
output $drakgw_setup, "INET_SHARING=disabled\n";
}
-sub fatal_quit($)
+sub fatal_quit ($)
{
log::l("[drakgw] FATAL: $_[0]");
undef $wait_configuring;
@@ -103,22 +102,21 @@ sub fatal_quit($)
}
-while ($::isEmbedded) {
- kill USR2, $::CCPID;
-
- my $setup_state = grep(/disabled/, cat_($drakgw_setup)) ? _("The setup has already been done, but it's currently disabled.") :
- grep(/enabled/, cat_($drakgw_setup)) ? _("The setup has already been done, and it's currently enabled.") :
- _("No Internet Connection Sharing has ever been configured.");
+# while ($::isEmbedded) {
+# kill USR2, $::CCPID;
+# my $setup_state = grep(/disabled/, cat_($drakgw_setup)) ? _("The setup has already been done, but it's currently disabled.") :
+# grep(/enabled/, cat_($drakgw_setup)) ? _("The setup has already been done, and it's currently enabled.") :
+# _("No Internet Connection Sharing has ever been configured.");
- $in->ask_okcancel('',
-_("Welcome to the Internet Connection Sharing utility!
+# $in->ask_okcancel('',
+# _("Welcome to the Internet Connection Sharing utility!
-%s
+# %s
-Click on ``Ok'' if you want to launch the setup wizard.", $setup_state)) and system("/usr/sbin/drakgw");
+# Click on ``Ok'' if you want to launch the setup wizard.", $setup_state)) and system("/usr/sbin/drakgw");
- kill USR1, $::CCPID;
-}
+# kill USR1, $::CCPID;
+# }
begin:
@@ -345,7 +343,8 @@ fi
chmod 0700, $rc_firewall_generic;
-output($rc_firewall_22, qq(#!/bin/sh
+output($rc_firewall_22,
+qq(#!/bin/sh
#
# rc.firewall - Initial SIMPLE IP Masquerade test for 2.1.x and 2.2.x kernels using IPCHAINS
#
@@ -591,8 +590,64 @@ sub quit_global {
+########################################################
+
+
+sub pur_gtk_mode
+{
+ require Gtk;
+ init Gtk;
+ my $setup_state = grep(/disabled/, cat_($drakgw_setup)) ? _("The setup has already been done, but it's currently disabled.") :
+ grep(/enabled/, cat_($drakgw_setup)) ? _("The setup has already been done, and it's currently enabled.") :
+ _("No Internet Connection Sharing has ever been configured.");
+
+ my $window1 = $::isEmbedded ? new Gtk::Plug ($::XID) : new Gtk::Window -toplevel;
+ $window1->signal_connect ( delete_event => sub { Gtk->exit(0); });
+ $window1->set_position(1);
+ $window1->set_title(_("Internet connection sharing configuration"));
+ $window1->border_width(10);
+ my $vbox1 = new Gtk::VBox(0,0);
+ $window1->add($vbox1);
+ my $hbox1 = new Gtk::HBox(0,0);
+ $vbox1->pack_start($hbox1,1,1,0);
+ my $label1 = new Gtk::Label(_("Welcome to the Internet Connection Sharing utility!"."\n$setup_state\n".
+ "Click on Configure to launch the setup wizard"));
+ $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_cancel = new Gtk::Button _("Cancel");
+ $button_cancel->signal_connect ( clicked => sub {
+ kill(USR1, $::CCPID);
+ });
+ $bbox1->add($button_cancel);
+ my $button_conf = new Gtk::Button _("Configure");
+ $button_conf->signal_connect ( clicked => sub {
+ system("/usr/sbin/drakgw --wizard");
+ });
+ $bbox1->add($button_conf);
+
+ $window1->show_all();
+ Gtk->main_iteration while Gtk->events_pending;
+ $::isEmbedded and kill USR2, $::CCPID;
+ Gtk->main;
+ Gtk->exit(0);
+
+}
+
+
+
+
+
+
#-------------------------------------------------
#- $Log$
+#- Revision 1.32 2001/04/06 01:34:44 yduret
+#- recoded a embedded && gtk mode
+#-
#- Revision 1.31 2001/03/31 14:21:10 pablo
#- Updated po files and help messages (patch from Pixel)
#-