summaryrefslogtreecommitdiffstats
path: root/perl-install/standalone/drakautoinst
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/standalone/drakautoinst')
-rwxr-xr-xperl-install/standalone/drakautoinst109
1 files changed, 53 insertions, 56 deletions
diff --git a/perl-install/standalone/drakautoinst b/perl-install/standalone/drakautoinst
index 4512571ca..2648cf4bd 100755
--- a/perl-install/standalone/drakautoinst
+++ b/perl-install/standalone/drakautoinst
@@ -1,9 +1,9 @@
#!/usr/bin/perl
#
-# Guillaume Cottenceau (gc@mandrakesoft.com)
+# Guillaume Cottenceau (gc)
#
-# Copyright 2001-2004 MandrakeSoft
+# Copyright 2001-2008 Mandriva
#
# This software may be freely redistributed under the terms of the GNU
# public license.
@@ -21,8 +21,7 @@ use common;
use interactive;
use devices;
use detect_devices;
-use steps;
-use commands;
+use install::steps;
use fs;
use Data::Dumper;
@@ -36,7 +35,7 @@ my $in = 'interactive'->vnew('su', 'default');
my $imagefile = "/root/drakx/replay_install.img";
my $imagefile2 = "/root/drakx/replay_install_drivers.img";
-f $imagefile or $in->ask_warn(N("Error!"),
- N("I can't find needed image file `%s'.", $imagefile), 1), quit_global($in, 0);
+ N("I cannot find needed image file `%s'.", $imagefile), 1), quit_global($in, 0);
$direct or $in->ask_okcancel(N("Auto Install Configurator"),
N("You are about to configure an Auto Install floppy. This feature is somewhat dangerous and must be used circumspectly.
@@ -77,26 +76,26 @@ do {
log::explanations(N("Creating auto install floppy"));
my $_w = $in->wait_message('', N("Creating auto install floppy"));
eval {
- commands::dd("if=$imagefile", "of=$dev", "bs=1440", "count=1024");
+ run_program::run('dd', "if=$imagefile", "of=$dev", "bs=1440", "count=1024");
common::sync();
};
$again = $@; #- grrr... $@ is localized in code block :-(
} while $again;
-fs::mount($dev, $mountdir, 'vfat', 0);
+fs::mount::mount($dev, $mountdir, 'vfat', 0);
if (-f $imagefile2) {
do {
- eval { fs::umount($mountdir) };
+ eval { fs::mount::umount($mountdir) };
$in->ask_okcancel('', N("Insert another blank floppy in drive %s (for drivers disk)", $floppy), 1) or quit_global($in, 0);
log::explanations(N("Creating auto install floppy (drivers disk)"));
my $_w = $in->wait_message('', N("Creating auto install floppy"));
eval {
- commands::dd("if=$imagefile2", "of=$dev", "bs=1440", "count=1024");
+ run_program::run('dd', "if=$imagefile2", "of=$dev", "bs=1440", "count=1024");
common::sync();
};
$again = $@; #- grrr... $@ is localized in code block :-(
} while $again;
- fs::mount($dev, $mountdir, 'ext2', 0);
+ fs::mount::mount($dev, $mountdir, 'ext2', 0);
}
my $cfgfile = "$mountdir/auto_inst.cfg";
@@ -105,8 +104,8 @@ my $o_old = $o; # BUG (maybe install's $::o ?)
my %struct_gui;
if (!$::isEmbedded && $in->isa('interactive::gtk')) {
- require ugtk2;
- ugtk2->import(qw(:helpers :wrappers :create));
+ require ugtk3;
+ ugtk3->import(qw(:helpers :wrappers :create));
my %tree;
$struct_gui{$_} = 'General' foreach qw(lang isUpgrade autoExitInstall timezone default_packages);
@@ -126,9 +125,7 @@ if (!$::isEmbedded && $in->isa('interactive::gtk')) {
manualFstab => 'partition',
useSupermount => '',
partitioning => 'partition',
- intf => 'network',
- netc => 'network',
- netcnx => 'network',
+ net => 'network',
superuser => 'user',
users => 'user',
authentication => '',
@@ -141,37 +138,37 @@ if (!$::isEmbedded && $in->isa('interactive::gtk')) {
exists $struct_gui{$_} and push @{$tree{$struct_gui{$_}}}, [ $_ , $pixmap{$_}, h2widget($o->{$_}, "\$o->\{$_}") ] foreach keys %$o;
- my $W = ugtk2->new('$o edition');
+ my $W = ugtk3->new('$o edition');
my @box_to_hide;
my $nb_pages=0;
- my $notebook = new Gtk2::Notebook;
+ my $notebook = Gtk3::Notebook->new;
$notebook->set_show_border(0);
$notebook->set_show_tabs(0);
- $notebook->append_page(gtkpack_(gtkset_border_width(new Gtk2::VBox(0,0), 10),
- 1, new Gtk2::VBox(0,0),
- 0, gtkpack_(new Gtk2::HBox(0,0),
- 1, new Gtk2::VBox(0,0),
- 0, gtkadd(gtkset_shadow_type(new Gtk2::Frame, 'etched-in'),
+ $notebook->append_page(gtkpack_(gtkset_border_width(Gtk3::VBox->new(0,0), 10),
+ 1, Gtk3::VBox->new(0,0),
+ 0, gtkpack_(Gtk3::HBox->new(0,0),
+ 1, Gtk3::VBox->new(0,0),
+ 0, gtkadd(gtkset_shadow_type(Gtk3::Frame->new, 'etched-in'),
gtkcreate_img('mdk_logo')),
- 1, new Gtk2::VBox(0,0),
+ 1, Gtk3::VBox->new(0,0),
),
0, N("\nWelcome.\n\nThe parameters of the auto-install are available in the sections on the left"),
- 1, new Gtk2::VBox(0,0),
+ 1, Gtk3::VBox->new(0,0),
), undef);
$notebook->show_all;
$notebook->set_current_page(0);
gtkadd($W->{window},
- gtkpack_(new Gtk2::VBox(0,5),
- 1, gtkpack_(new Gtk2::HBox(0,0),
- 0, gtkadd(gtkset_size_request(gtkset_shadow_type(new Gtk2::Frame, 'in'), 130, 470),
- gtkpack_(new Gtk2::VBox(0,0),
+ gtkpack_(Gtk3::VBox->new(0,5),
+ 1, gtkpack_(Gtk3::HBox->new(0,0),
+ 0, gtkadd(gtkset_size_request(gtkset_shadow_type(Gtk3::Frame->new, 'in'), 130, 470),
+ gtkpack_(Gtk3::VBox->new(0,0),
map {
- my $box = new Gtk2::VBox(0,0);
+ my $box = Gtk3::VBox->new(0,0);
push @box_to_hide, $box;
$box->{vis} = 0;
my @button_to_hide;
- 0, gtksignal_connect(new Gtk2::Button($_), clicked => sub {
+ 0, gtksignal_connect(Gtk3::Button->new($_), clicked => sub {
if ($box->{vis}) { $box->hide; $box->{vis} = 0; $notebook->set_current_page(0) }
else {
$_->hide, $_->{vis}=0 foreach @box_to_hide;
@@ -180,7 +177,7 @@ if (!$::isEmbedded && $in->isa('interactive::gtk')) {
}
}), 1, gtkpack__($box,
map {
- my $button = gtkset_relief(new Gtk2::ToggleButton(), 'none');
+ my $button = gtkset_relief(Gtk3::ToggleButton->new, 'none');
push @button_to_hide, $button;
my $gru = $_->[0];
$notebook->append_page(gtkshow($_->[2]), undef);
@@ -188,12 +185,12 @@ if (!$::isEmbedded && $in->isa('interactive::gtk')) {
my $local_page = $nb_pages;
my $function = sub { $notebook->set_current_page($local_page) };
gtksignal_connect($button, toggled => sub {
- $button->get_active and $function->()
+ $button->get_active and $function->();
});
my $b;
- if ($_->[1] ne "") { $b = gtkcreate_img($_->[1]) } else { $b = () };
+ if ($_->[1] ne "") { $b = gtkcreate_img($_->[1]) } else { undef $b }
gtksignal_connect(gtkadd($button,
- gtkpack__(new Gtk2::VBox(0,3),
+ gtkpack__(Gtk3::VBox->new(0,3),
$b,
translate($gru),
)
@@ -203,18 +200,18 @@ if (!$::isEmbedded && $in->isa('interactive::gtk')) {
$button->set_active(1);
$box->{active_function} = $function;
$function->();
- })
+ });
} @{$tree{$_}}
- )
+ );
} keys(%tree)
)
),
1, $notebook,
),
- 0, new Gtk2::HSeparator,
- 0, gtkadd(gtkset_border_width(gtkset_layout(new Gtk2::HButtonBox, 'end'), 5),
- gtksignal_connect(new Gtk2::Button(N("Accept")), clicked => sub { Gtk2->main_quit }),
- gtksignal_connect(new Gtk2::Button(N("Cancel")), clicked => sub { $o = $o_old; Gtk2->main_quit; quit_global($in, 0) }),
+ 0, Gtk3::HSeparator->new,
+ 0, gtkadd(gtkset_border_width(gtkset_layout(Gtk3::HButtonBox->new, 'end'), 5),
+ gtksignal_connect(Gtk3::Button->new(N("Accept")), clicked => sub { Gtk3->main_quit }),
+ gtksignal_connect(Gtk3::Button->new(N("Cancel")), clicked => sub { $o = $o_old; Gtk3->main_quit; quit_global($in, 0) }),
)
)
);
@@ -222,8 +219,8 @@ if (!$::isEmbedded && $in->isa('interactive::gtk')) {
# $W->{window}->show_all;
# gtkadd($W->{window},
# gtkpack_($W->create_box_with_title(N("Edit variables")),
-# 1, my $notebook = create_notebook( map { $_, h2widget($o->{$_}, "\$o->\{$_\}") } keys %$o ),
-# 0, gtkpack(gtkset_border_width(new Gtk2::HBox(0,0),5), $W->create_okcancel),
+# 1, my $notebook = create_notebook( map { h2widget($o->{$_}, "\$o->\{$_\}"), $_ } keys %$o ),
+# 0, gtkpack(gtkset_border_width(Gtk3::HBox->new(0,0),5), $W->create_okcancel),
# ),
# );
# $notebook->set_tab_pos('left');
@@ -247,7 +244,7 @@ my $str = join('',
$str =~ s/ {8}/\t/g; #- replace all 8 space char by only one tabulation, this reduces file size so much :-)
output($cfgfile, $str);
-fs::umount($mountdir);
+fs::mount::umount($mountdir);
$in->ask_okcancel(N("Congratulations!"),
N("The floppy has been successfully generated.
@@ -273,8 +270,8 @@ sub h2widget {
my @list_keys = keys(%$k);
if (ref($k->{$list_keys[0]}) =~ /HASH/) {
$i++;
- $w = gtkpack_(new Gtk2::VBox(0,0),
- 1, create_scrolled_window(gtkpack__($vb = new Gtk2::VBox(0,10),
+ $w = gtkpack_(Gtk3::VBox->new(0,0),
+ 1, create_scrolled_window(gtkpack__($vb = Gtk3::VBox->new(0,10),
$widget_list[$i] = create_packtable({ col_spacings => 10, row_spacings => 3 },
map {
my $e;
@@ -299,15 +296,15 @@ sub h2widget {
} else {
$w = create_packtable({ col_spacings => 10, row_spacings => 3 },
map { create_entry_element($k->{$_}, "$label\{$_}", $_) } @list_keys
- )
+ );
}
} elsif (ref($k) =~ /ARRAY/) {
my $vb;
my @widget_list;
my $i = -1;
- $w = gtkpack_(new Gtk2::VBox(0,0),
+ $w = gtkpack_(Gtk3::VBox->new(0,0),
1, create_scrolled_window(
- gtkpack__($vb = new Gtk2::VBox(0,5),
+ gtkpack__($vb = Gtk3::VBox->new(0,5),
map { $i++; $widget_list[$i] = h2widget($_, "$label\[$i]") } @$k,
)
),
@@ -335,7 +332,7 @@ sub create_entry_element {
} elsif (ref $text =~ /ARRAY/) {
return [ "$label : ", h2widget($text, $label) ];
} else {
- $e = new Gtk2::Entry;
+ $e = Gtk3::Entry->new;
$e->{value} = $value;
my $_tag = Glib::Timeout->add(1000, sub { $e->set_text($text); 0 });
gtksignal_connect($e, changed => sub {
@@ -344,7 +341,7 @@ sub create_entry_element {
eval $exe;
});
}
- [ $label ? "$label : " : "" , $e ]
+ [ $label ? "$label : " : "" , $e ];
}
sub control_buttons {
@@ -352,22 +349,22 @@ sub control_buttons {
my @widget_list = @$widget_list2;
my $i = $$j;
ref($ref_local_k) =~ /HASH/ or return();
- my (%local_k) = %$ref_local_k;
- my ($button_add, $button_remove);
- 0, gtkadd(gtkset_border_width(gtkset_layout(new Gtk2::HButtonBox, 'spread'), 5),
- gtksignal_connect($button_add = new Gtk2::Button(N("Add an item")), clicked => sub {
+ my %local_k = %$ref_local_k;
+ my ($button_remove);
+ 0, gtkadd(gtkset_border_width(gtkset_layout(Gtk3::HButtonBox->new, 'spread'), 5),
+ gtksignal_connect(Gtk3::Button->new(N("Add an item")), clicked => sub {
$local_k{$_} = undef foreach keys %local_k;
$i++;
$local_gui->($vb, \@widget_list, \%local_k, $i) or $i--, return;
$i >= 0 and $button_remove->set_sensitive(1);
}
),
- gtksignal_connect($button_remove = new Gtk2::Button(N("Remove the last item")), clicked => sub {
+ gtksignal_connect($button_remove = Gtk3::Button->new(N("Remove the last item")), clicked => sub {
$i >= 0 or return;
$widget_list[$i]->destroy;
$i--;
$i >= 0 or $button_remove->set_sensitive(0);
}
)
- )
+ );
}