summaryrefslogtreecommitdiffstats
path: root/perl-install/standalone/draknet
blob: 7b145ecbcc7a069e7cb86b0b6c30adc138eb0e78 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
#!/usr/bin/perl

# DrakNet

# Copyright (C) 1999 MandrakeSoft (damien@mandrakesoft.com)
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# 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 Gtk;
init Gtk;
use Data::Dumper;
use lib qw(/usr/lib/libDrakX);

use interactive;
use standalone;
use netconnect;
use c;

local $_ = join '', @ARGV;

#/-h/ and die "usage: draknet[--xf3] [--beginner] [--expert] [--auto] [--noauto] [--skiptest] [--testing]\n";

my $netcnx = {};

$::isWizard = 0;
$::wizard_xpm = "/usr/share/pixmaps/internet.xpm";
#$::force_xf3 = /-xf3/;
#$::beginner = /-beginner/;
#$::expert = /-expert/;
#$::auto = /-auto/;
#$::noauto = /-noauto/;
#$::testing = /-testing/;
#$i->{skiptest} = /-skiptest/;

#my $f = "/usr/X11R6/lib/X11/Cards";
#-e $f or system("urpmi --auto XFree86 XFree86-75dpi-fonts");
#-e $f or die "install XFree86 first!\n";

#goto dd;
my $window1 = new Gtk::Window -toplevel;
$window1->signal_connect ( delete_event => sub { Gtk->exit(0); });
$window1->set_position(1);
$window1->set_title(_("Network 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);
$hbox1->pack_start(new Gtk::Label(_("Profil : ")),0,0,0);
$hbox1->pack_start(new Gtk::Label(_("default")),0,0,0);
my $hbox2 = new Gtk::HBox(0,0);
$vbox1->pack_start($hbox2,1,1,0);
$hbox2->pack_start(new Gtk::Label(_("Hostname : ")),0,0,0);
$hbox2->pack_start(new Gtk::Label(_("petite.mandrakesoft.com")),0,0,0);

$vbox1->pack_start(new Gtk::HSeparator,1,1,5);

my $frame1 = new Gtk::Frame (_("Internet access"));
$vbox1->pack_start($frame1,1,1,0);
$table1 = new Gtk::Table (3,3, 0);
$table1->set_row_spacings(5);
$table1->set_col_spacings(5);
#$table1->border_width(10);
$frame1->add($table1);
#attach (table, child, left_attach, right_attach, top_attach, bottom_attach, xoptions, yoptions, xpadding, ypadding)
#$table->attach($button[0], 0, 1, 0, 1, {expand=>1,fill=>1}, {expand=>1,fill=>1},0,0);
$table1->attach(new Gtk::Label(_("Type :")), 0, 1, 0, 1, 'fill', 'fill',0,0);
my $label4 = new Gtk::Label(_("isdn_internal"));
$table1->attach($label4, 1, 2, 0, 1, 'fill', 'fill',0,0);
my $label5 = new Gtk::Label(_("Interface :"));
$table1->attach($label5, 0, 1, 1, 2, 'fill', 'fill',0,0);
my $label6 = new Gtk::Label(_("ippp0"));
$table1->attach($label6, 1, 2, 1, 2, 'fill', 'fill',0,0);
my $label7 = new Gtk::Label(_("Status :"));
$table1->attach($label7, 0, 1, 2, 3, 'fill', 'fill',0,0);
my $label8 = new Gtk::Label(_("not connected"));
$table1->attach($label8, 1, 2, 2, 3, 'fill', 'fill',0,0);

my $button1 = new Gtk::Button(_("Configure..."));
$table1->attach($button1, 2, 3, 0, 2, 'fill', 'fill',0,0);
$button1->signal_connect( 'clicked', \&configure_net );

my $button2 = new Gtk::Button(_("Connect..."));
$table1->attach($button2, 2, 3, 2, 3, 'fill', 'fill',0,0);


my $separator2 = new Gtk::HSeparator;
$vbox1->pack_start($separator2,1,1,5);

my $frame2 = new Gtk::Frame (_("LAN configuration"));
$vbox1->pack_start($frame2,1,1,0);
$table2 = new Gtk::Table (3,2, 0);
$table2->set_row_spacings(5);
$table2->set_col_spacings(5);
#$table1->border_width(10);
$frame2->add($table2);
#attach (table, child, left_attach, right_attach, top_attach, bottom_attach, xoptions, yoptions, xpadding, ypadding)
#$table->attach($button[0], 0, 1, 0, 1, {expand=>1,fill=>1}, {expand=>1,fill=>1},0,0);
my $label9 = new Gtk::Label(_("Network adaptater 1 (eth0) :"));
$table2->attach($label9, 0, 1, 0, 1, 'fill', 'fill',0,0);
my $label10 = new Gtk::Label(_("isdn_internal"));
$table2->attach($label10, 1, 2, 0, 1, 'fill', 'fill',0,0);
my $label11 = new Gtk::Label(_("Interface :"));
$table2->attach($label11, 0, 1, 1, 2, 'fill', 'fill',0,0);
my $label12 = new Gtk::Label(_("ippp0"));
$table2->attach($label12, 1, 2, 1, 2, 'fill', 'fill',0,0);
my $label13 = new Gtk::Label(_("Status :"));
$table2->attach($label13, 0, 1, 2, 3, 'fill', 'fill',0,0);
my $label14 = new Gtk::Label(_("not connected"));
$table2->attach($label14, 1, 2, 2, 3, 'fill', 'fill',0,0);


$window1->show_all();
Gtk->main;

#dd:

my $in = vnew interactive('su');

#my $wait = $in->wait_message('', '', 1);
netconnect::intro('', $netcnx, $in, -e "/etc/pcmcia", sub {});#\&standalone::pkgs_install);
$in->exit(0);

sub configure_net {

    my $isdn;
    netconnect::isdn_detect_backend($isdn);
    print "isdn $_ : $isdn->{$_}\n" foreach qw(description vendor id driver card_type type);

    my $netc={};
    my $intf={};
    any::setup_thiskind_backend('net', undef);
    my @all_cards = netconnect::conf_network_card_backend ('', $netc, $intf, undef, undef, undef, undef);

#    print " fffff : " . Data::Dumper->Dump([@all_cards], ['@all_cards']) . "\n";

    print "nb : " . $netc->{nb_cards} ."\n";
    map { print "$_->[0] : $_->[1] \n" } @all_cards;

    print " jjjj : " . run_program::rooted($prefix, "/bin/ping -c 1 kdsdfsdenobi" ) . "\n";
#    system("ping eth0 10.0.0.10 netmask 255.255.255.0");
#    system("ifconfig eth0 10.0.0.10 netmask 255.255.255.0");

    my $window = new Gtk::Window -toplevel;
    $window->signal_connect ( delete_event => sub { Gtk->main_quit; });
    $window->set_position(1);
    $window->set_title(_("Internet connection configuration"));
    $window->border_width(10);
    my $vbox1 = new Gtk::VBox(0,0);
    $window->add($vbox1);
    $vbox1->pack_start(new Gtk::Label(_("Profil : ")),0,0,0);

    $window->show_all();
    Gtk->main;

}