summaryrefslogtreecommitdiffstats
path: root/perl-install/diskdrake
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2007-04-25 12:26:16 +0000
committerPascal Rigaux <pixel@mandriva.com>2007-04-25 12:26:16 +0000
commit126777bc019a54afb4ec51299f2cf9d2841698aa (patch)
tree97f76e571902ead55ba138f1156a4b4f00b9b779 /perl-install/diskdrake
parentf1f67448efc714873378dfeb8279fae68054a90a (diff)
downloaddrakx-126777bc019a54afb4ec51299f2cf9d2841698aa.tar
drakx-126777bc019a54afb4ec51299f2cf9d2841698aa.tar.gz
drakx-126777bc019a54afb4ec51299f2cf9d2841698aa.tar.bz2
drakx-126777bc019a54afb4ec51299f2cf9d2841698aa.tar.xz
drakx-126777bc019a54afb4ec51299f2cf9d2841698aa.zip
re-sync after the big svn loss
Diffstat (limited to 'perl-install/diskdrake')
-rw-r--r--perl-install/diskdrake/dav.pm4
-rw-r--r--perl-install/diskdrake/hd_gtk.pm46
-rw-r--r--perl-install/diskdrake/interactive.pm216
-rw-r--r--perl-install/diskdrake/removable.pm4
-rw-r--r--perl-install/diskdrake/smbnfs_gtk.pm47
5 files changed, 182 insertions, 135 deletions
diff --git a/perl-install/diskdrake/dav.pm b/perl-install/diskdrake/dav.pm
index 1229d5f3f..4950b2bb0 100644
--- a/perl-install/diskdrake/dav.pm
+++ b/perl-install/diskdrake/dav.pm
@@ -9,7 +9,7 @@ sub main {
my ($in, $all_hds) = @_;
my $davs = $all_hds->{davs};
- $in->do_pkgs->ensure_binary_is_installed('davfs', 'mount.davfs') or return;
+ $in->do_pkgs->ensure_binary_is_installed('davfs2', 'mount.davfs2') or return;
my $quit;
do {
@@ -33,7 +33,7 @@ points, select \"New\".")) },
sub create {
my ($in, $all_hds) = @_;
- my $dav = { fs_type => 'davfs' };
+ my $dav = { fs_type => 'davfs2' };
ask_server($in, $dav, $all_hds) or return;
push @{$all_hds->{davs}}, $dav;
config($in, $dav, $all_hds);
diff --git a/perl-install/diskdrake/hd_gtk.pm b/perl-install/diskdrake/hd_gtk.pm
index 85e600607..a54fa6d74 100644
--- a/perl-install/diskdrake/hd_gtk.pm
+++ b/perl-install/diskdrake/hd_gtk.pm
@@ -4,6 +4,7 @@ use diagnostics;
use strict;
use common;
+use mygtk2 qw(gtknew);
use ugtk2 qw(:helpers :wrappers :create);
use partition_table;
use fs::type;
@@ -43,7 +44,7 @@ notebook current_kind[]
=cut
sub main {
- ($in, $all_hds, my $nowizard, $do_force_reload, my $interactive_help) = @_;
+ ($in, $all_hds, $do_force_reload) = @_;
@notebook = ();
@@ -74,7 +75,7 @@ sub main {
$lock = 1;
partition_table::assign_device_numbers($_) foreach fs::get::hds($all_hds);
create_automatic_notebooks($notebook_widget);
- general_action_box($general_action_box, $nowizard, $interactive_help);
+ general_action_box($general_action_box);
per_kind_action_box($per_kind_action_box, $current_kind);
current_kind_changed($in, $current_kind);
current_entry_changed($current_kind, $current_entry);
@@ -89,7 +90,8 @@ sub main {
});
$w->sync;
$done_button->grab_focus;
- $in->ask_okcancel(N("Read carefully!"), N("Please make a backup of your data first"), 1) or return
+ $in->ask_from_list_(N("Read carefully!"), N("Please make a backup of your data first"),
+ [ N_("Exit"), N_("Continue") ], N_("Continue")) eq N_("Continue") or return
if $::isStandalone;
$in->ask_warn('',
N("If you plan to use aboot, be careful to leave a free space (2048 sectors is enough)
@@ -119,7 +121,7 @@ sub try_ {
$current_entry = '' if !diskdrake::interactive::is_part_existing($current_entry, $all_hds);
$update_all->();
- Gtk2->main_quit if $v && member($name, 'Done', 'Wizard');
+ Gtk2->main_quit if $v && member($name, 'Done');
}
################################################################################
@@ -143,13 +145,23 @@ sub add_kind2notebook {
$kind;
}
+sub interactive_help {
+ my ($in) = @_;
+ if ($::isInstall) {
+ $in->interactive_help_sub_display_id('partition_with_diskdrake');
+ } else {
+ require run_program;
+ run_program::raw({ detach => 1 }, 'drakhelp', '--id', 'diskdrake');
+ }
+}
+
sub general_action_box {
- my ($box, $nowizard, $interactive_help) = @_;
+ my ($box) = @_;
$_->destroy foreach $box->get_children;
- gtkadd($box, gtksignal_connect(Gtk2::Button->new(N("Help")), clicked => $interactive_help)) if $interactive_help;
+ gtkadd($box, gtksignal_connect(Gtk2::Button->new(N("Help")), clicked => \&interactive_help));
- my @actions = (if_($::isInstall && !$nowizard, N_("Wizard")),
+ my @actions = (
diskdrake::interactive::general_possible_actions($in, $all_hds),
N_("Done"));
foreach my $s (@actions) {
@@ -202,7 +214,9 @@ sub per_entry_info_box {
} elsif ($kind->{type} =~ /hd|lvm/) {
$info = diskdrake::interactive::format_hd_info($kind->{val});
}
- gtkpack($box, gtkadd(Gtk2::Frame->new(N("Details")), gtkset_justify(Gtk2::Label->new($info), 'left')));
+ gtkpack($box, gtkadd(gtkcreate_frame(N("Details")),
+ gtknew('HBox', border_width => 5, children_loose => [
+ gtkset_alignment(gtkset_justify(Gtk2::Label->new($info), 'left'), 0, 0) ])));
}
sub current_kind_changed {
@@ -274,7 +288,9 @@ sub create_buttons4partitions {
};
foreach my $entry (@parts) {
- my $w = Gtk2::ToggleButton->new_with_label($entry->{mntpoint} || '') or die '';
+ my $info = $entry->{mntpoint};
+ $info .= "\n" . ($entry->{size} ? formatXiB($entry->{size}, 512) : N("Unknown")) if $info;
+ my $w = Gtk2::ToggleButton->new_with_label($info) or internal_error('new_with_label');
$w->signal_connect(clicked => sub {
$current_button != $w or return;
current_entry_changed($kind, $entry);
@@ -354,9 +370,17 @@ sub createOrChangeType {
{ pt_type => 0, start => 1, size => $hd->{totalsectors} - 1 };
$part or return;
if ($fs_type eq 'other') {
- $in->ask_warn('', N("Use ``%s'' instead", isEmpty($part) ? N("Create") : N("Type")));
+ if (isEmpty($part)) {
+ try('Create', $hd, $part);
+ } else {
+ try('Type', $hd, $part);
+ }
} elsif (!$fs_type) {
- $in->ask_warn('', N("Use ``%s'' instead", N("Delete"))) if !isEmpty($part);
+ if (isEmpty($part)) {
+ $in->ask_warn(N("Warning"), N("This partition is already empty"));
+ } else {
+ try('Delete', $hd, $part);
+ }
} elsif (isEmpty($part)) {
fs::type::set_fs_type($part, $fs_type);
diskdrake::interactive::Create($in, $hd, $part, $all_hds);
diff --git a/perl-install/diskdrake/interactive.pm b/perl-install/diskdrake/interactive.pm
index 1f311105e..728cb4543 100644
--- a/perl-install/diskdrake/interactive.pm
+++ b/perl-install/diskdrake/interactive.pm
@@ -34,9 +34,7 @@ struct part {
int part_number # 1 for hda1...
string device # 'hda5', 'sdc1' ...
- string devfs_device # 'ide/host0/bus0/target0/lun0/part5', ...
- string prefer_devfs_name # should the {devfs_device} or the {device} be used in fstab
- string device_LABEL # volume label. LABEL=xxx can be used in fstab instead of
+ string device_LABEL # volume label. LABEL=xxx or /dev/disk/by-label/xxx can be used in fstab instead of the device
bool prefer_device_LABEL # should the {device_LABEL} or the {device} be used in fstab
bool faked_device # false if {device} is a real device, true for nfs/smb/dav/none devices. If the field does not exist, we do not know
@@ -63,7 +61,7 @@ struct part {
loopback loopback[] # loopback living on this partition
# internal
- string real_device # '/dev/loop0', '/dev/loop1' ...
+ string real_device # '/dev/loop0', '/dev/loop1' ... (used for encrypted loopback)
# internal CHS (Cylinder/Head/Sector)
int start_cyl, start_head, start_sec, end_cyl, end_head, end_sec,
@@ -182,7 +180,7 @@ struct all_hds {
sub main {
- my ($in, $all_hds, $_nowizard, $do_force_reload, $_interactive_help) = @_;
+ my ($in, $all_hds, $do_force_reload) = @_;
if ($in->isa('interactive::gtk')) {
require diskdrake::hd_gtk;
@@ -263,17 +261,12 @@ sub Undo {
undo($all_hds);
}
-sub Wizard {
- $::o->{wizard} = 1;
- goto &Done;
-}
-
sub Done {
my ($in, $all_hds) = @_;
eval { raid::verify($all_hds->{raids}) };
if (my $err = $@) {
$::expert or die;
- $in->ask_okcancel('', [ formatError($err), N("Continue anyway?") ]) or return;
+ $in->ask_okcancel(N("Confirmation"), [ formatError($err), N("Continue anyway?") ]) or return;
}
foreach (@{$all_hds->{hds}}) {
if (!write_partitions($in, $_, 'skip_check_rebootNeeded')) {
@@ -283,7 +276,7 @@ sub Done {
}
if (!$::isInstall) {
my $new = fs::fstab_to_string($all_hds);
- if ($new ne $all_hds->{current_fstab} && $in->ask_yesorno('', N("Do you want to save /etc/fstab modifications"), 1)) {
+ if ($new ne $all_hds->{current_fstab} && $in->ask_yesorno(N("Confirmation"), N("Do you want to save /etc/fstab modifications"), 1)) {
$all_hds->{current_fstab} = $new;
fs::write_fstab($all_hds);
}
@@ -295,7 +288,7 @@ sub Done {
}
}
if (my $part = find { $_->{mntpoint} && !maybeFormatted($_) } fs::get::fstab($all_hds)) {
- $in->ask_okcancel('', N("You should format partition %s.
+ $in->ask_okcancel(N("Warning"), N("You should format partition %s.
Otherwise no entry for mount point %s will be written in fstab.
Quit anyway?", $part->{device}, $part->{mntpoint})) or return if $::isStandalone;
}
@@ -364,7 +357,7 @@ sub More {
);
my $r;
- $in->ask_from('', '',
+ $in->ask_from(N("More"), '',
[
{ val => N("Save partition table"), clicked_may_quit => sub { SaveInFile($in, $hd); 1 } },
{ val => N("Restore partition table"), clicked_may_quit => sub { ReadFromFile($in, $hd); 1 } },
@@ -389,14 +382,14 @@ sub ReadFromFile {
} else {
undef $h; #- help perl_checker
my $name = $hd->{device}; $name =~ s!/!_!g;
- ($h, $fh) = install_any::media_browser($in, '', "part_$name") or return;
+ ($h, $fh) = install::any::media_browser($in, '', "part_$name") or return;
}
eval {
catch_cdie { partition_table::load($hd, $file || $fh) }
sub {
$@ =~ /bad totalsectors/ or return;
- $in->ask_yesorno('',
+ $in->ask_yesorno(N("Warning"),
N("The backup partition table has not the same size
Still continue?"), 0);
};
@@ -415,7 +408,7 @@ sub SaveInFile {
} else {
undef $h; #- help perl_checker
my $name = $hd->{device}; $name =~ s!/!_!g;
- ($h, $file) = install_any::media_browser($in, 'save', "part_$name") or return;
+ ($h, $file) = install::any::media_browser($in, 'save', "part_$name") or return;
}
eval { partition_table::save($hd, $file) };
@@ -426,13 +419,13 @@ sub SaveInFile {
sub Rescuept {
my ($in, $hd) = @_;
- my $_w = $in->wait_message('', N("Trying to rescue partition table"));
+ my $_w = $in->wait_message(N("Please wait"), N("Trying to rescue partition table"));
fsedit::rescuept($hd);
}
sub Hd_info {
my ($in, $hd) = @_;
- $in->ask_warn('', [ N("Detailed information"), format_hd_info($hd) ]);
+ $in->ask_warn(N("Warning"), [ N("Detailed information"), format_hd_info($hd) ]);
}
################################################################################
@@ -446,7 +439,7 @@ sub part_possible_actions {
my %actions = my @l = (
N_("Mount point") => '$part->{real_mntpoint} || (!isBusy && !isSwap && !isNonMountable)',
N_("Type") => '!isBusy && $::expert && (!readonly || $part->{pt_type} == 0x83)',
- N_("Options") => '!isNonMountable && $::expert',
+ N_("Options") => '!isSwap($part) && !isNonMountable && $::expert',
N_("Label") => '!isNonMountable && $::expert',
N_("Resize") => '!isBusy && !readonly && !isSpecial || isLVM($hd) && LVM_resizable',
N_("Format") => '!isBusy && !readonly && ($::expert || $::isStandalone)',
@@ -515,11 +508,15 @@ sub Create {
$in->ask_from(N("Create a new partition"), '',
[
+ { label => N("Create a new partition"), title => 1 },
if_($has_startsector,
- { label => N("Start sector: "), val => \$part->{start}, min => $def_start, max => ($max - min_partition_size($hd)), type => 'range' },
+ { label => N("Start sector: "), val => \$part->{start}, min => $def_start, max => ($max - min_partition_size($hd)),
+ type => 'range', SpinButton => $::expert, changed => sub { $mb_size = min($mb_size, ($max - $part->{start}) >> 11) } },
),
- { label => N("Size in MB: "), val => \$mb_size, min => min_partition_size($hd) >> 11, max => $def_size >> 11, type => 'range' },
- { label => N("Filesystem type: "), val => \$type_name, list => [ fs::type::type_names() ], sort => 0 },
+ { label => N("Size in MB: "), val => \$mb_size, min => min_partition_size($hd) >> 11, max => $def_size >> 11,
+ type => 'range', SpinButton => $::expert, changed => sub { $part->{start} = min($part->{start}, $max - ($mb_size << 11)) } },
+ { label => N("Filesystem type: "), val => \$type_name, list => [ fs::type::type_names($::expert) ],
+ sort => 0, if_($::expert, gtk => { wrap_width => 4 }) },
{ label => N("Mount point: "), val => \$part->{mntpoint}, list => [ fsedit::suggestions_mntpoint($all_hds), '' ],
disabled => sub { my $p = fs::type::type_name2subpart($type_name); isSwap($p) || isNonMountable($p) }, type => 'combo', not_edit => 0,
},
@@ -529,17 +526,7 @@ sub Create {
if_($::expert && isLVM($hd),
{ label => N("Logical volume name "), val => \$part->{lv_name}, list => [ qw(root swap usr home var), '' ], sort => 0, not_edit => 0 },
),
- ], changed => sub {
- if ($part->{start} + ($mb_size << 11) > $max) {
- if ($_[0] == 0) {
- # Start sector changed => restricting Size
- $mb_size = ($max - $part->{start}) >> 11;
- } else {
- # Size changed => restricting Start sector
- $part->{start} = $max - ($mb_size << 11);
- }
- }
- }, complete => sub {
+ ], complete => sub {
$part->{size} = from_Mb($mb_size, min_partition_size($hd), $max - $part->{start}); #- need this to be able to get back the approximation of using MB
put_in_hash($part, fs::type::type_name2subpart($type_name));
$do_suggest_mount_point = 0 if !$part->{mntpoint};
@@ -587,7 +574,7 @@ sub Delete {
lvm::lv_delete($hd, $part);
} elsif (isLoopback($part)) {
my $f = "$part->{loopback_device}{mntpoint}$part->{loopback_file}";
- if (-e $f && $in->ask_yesorno('', N("Remove the loopback file?"))) {
+ if (-e $f && $in->ask_yesorno(N("Warning"), N("Remove the loopback file?"))) {
unlink $f;
}
my $l = $part->{loopback_device}{loopback};
@@ -606,28 +593,32 @@ sub Delete {
sub Type {
my ($in, $hd, $part) = @_;
- my $warn = sub { ask_alldatawillbelost($in, $part, N_("After changing type of partition %s, all data on this partition will be lost")) };
+ my $warned;
+ my $warn = sub {
+ $warned = 1;
+ ask_alldatawillbelost($in, $part, N_("After changing type of partition %s, all data on this partition will be lost"));
+ };
#- for ext2, warn after choosing as ext2->ext3 can be achieved without loosing any data :)
- $part->{fs_type} eq 'ext2' or $warn->() or return;
+ $part->{fs_type} eq 'ext2' || $part->{fs_type} =~ /ntfs/ or $warn->() or return;
- my @types = fs::type::type_names();
+ my @types = fs::type::type_names($::expert);
#- when readonly, Type() is allowed only when changing {fs_type} but not {pt_type}
#- eg: switching between ext2, ext3, reiserfs...
@types = grep { fs::type::type_name2pt_type($_) == $part->{pt_type} } @types if $hd->{readonly};
my $type_name = fs::type::part2type_name($part);
- $in->ask_from_({ title => N("Change partition type"),
- messages => N("Which filesystem do you want?"),
- focus_first => 1,
- },
- [ { label => N("Type"), val => \$type_name, list => \@types, sort => 0, not_edit => !$::expert } ]) or return;
+ $in->ask_from_({ title => N("Change partition type") },
+ [
+ { label => N("Which filesystem do you want?"), title => 1 },
+ { label => N("Type"), val => \$type_name, list => \@types, sort => 0,
+ focus => sub { 1 }, not_edit => 1, gtk => { wrap_width => 4 } } ]) or return;
my $type = $type_name && fs::type::type_name2subpart($type_name);
if (member($type->{fs_type}, 'ext2', 'ext3')) {
- my $_w = $in->wait_message('', N("Switching from ext2 to ext3"));
+ my $_w = $in->wait_message(N("Please wait"), N("Switching from ext2 to ext3"));
if (run_program::run("tune2fs", "-j", devices::make($part->{device}))) {
put_in_hash($part, $type);
set_isFormatted($part, 1); #- assume that if tune2fs works, partition is formatted
@@ -636,9 +627,15 @@ sub Type {
fs::format::disable_forced_fsck($part->{device});
return;
}
+ } elsif ($type->{fs_type} =~ /ntfs/ && $part->{fs_type} =~ /ntfs/) {
+ if ($type->{fs_type} eq 'ntfs-3g') {
+ $in->do_pkgs->ensure_binary_is_installed('ntfs-3g', 'mount.ntfs-3g') or return;
+ }
+ put_in_hash($part, $type);
+ return;
}
#- either we switch to non-ext3 or switching losslessly to ext3 failed
- $part->{fs_type} ne 'ext2' or $warn->() or return;
+ $warned or $warn->() or return;
if (defined $type) {
check_type($in, $type, $hd, $part) and fsedit::change_type($type, $hd, $part);
@@ -647,8 +644,11 @@ sub Type {
sub Label {
my ($in, $_hd, $part) = @_;
- $in->ask_from('', N("Which volume label?"),
- [ { val => \$part->{device_LABEL} } ]) or return;
+ $in->ask_from(N("Which volume label?"), '',
+
+ [
+ { label => N("Which volume label?"), title => 1 },
+ { label => N("Label:"), val => \$part->{device_LABEL} } ]) or return;
$part->{prefer_device_LABEL} = to_bool($part->{device_LABEL});
}
@@ -662,13 +662,12 @@ sub Mount_point {
fs::get::has_mntpoint('/', $all_hds) || $part_->{mntpoint} eq '/boot' ? $part_->{mntpoint} : '/';
} else { '' }
};
- $in->ask_from_({ messages =>
- isLoopback($part) ? N("Where do you want to mount the loopback file %s?", $part->{loopback_file}) :
- N("Where do you want to mount device %s?", $part->{device}),
- focus_first => 1,
+ my $msg = isLoopback($part) ? N("Where do you want to mount the loopback file %s?", $part->{loopback_file}) :
+ N("Where do you want to mount device %s?", $part->{device});
+ $in->ask_from_({
callbacks => {
complete => sub {
- !isPartOfLoopback($part) || $mntpoint or $in->ask_warn('',
+ !isPartOfLoopback($part) || $mntpoint or $in->ask_warn(N("Error"),
N("Can not unset mount point as this partition is used for loop back.
Remove the loopback first")), return 1;
$part->{mntpoint} eq $mntpoint || check_mntpoint($in, $mntpoint, $part, $all_hds) or return 1;
@@ -676,8 +675,11 @@ Remove the loopback first")), return 1;
0;
} },
},
- [ { label => N("Mount point"), val => \$mntpoint,
+ [
+ { label => $msg, title => 1 },
+ { label => N("Mount point"), val => \$mntpoint,
list => [ uniq(if_($mntpoint, $mntpoint), fsedit::suggestions_mntpoint($all_hds), '') ],
+ focus => sub { 1 },
not_edit => 0 } ],
) or return;
$part->{mntpoint} = $mntpoint;
@@ -693,9 +695,11 @@ sub Mount_point_raw_hd {
my $mntpoint = $part->{mntpoint} || shift @propositions;
$in->ask_from(
+ N("Mount point"),
'',
- N("Where do you want to mount %s?", $part->{device}),
- [ { label => N("Mount point"), val => \$mntpoint,
+ [
+ { label => N("Where do you want to mount %s?", $part->{device}), title => 1 },
+ { label => N("Mount point"), val => \$mntpoint,
list => [ if_($mntpoint, $mntpoint), '', @propositions ],
not_edit => 0 } ],
complete => sub {
@@ -754,7 +758,7 @@ sub Resize {
#- make sure that even after normalizing the size to cylinder boundaries, the minimun will be saved,
#- this save at least a cylinder (less than 8Mb).
$min += partition_table::raw::cylinder_size($hd);
- $min >= $max and return $in->ask_warn('', N("This partition is not resizeable"));
+ $min >= $max and return $in->ask_warn(N("Warning"), N("This partition is not resizeable"));
#- for these, we have tools to resize partition table
#- without losing data (or at least we hope so :-)
@@ -766,8 +770,12 @@ sub Resize {
}
my $mb_size = $part->{size} >> 11;
- $in->ask_from(N("Resize"), N("Choose the new size"), [
- { label => N("New size in MB: "), val => \$mb_size, min => $min >> 11, max => $max >> 11, type => 'range' },
+ my ($gmin, $gmax) = ($min >> 11, $max >> 11);
+ $in->ask_from(N("Resize"), '', [
+ { label => N("Choose the new size"), title => 1 },
+ { label => N("New size in MB: "), val => \$mb_size, min => $gmin, max => $gmax, type => 'range', SpinButton => $::expert },
+ { label => N("Minimum size: %s MB", $gmin) },
+ { label => N("Maximum size: %s MB", $gmax) },
]) or return;
@@ -797,7 +805,7 @@ sub Resize {
$adjust->(1) or return if $size > $oldsize;
- my $wait = $in->wait_message(N("Resizing"), '');
+ my $wait = $in->wait_message(N("Please wait"), N("Resizing"));
if ($nice_resize{fat}) {
local *log::l = sub { $wait->set(join(' ', @_)) };
@@ -808,14 +816,14 @@ sub Resize {
log::l("ntfs resize to $part->{size} sectors");
$nice_resize{ntfs}->resize($part->{size});
$wait = undef;
- $in->ask_warn('', N("To ensure data integrity after resizing the partition(s),
+ $in->ask_warn(N("Warning"), N("To ensure data integrity after resizing the partition(s),
filesystem checks will be run on your next boot into Microsoft Windows®"));
} elsif ($nice_resize{reiserfs}) {
log::l("reiser resize to $part->{size} sectors");
- run_program::run('resize_reiserfs', '-f', '-q', '-s' . int($part->{size}/2) . 'K', devices::make($part->{device}));
+ run_program::run_or_die('resize_reiserfs', '-f', '-q', '-s' . int($part->{size}/2) . 'K', devices::make($part->{device}));
} elsif ($nice_resize{xfs}) {
#- happens only with mounted LVM, see above
- run_program::run("xfs_growfs", $part->{mntpoint});
+ run_program::run_or_die("xfs_growfs", $part->{mntpoint});
}
if (%nice_resize) {
@@ -841,7 +849,7 @@ sub Mount {
my $w;
fs::mount::part($part, 0, sub {
my ($msg) = @_;
- $w ||= $in->wait_message('', $msg);
+ $w ||= $in->wait_message(N("Please wait"), $msg);
$w->set($msg);
});
}
@@ -849,7 +857,7 @@ sub Add2RAID {
my ($in, $_hd, $part, $all_hds) = @_;
my $raids = $all_hds->{raids};
- my $md_part = $in->ask_from_listf('', N("Choose an existing RAID to add to"),
+ my $md_part = $in->ask_from_listf(N("Add to RAID"), N("Choose an existing RAID to add to"),
sub { ref($_[0]) ? $_[0]{device} : $_[0] },
[ @$raids, N_("new") ]) or return;
@@ -866,13 +874,14 @@ sub Add2LVM {
my $lvms = $all_hds->{lvms};
write_partitions($in, $_) or return foreach isRAID($part) ? @{$all_hds->{hds}} : $hd;
- my $lvm = $in->ask_from_listf_('', N("Choose an existing LVM to add to"),
+ my $lvm = $in->ask_from_listf_(N("Add to LVM"), N("Choose an existing LVM to add to"),
sub { ref($_[0]) ? $_[0]{VG_name} : $_[0] },
[ @$lvms, N_("new") ]) or return;
require lvm;
if (!ref $lvm) {
# create new lvm
- my $name = $in->ask_from_entry('', N("LVM name?")) or return;
+ # FIXME: when mdv2006 is out: remove the question mark from the dialog title
+ my $name = $in->ask_from_entry(N("LVM name?"), N("LVM name?")) or return;
$lvm = new lvm($name);
push @$lvms, $lvm;
}
@@ -900,9 +909,9 @@ sub RemoveFromLVM {
if (@{$lvm->[0]{disks}} > 1) {
my ($used, $_total) = lvm::pv_physical_extents($part);
if ($used) {
- $in->ask_yesorno('', N("Physical volume %s is still in use.
+ $in->ask_yesorno(N("Warning"), N("Physical volume %s is still in use.
Do you want to move used physical extents on this volume to other volumes?", $part->{device})) or return;
- my $_w = $in->wait_message('', N("Moving physical extents"));
+ my $_w = $in->wait_message(N("Please wait"), N("Moving physical extents"));
lvm::pv_move($part);
}
lvm::vg_reduce($lvm->[0], $part);
@@ -920,7 +929,7 @@ sub Loopback {
write_partitions($in, $hd) or return;
- my $handle = any::inspect($real_part) or $in->ask_warn('', N("This partition can not be used for loopback")), return;
+ my $handle = any::inspect($real_part) or $in->ask_warn(N("Error"), N("This partition can not be used for loopback")), return;
my ($min, $max) = (1, fs::loopback::getFree($handle->{dir}, $real_part));
$max = min($max, 1 << (31 - 9)) if $real_part->{fs_type} eq 'vfat'; #- FAT does not handle file size bigger than 2GB
@@ -935,15 +944,15 @@ sub Loopback {
my $mb_size = $part->{size} >> 11;
$in->ask_from(N("Loopback"), '', [
{ label => N("Loopback file name: "), val => \$part->{loopback_file} },
- { label => N("Size in MB: "), val => \$mb_size, min => $min >> 11, max => $max >> 11, type => 'range' },
- { label => N("Filesystem type: "), val => \$type_name, list => [ fs::type::type_names() ], not_edit => !$::expert, sort => 0 },
+ { label => N("Size in MB: "), val => \$mb_size, min => $min >> 11, max => $max >> 11, type => 'range', SpinButton => $::expert },
+ { label => N("Filesystem type: "), val => \$type_name, list => [ fs::type::type_names($::expert) ], not_edit => !$::expert, sort => 0 },
],
complete => sub {
- $part->{loopback_file} or $in->ask_warn('', N("Give a file name")), return 1, 0;
+ $part->{loopback_file} or $in->ask_warn(N("Give a file name"), N("Give a file name")), return 1, 0;
$part->{loopback_file} =~ s|^([^/])|/$1|;
if (my $size = fs::loopback::verifFile($handle->{dir}, $part->{loopback_file}, $real_part)) {
- $size == -1 and $in->ask_warn('', N("File is already used by another loopback, choose another one")), return 1, 0;
- $in->ask_yesorno('', N("File already exists. Use it?")) or return 1, 0;
+ $size == -1 and $in->ask_warn(N("Warning"), N("File is already used by another loopback, choose another one")), return 1, 0;
+ $in->ask_yesorno(N("Warning"), N("File already exists. Use it?")) or return 1, 0;
delete $part->{notFormatted};
$part->{size} = divide($size, 512);
} else {
@@ -965,21 +974,28 @@ sub Options {
my ($options, $unknown) = fs::mount_options::unpack($part);
my %help = fs::mount_options::help();
- my %prev_options = %$options;
+ my %callbacks = (
+ # we don't want both user and users
+ user => sub { $options->{users} = 0; $options->{$_} = $options->{user} foreach @$user_implies },
+ users => sub { $options->{user} = 0; $options->{$_} = $options->{users} foreach @$user_implies },
+ );
+
+
$in->ask_from(N("Mount options"),
'',
[
+ { label => N("Mount options"), title => 1 },
(map {
{ label => $_, text => scalar warp_text(formatAlaTeX($help{$_})), val => \$options->{$_}, hidden => scalar(/password/),
- advanced => !$part->{rootDevice} && !member($_, @simple_options), if_(!/=$/, type => 'bool') };
+ advanced => !$part->{rootDevice} && !member($_, @simple_options), if_(!/=$/, type => 'bool'),
+ if_($callbacks{$_}, changed => $callbacks{$_}),
+ };
} keys %$options),
{ label => N("Various"), val => \$unknown, advanced => 1 },
],
- changed => sub {
- if (my $user = find { $prev_options{$_} != $options->{$_} } 'users', 'user') {
- $options->{$user eq 'user' ? 'users' : 'user'} = 0 if $options->{$user}; # we don't want both user and users
- $options->{$_} = $options->{$user} foreach @$user_implies;
- %prev_options = %$options;
+ complete => sub {
+ if (($options->{usrquota} || $options->{grpquota}) && !$::isInstall) {
+ $in->do_pkgs->ensure_binary_is_installed('quota', 'quotacheck');
}
if ($options->{encrypted}) {
# modify $part->{options} for the check
@@ -1002,8 +1018,7 @@ sub Options {
delete $options->{'encryption='};
delete $part->{encrypt_key};
}
- },
- ) or return;
+ }) or return;
fs::mount_options::pack($part, $options, $unknown);
1;
@@ -1039,10 +1054,10 @@ sub is_part_existing {
sub modifyRAID {
my ($in, $raids, $md_part) = @_;
my $new_device = $md_part->{device};
- $in->ask_from('', '',
+ $in->ask_from(N("Options"), '',
[
{ label => N("device"), val => \$new_device, list => [ $md_part->{device}, raid::free_mds($raids) ], sort => 0 },
-{ label => N("level"), val => \$md_part->{level}, list => [ qw(0 1 4 5 linear) ] },
+{ label => N("level"), val => \$md_part->{level}, list => [ qw(0 1 4 5 6 linear) ] },
{ label => N("chunk size in KiB"), val => \$md_part->{'chunk-size'} },
],
) or return;
@@ -1075,7 +1090,7 @@ sub ask_alldatawillbelost {
sub partitions_suggestions {
my ($in) = @_;
my $t = $::expert ?
- $in->ask_from_list_('', N("What type of partitioning?"), [ keys %fsedit::suggestions ]) :
+ $in->ask_from_list_(N("Type"), N("What type of partitioning?"), [ keys %fsedit::suggestions ]) :
'simple';
$fsedit::suggestions{$t};
}
@@ -1084,10 +1099,10 @@ sub check_type {
my ($in, $type, $hd, $part) = @_;
eval { fs::type::check($type->{fs_type}, $hd, $part) };
if (my $err = $@) {
- $in->ask_warn('', formatError($err));
+ $in->ask_warn(N("Error"), formatError($err));
return;
}
- if ($::isStandalone && $type->{fs_type}) {
+ if ($::isStandalone && $type->{fs_type} && fs::format::known_type($type)) {
fs::format::check_package_is_installed($in->do_pkgs, $type->{fs_type}) or return;
}
1;
@@ -1097,10 +1112,10 @@ sub check_mntpoint {
my $seen;
eval {
catch_cdie { fsedit::check_mntpoint($mntpoint, $part, $all_hds) }
- sub { $seen = 1; $in->ask_okcancel('', formatError($@)) };
+ sub { $seen = 1; $in->ask_okcancel(N("Error"), formatError($@)) };
};
if (my $err = $@) {
- $in->ask_warn('', formatError($err)) if !$seen;
+ $in->ask_warn(N("Error"), formatError($err)) if !$seen;
return;
}
1;
@@ -1149,6 +1164,9 @@ sub format_ {
if ($::isStandalone) {
fs::format::check_package_is_installed($in->do_pkgs, $part->{fs_type}) or return;
}
+ if ($::expert && !member($part->{fs_type}, 'reiserfs', 'xfs')) {
+ $part->{toFormatCheck} = $in->ask_yesorno(N("Confirmation"), N("Check bad blocks?"));
+ }
$part->{isFormatted} = 0; #- force format;
my ($_w, $wait_message) = $in->wait_message_with_progress_bar;
fs::format::part($all_hds, $part, $wait_message);
@@ -1162,7 +1180,11 @@ sub need_migration {
if (@l && $::isStandalone) {
my $choice;
my @choices = (N_("Move files to the new partition"), N_("Hide files"));
- $in->ask_from('', N("Directory %s already contains data\n(%s)", $mntpoint, formatList(5, @l)),
+ $in->ask_from(N("Warning"), N("Directory %s already contains data
+(%s)
+
+You can either choose to move the files into the partition that will be mounted there or leave them where they are (which results in hiding them by the contents of the mounted partition)",
+ $mntpoint, formatList(5, @l)),
[ { val => \$choice, list => \@choices, type => 'list', format => sub { translate($_[0]) } } ]) or return;
$choice eq $choices[0] ? 'migrate' : 'hide';
} else {
@@ -1173,7 +1195,7 @@ sub need_migration {
sub migrate_files {
my ($in, $_hd, $part) = @_;
- my $wait = $in->wait_message('', N("Moving files to the new partition"));
+ my $wait = $in->wait_message(N("Please wait"), N("Moving files to the new partition"));
my $handle = any::inspect($part, '', 'rw');
my @l = glob_("$part->{mntpoint}/*");
foreach (@l) {
@@ -1196,7 +1218,7 @@ sub warn_if_renumbered {
my @l = map {
my ($old, $new) = @$_;
N("partition %s is now known as %s", $old, $new) } @$l;
- $in->ask_warn('', join("\n", N("Partitions have been renumbered: "), @l));
+ $in->ask_warn(N("Warning"), join("\n", N("Partitions have been renumbered: "), @l));
}
#- unit of $mb is mega bytes, min and max are in sectors, this
@@ -1217,7 +1239,6 @@ sub format_part_info {
$info .= N("Mount point: ") . "$part->{mntpoint}\n" if $part->{mntpoint};
$info .= N("Device: ") . "$part->{device}\n" if $part->{device} && !isLoopback($part);
- $info .= N("Devfs name: ") . "$part->{devfs_device}\n" if $part->{devfs_device} && $::expert;
$info .= N("Volume label: ") . "$part->{device_LABEL}\n" if $part->{device_LABEL} && $::expert;
$info .= N("DOS drive letter: %s (just a guess)\n", $part->{device_windobe}) if $part->{device_windobe};
if (arch() eq "ppc") {
@@ -1271,7 +1292,8 @@ sub format_part_info {
sub format_part_info_short {
my ($hd, $part) = @_;
- isEmpty($part) ? format_part_info($hd, $part) : partition_table::description($part);
+ isEmpty($part) ? N("Empty space on %s (%s)", $hd->{device}, formatXiB($part->{size}, 512))
+ : partition_table::description($part);
}
sub format_hd_info {
@@ -1332,8 +1354,8 @@ sub choose_encrypt_key {
messages => N("Choose your filesystem encryption key"),
callbacks => {
complete => sub {
- length $encrypt_key < 6 and $in->ask_warn('', N("This encryption key is too simple (must be at least %d characters long)", 6)), return 1,0;
- $encrypt_key eq $encrypt_key2 or $in->ask_warn('', [ N("The encryption keys do not match"), N("Please try again") ]), return 1,1;
+ length $encrypt_key < 6 and $in->ask_warn(N("Warning"), N("This encryption key is too simple (must be at least %d characters long)", 6)), return 1,0;
+ $encrypt_key eq $encrypt_key2 or $in->ask_warn(N("Error"), [ N("The encryption keys do not match"), N("Please try again") ]), return 1,1;
return 0;
} } }, [
{ label => N("Encryption key"), val => \$encrypt_key, hidden => 1 },
diff --git a/perl-install/diskdrake/removable.pm b/perl-install/diskdrake/removable.pm
index a38671848..a4d225475 100644
--- a/perl-install/diskdrake/removable.pm
+++ b/perl-install/diskdrake/removable.pm
@@ -37,7 +37,7 @@ sub options {
}
sub mount_point {
my ($in, $raw_hd, $all_hds) = @_;
- diskdrake::interactive::Mount_point_raw_hd($in, $raw_hd, $all_hds, "/mnt/$raw_hd->{device}");
+ diskdrake::interactive::Mount_point_raw_hd($in, $raw_hd, $all_hds, "/media/$raw_hd->{device}");
}
sub type {
my ($in, $raw_hd) = @_;
@@ -45,7 +45,7 @@ sub type {
my $fs_type = $raw_hd->{fs_type};
$in->ask_from(N("Change type"),
N("Which filesystem do you want?"),
- [ { label => N("Type"), val => \$fs_type, list => [@fs], not_edit => !$::expert } ]) or return;
+ [ { label => N("Type"), val => \$fs_type, list => [@fs] } ]) or return;
$raw_hd->{fs_type} = $fs_type;
}
diff --git a/perl-install/diskdrake/smbnfs_gtk.pm b/perl-install/diskdrake/smbnfs_gtk.pm
index 81b3581ec..dcb6e6c40 100644
--- a/perl-install/diskdrake/smbnfs_gtk.pm
+++ b/perl-install/diskdrake/smbnfs_gtk.pm
@@ -7,8 +7,9 @@ use fs::get;
use diskdrake::interactive;
use common;
use interactive;
-use network::smb;
-use network::nfs;
+use fs::remote::smb;
+use fs::remote::nfs;
+use mygtk2 qw(gtknew gtkset);
use ugtk2 qw(:helpers :wrappers :create);
my ($all_hds, $in, $tree_model, $current_entry, $current_leaf, %icons);
@@ -59,7 +60,7 @@ sub per_entry_info_box {
my ($box, $kind, $entry) = @_;
my $info = $entry ? diskdrake::interactive::format_raw_hd_info($entry) : '';
$kind->{per_entry_info_box}->destroy if $kind->{per_entry_info_box};
- gtkpack($box, $kind->{per_entry_info_box} = gtkadd(Gtk2::Frame->new(N("Details")), gtkset_justify(Gtk2::Label->new($info), 'left')));
+ gtkpack($box, $kind->{per_entry_info_box} = gtknew('Frame', text => N("Details"), child => gtknew('Label', text => $info, justify => 'left')));
}
sub per_entry_action_box {
@@ -70,7 +71,7 @@ sub per_entry_action_box {
push @buttons, map {
my $s = $_;
- gtksignal_connect(Gtk2::Button->new(translate($s)), clicked => sub { try($kind, $s, {}, $entry) });
+ gtknew('Button', text => translate($s), clicked => sub { try($kind, $s, {}, $entry) });
} (if_($entry->{isMounted}, N_("Unmount")),
if_($entry->{mntpoint} && !$entry->{isMounted}, N_("Mount"))) if $entry;
@@ -82,11 +83,11 @@ sub per_entry_action_box {
);
push @buttons, map {
my ($txt, $f) = @$_;
- $f ? gtksignal_connect(Gtk2::Button->new(translate($txt)), clicked => sub { try_($kind, $txt, $f, $entry) })
- : Gtk2::Label->new("");
+ $f ? gtknew('Button', text => translate($txt), clicked => sub { try_($kind, $txt, $f, $entry) })
+ : gtknew('Label', text => "");
} group_by2(@l);
- gtkadd($box, gtkpack(Gtk2::HBox->new(0,0), @buttons));
+ gtkadd($box, gtknew('HBox', children_loose => [ @buttons]));
}
sub done {
@@ -140,7 +141,7 @@ sub import_tree {
$tree->set_headers_visible(0);
foreach ('default', 'server', 'has_mntpoint', 'mounted') {
- $icons{$_} = gtkcreate_pixbuf("smbnfs_$_");
+ $icons{$_} = gtknew('Pixbuf', file => "smbnfs_$_");
}
my $add_server = sub {
@@ -161,13 +162,13 @@ sub import_tree {
if ($server->{username}) {
$in->ask_warn('', N("Can not login using username %s (bad password?)", $server->{username}));
- network::smb::remove_bad_credentials($server);
+ fs::remote::smb::remove_bad_credentials($server);
} else {
- if (my @l = network::smb::authentications_available($server)) {
+ if (my @l = fs::remote::smb::authentications_available($server)) {
my $user = $in->ask_from_list_(N("Domain Authentication Required"),
N("Which username"), [ @l, N_("Another one") ]) or return;
if ($user ne 'Another one') {
- network::smb::read_credentials($server, $user);
+ fs::remote::smb::read_credentials($server, $user);
goto $find_exports;
}
}
@@ -202,12 +203,12 @@ sub import_tree {
};
{
- my $search = Gtk2::Button->new(N("Search servers"));
+ my $search = gtknew('Button', text => N("Search servers"));
gtkpack__($info_box,
gtksignal_connect($search,
clicked => sub {
$add_server->($_) foreach sort { $a->{name} cmp $b->{name} } $kind->find_servers;
- $search->set_label(N("Search new servers"));
+ gtkset($search, text => N("Search new servers"));
}));
}
@@ -241,16 +242,16 @@ sub add_smbnfs {
my ($widget, $kind) = @_;
die if $kind->{main_box};
- $kind->{info_box} = Gtk2::VBox->new(0,0);
- $kind->{display_box} = create_scrolled_window(import_tree($kind, $kind->{info_box}));
- $kind->{action_box} = Gtk2::HBox->new(0,0);
+ $kind->{info_box} = gtknew('VBox');
+ $kind->{display_box} = gtknew('ScrolledWindow', child => import_tree($kind, $kind->{info_box}));
+ $kind->{action_box} = gtknew('HBox');
$kind->{main_box} =
- gtkpack_(Gtk2::VBox->new(0,7),
- 1, gtkpack(Gtk2::HBox->new(0,7),
- gtkset_size_request($kind->{display_box}, 200, 0),
- $kind->{info_box}),
+ gtknew('VBox', spacing => 7, children => [
+ 1, gtknew('HBox', spacing => 7, children_loose => [
+ gtkset($kind->{display_box}, width => 200),
+ $kind->{info_box}]),
0, $kind->{action_box},
- );
+ ]);
$widget->add($kind->{main_box});
$current_entry = undef;
@@ -259,11 +260,11 @@ sub add_smbnfs {
}
sub nfs2kind() {
- network::nfs->new({ type => 'nfs', name => 'NFS', val => $all_hds->{nfss}, no_auto => 1 });
+ fs::remote::nfs->new({ type => 'nfs', name => 'NFS', val => $all_hds->{nfss}, no_auto => 1 });
}
sub smb2kind() {
- network::smb->new({ type => 'smb', name => 'Samba', val => $all_hds->{smbs}, no_auto => 1 });
+ fs::remote::smb->new({ type => 'smb', name => 'Samba', val => $all_hds->{smbs}, no_auto => 1 });
}