summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2004-01-06 16:03:58 +0000
committerPascal Rigaux <pixel@mandriva.com>2004-01-06 16:03:58 +0000
commit960dd8c2fc966b1bc0488221a4b14077bb8b6ad4 (patch)
treef6e2c227ff01607d8876fee3af46e3997019d318
parent7b806235678dbc76e3976bb8fd9cb0a1521fa250 (diff)
downloaddrakx-backup-do-not-use-960dd8c2fc966b1bc0488221a4b14077bb8b6ad4.tar
drakx-backup-do-not-use-960dd8c2fc966b1bc0488221a4b14077bb8b6ad4.tar.gz
drakx-backup-do-not-use-960dd8c2fc966b1bc0488221a4b14077bb8b6ad4.tar.bz2
drakx-backup-do-not-use-960dd8c2fc966b1bc0488221a4b14077bb8b6ad4.tar.xz
drakx-backup-do-not-use-960dd8c2fc966b1bc0488221a4b14077bb8b6ad4.zip
basic lvm2 support (not tested yet!)
-rw-r--r--perl-install/install_any.pm4
-rw-r--r--perl-install/install_steps.pm2
-rw-r--r--perl-install/lvm.pm44
-rw-r--r--perl-install/share/list16
-rw-r--r--perl-install/share/rpmsrate2
5 files changed, 27 insertions, 41 deletions
diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm
index be4b7d406..423cf14f1 100644
--- a/perl-install/install_any.pm
+++ b/perl-install/install_any.pm
@@ -329,7 +329,7 @@ sub setDefaultPackages {
push @{$o->{default_packages}}, "numlock" if $o->{miscellaneous}{numlock};
push @{$o->{default_packages}}, "kernel22" if !$::oem && c::kernel_version() =~ /^\Q2.2/;
push @{$o->{default_packages}}, "raidtools" if !is_empty_array_ref($o->{all_hds}{raids});
- push @{$o->{default_packages}}, "lvm" if !is_empty_array_ref($o->{all_hds}{lvms});
+ push @{$o->{default_packages}}, "lvm2" if !is_empty_array_ref($o->{all_hds}{lvms});
# BUG: if first snd card is managed by OSS and the second one by alsa, we do not install alsa-utils:
push @{$o->{default_packages}}, "alsa", "alsa-utils" if modules::get_alias("sound-slot-0") =~ /^snd-/;
push @{$o->{default_packages}}, "grub" if isLoopback(fsedit::get_root($o->{fstab}));
@@ -1104,7 +1104,7 @@ sub remove_bigseldom_used() {
unlink glob_("/usr/share/gtk/themes/$_*") foreach qw(marble3d);
unlink(m|^/| ? $_ : "/usr/bin/$_") foreach
(map { @$_ } @bigseldom_used_groups),
- qw(pvcreate pvdisplay vgchange vgcreate vgdisplay vgextend vgremove vgscan lvcreate lvdisplay lvremove /lib/liblvm.so),
+ qw(lvm2),
qw(mkreiserfs resize_reiserfs mkfs.xfs fsck.jfs);
}
diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm
index 00184f3fc..a35543864 100644
--- a/perl-install/install_steps.pm
+++ b/perl-install/install_steps.pm
@@ -426,7 +426,7 @@ Consoles 1,3,4,7 may also contain interesting information";
}
#- generate /etc/lvmtab needed for rc.sysinit
- run_program::rooted($o->{prefix}, 'vgscan') if -e '/etc/lvmtab';
+ run_program::rooted($o->{prefix}, 'lvm2', 'vgscan') if -e '/etc/lvmtab';
#- configure PCMCIA services if needed.
modules::write_pcmcia($o->{prefix}, $o->{pcmcia});
diff --git a/perl-install/lvm.pm b/perl-install/lvm.pm
index 00cf7a27b..716880517 100644
--- a/perl-install/lvm.pm
+++ b/perl-install/lvm.pm
@@ -31,25 +31,25 @@ sub cylinder_size {
init();
sub init() {
- eval { modules::load('lvm-mod') };
- run_program::run('vgscan') if !-e '/etc/lvmtab';
- run_program::run('vgchange', '-a', 'y');
+ eval { modules::load('dm-mod') };
+ run_program::run('lvm2', 'vgscan') if !-e '/etc/lvmtab';
+ run_program::run('lvm2', 'vgchange', '-a', 'y');
}
-sub run {
- if (my $r = run_program::run(@_)) {
+sub lvm_cmd {
+ if (my $r = run_program::run('lvm2', @_)) {
$r;
} else {
$? >> 8 == 98 or return;
#- sometimes, it needs running vgscan again, doing so:
- run_program::run('vgscan');
- run_program::run(@_);
+ run_program::run('lvm2', 'vgscan');
+ run_program::run('lvm2', @_);
}
}
-sub run_or_die {
+sub lvm_cmd_or_die {
my ($prog, @para) = @_;
- run($prog, @para) or die "$prog failed\n";
+ lvm_cmd($prog, @para) or die "$prog failed\n";
}
sub check {
@@ -65,24 +65,24 @@ sub check {
sub get_vg {
my ($part) = @_;
my $dev = expand_symlinks(devices::make($part->{device}));
- (split(':', run_program::get_stdout('pvdisplay', '-c', $dev)))[1];
+ (split(':', run_program::get_stdout('lvm2', 'pvdisplay', '-c', $dev)))[1];
}
sub update_size {
my ($lvm) = @_;
- my @l = split(':', run_program::get_stdout('vgdisplay', '-c', '-D', $lvm->{VG_name}));
+ my @l = split(':', run_program::get_stdout('lvm2', 'vgdisplay', '-c', '-D', $lvm->{VG_name}));
$lvm->{totalsectors} = ($lvm->{PE_size} = $l[12]) * $l[13];
}
sub get_lv_size {
my ($lvm_device) = @_;
- my $info = run_program::get_stdout('lvdisplay', '-D', '-c', "/dev/$lvm_device");
+ my $info = run_program::get_stdout('lvm2', 'lvdisplay', '-D', '-c', "/dev/$lvm_device");
(split(':', $info))[6];
}
sub get_lvs {
my ($lvm) = @_;
- my @l = run_program::get_stdout('vgdisplay', '-v', '-D', $lvm->{VG_name});
+ my @l = run_program::get_stdout('lvm2', 'vgdisplay', '-v', '-D', $lvm->{VG_name});
$lvm->{primary}{normal} =
[
map {
@@ -98,17 +98,17 @@ sub get_lvs {
sub vg_add {
my ($part) = @_;
my $dev = expand_symlinks(devices::make($part->{device}));
- run_or_die('pvcreate', '-y', '-ff', $dev);
- my $prog = run('vgdisplay', $part->{lvm}) ? 'vgextend' : 'vgcreate';
- run_or_die($prog, $part->{lvm}, $dev);
+ lvm_cmd_or_die('pvcreate', '-y', '-ff', $dev);
+ my $prog = lvm_cmd('vgdisplay', $part->{lvm}) ? 'vgextend' : 'vgcreate';
+ lvm_cmd_or_die($prog, $part->{lvm}, $dev);
}
sub vg_destroy {
my ($lvm) = @_;
is_empty_array_ref($lvm->{primary}{normal}) or die \N("Remove the logical volumes first\n");
- run('vgchange', '-a', 'n', $lvm->{VG_name});
- run_or_die('vgremove', $lvm->{VG_name});
+ lvm_cmd('vgchange', '-a', 'n', $lvm->{VG_name});
+ lvm_cmd_or_die('vgremove', $lvm->{VG_name});
foreach (@{$lvm->{disks}}) {
delete $_->{lvm};
$_->{isFormatted} = 0;
@@ -119,7 +119,7 @@ sub vg_destroy {
sub lv_delete {
my ($lvm, $lv) = @_;
- run_or_die('lvremove', '-f', "/dev/$lv->{device}");
+ lvm_cmd_or_die('lvremove', '-f', "/dev/$lv->{device}");
my $list = $lvm->{primary}{normal};
@$list = grep { $_ != $lv } @$list;
@@ -130,7 +130,7 @@ sub lv_create {
my $list = $lvm->{primary}{normal} ||= [];
$lv->{lv_name} ||= 1 + max(map { if_($_->{device} =~ /(\d+)$/, $1) } @$list);
$lv->{device} = "$lvm->{VG_name}/$lv->{lv_name}";
- run_or_die('lvcreate', '--size', int($lv->{size} / 2) . 'k', '-n', $lv->{lv_name}, $lvm->{VG_name});
+ lvm_cmd_or_die('lvcreate', '--size', int($lv->{size} / 2) . 'k', '-n', $lv->{lv_name}, $lvm->{VG_name});
$lv->{size} = get_lv_size($lv->{device}); #- the created size is smaller than asked size
$lv->{notFormatted} = 1;
$lv->{isFormatted} = 0;
@@ -139,8 +139,8 @@ sub lv_create {
sub lv_resize {
my ($lv, $oldsize) = @_;
- run_or_die($oldsize > $lv->{size} ? ('lvreduce', '-f') : 'lvextend',
- '--size', int($lv->{size} / 2) . 'k', "/dev/$lv->{device}");
+ lvm_cmd_or_die($oldsize > $lv->{size} ? ('lvreduce', '-f') : 'lvextend',
+ '--size', int($lv->{size} / 2) . 'k', "/dev/$lv->{device}");
$lv->{size} = get_lv_size($lv->{device}); #- the resized partition may not be the exact asked size
}
diff --git a/perl-install/share/list b/perl-install/share/list
index 50c081ced..c01170a88 100644
--- a/perl-install/share/list
+++ b/perl-install/share/list
@@ -15,6 +15,7 @@
/sbin/fdisk
/sbin/insmod
/sbin/losetup
+/sbin/lvm2
/sbin/mke2fs
/sbin/mkswap
/sbin/modinfo
@@ -159,21 +160,6 @@
/usr/share/ldetect-lst/isdn.db
/usr/share/ldetect-lst/pcitable
/usr/share/ldetect-lst/usbtable
-
-/sbin/pvcreate
-/sbin/pvdisplay
-/sbin/vgchange
-/sbin/vgcreate
-/sbin/vgdisplay
-/sbin/vgextend
-/sbin/vgremove
-/sbin/vgscan
-/sbin/lvcreate
-/sbin/lvdisplay
-/sbin/lvextend
-/sbin/lvreduce
-/sbin/lvremove
-
/bin/brltty
/etc/brltty/text.*.tbl
/etc/brltty/brltty-??.hlp
diff --git a/perl-install/share/rpmsrate b/perl-install/share/rpmsrate
index 930dcd181..a15478b63 100644
--- a/perl-install/share/rpmsrate
+++ b/perl-install/share/rpmsrate
@@ -631,7 +631,7 @@ EMULATORS
INSTALL
NOCOPY
5 kernel-2.4.22.6mdk kernel-2.4.22.7mdk kernel-2.4.22.7mdk kernel kernel-smp-2.4.22.6mdk kernel-smp-2.4.22.7mdk kernel-smp-2.4.22.7mdk kernel-smp kernel-enterprise-2.4.22.6mdk kernel-enterprise-2.4.22.7mdk kernel-enterprise-2.4.22.7mdk kernel-enterprise
- raidtools lvm reiserfsprogs jfsprogs xfsprogs
+ raidtools lvm2 reiserfsprogs jfsprogs xfsprogs
alsa-utils
4 XFree86 brltty