summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorThierry Vignaud <tvignaud@mandriva.org>2003-07-10 17:40:31 +0000
committerThierry Vignaud <tvignaud@mandriva.org>2003-07-10 17:40:31 +0000
commit6e2a02e0f2548d42f466109b3388ba709ad416d5 (patch)
tree7964cb1d3ce627b858a0e0e1c7aef6cff0d671fe /perl-install
parent21aa3d6311b76697f6014ef47ddc31c10497107c (diff)
downloaddrakx-6e2a02e0f2548d42f466109b3388ba709ad416d5.tar
drakx-6e2a02e0f2548d42f466109b3388ba709ad416d5.tar.gz
drakx-6e2a02e0f2548d42f466109b3388ba709ad416d5.tar.bz2
drakx-6e2a02e0f2548d42f466109b3388ba709ad416d5.tar.xz
drakx-6e2a02e0f2548d42f466109b3388ba709ad416d5.zip
output buffer should not be editable
Diffstat (limited to 'perl-install')
-rwxr-xr-xperl-install/standalone/drakfloppy3
1 files changed, 2 insertions, 1 deletions
diff --git a/perl-install/standalone/drakfloppy b/perl-install/standalone/drakfloppy
index 4f128d746..e68241cc3 100755
--- a/perl-install/standalone/drakfloppy
+++ b/perl-install/standalone/drakfloppy
@@ -167,7 +167,7 @@ $window->{window}->add(
Gtk2::HBox->new(0, 0),
5),
30, 75),
- 1, $output = Gtk2::TextView->new,
+ 1, $output = gtkset_editable(Gtk2::TextView->new, 0),
),
),
0, gtkpack__(new Gtk2::HBox(0, 0),
@@ -246,6 +246,7 @@ sub expand_tree {
my ($tree, $parent_iter, $path) = @_;
my $dir = $tree_model->get($parent_iter, 1);
my $child = $tree_model->iter_children($parent_iter);
+ print "($tree, $parent_iter, $path, $dir, $child)\n";
return if !$child;
#- hackish: if first child has '' as name, then we need to expand on the fly
='#n189'>189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 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
package raid; # $Id$

use diagnostics;
use strict;

#-######################################################################################
#- misc imports
#-######################################################################################
use common;
use fs::type;
use fs::get;
use run_program;
use devices;
use modules;

sub max_nb() { 31 }

sub check_prog {
    my ($in) = @_;
    $::isInstall || $in->do_pkgs->ensure_binary_is_installed('mdadm', 'mdadm');
}

sub new {
    my ($raids, %opts) = @_;
    my $md_part = { %opts };
    add2hash_($md_part, { 'chunk-size' => '64', disks => [], 
			  fs_type => 'ext3',
			  device => first(free_mds($raids)), 
			  notFormatted => 1, level => 1 });
    push @$raids, $md_part;
    foreach (@{$md_part->{disks}}) {
	$_->{raid} = $md_part->{device};
	fs::type::set_pt_type($_, 0xfd);
	delete $_->{mntpoint};
    }
    update($md_part);
    $md_part;
}

sub add {
    my ($md_part, $part) = @_;
    $md_part->{isMounted} and die N("Can not add a partition to _formatted_ RAID %s", $md_part->{device});
    inactivate_and_dirty($md_part);
    set_isFormatted($part, 0);
    $part->{raid} = $md_part->{device};
    delete $part->{mntpoint};
    push @{$md_part->{disks}}, $part;
    update($md_part);
}

sub delete {
    my ($raids, $md_part) = @_;
    inactivate_and_dirty($md_part);
    delete $_->{raid} foreach @{$md_part->{disks}};
    @$raids = grep { $_ != $md_part } @$raids;
    write_conf($raids) if $::isStandalone;
}

sub change_device {
    my ($md_part, $new_device) = @_;
    if ($new_device ne $md_part->{device}) {
	inactivate_and_dirty($md_part);
	$md_part->{device} = $new_device;
	$_->{raid} = $new_device foreach @{$md_part->{disks}};
    }
}

sub removeDisk {
    my ($raids, $part) = @_;
    my $md_part = fs::get::device2part($part->{raid}, $raids);
    inactivate_and_dirty($md_part);
    fs::type::set_isFormatted($part, 0);
    delete $part->{raid};
    my $disks = $md_part->{disks};
    @$disks = grep { $_ != $part } @$disks;
    if (@$disks) {
	update($md_part);
    } else {
	@$raids = grep { $_ != $md_part } @$raids;
    }
    write_conf($raids) if $::isStandalone;
}

sub updateSize {
    my ($part) = @_;
    local $_ = $part->{level};
    my @l = map { $_->{size} } @{$part->{disks}};

    $part->{size} = do {
	if (/0|linear/) { sum @l }
	elsif (/1/)     { min @l }
	elsif (/4|5/)   { min(@l) * (@l - 1) }
	elsif (/6/)     { min(@l) * (@l - 2) }
    };
}

sub module {
    my ($part) = @_;
    my $level = $part->{level};
    log::l("level $level");

    if (member($level, 4, 5, 6)) {
	'raid456';
    } elsif ($level =~ /^\d+$/) {
	"raid$level";
    } else {
	$level;
    }
}


sub update {
    updateSize($_) foreach @_;
}

sub make {
    my ($raids, $part) = @_;    

    return if is_active($part->{device});

    inactivate_and_dirty($part);

    isRAID($_) and make($raids, $_) foreach @{$part->{disks}};
    eval { modules::load(module($part)) };

    whereis_binary('mdadm') or die 'mdadm not installed';

    my $dev = devices::make($part->{device});
    my $nb = @{$part->{disks}};

    run_program::run_or_die('mdadm', '--create', '--run', $dev,