summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2004-06-15 15:24:50 +0000
committerPascal Rigaux <pixel@mandriva.com>2004-06-15 15:24:50 +0000
commitffb1cd20b1e8d389b9136ca513eeb4b479e1bc28 (patch)
tree5df5a16d63b2ade8d91d6bfa38d37f4c4ada816b /perl-install
parent67138a37ec97ac4b1cdd8e3696dfb3f35c532146 (diff)
downloaddrakx-backup-do-not-use-ffb1cd20b1e8d389b9136ca513eeb4b479e1bc28.tar
drakx-backup-do-not-use-ffb1cd20b1e8d389b9136ca513eeb4b479e1bc28.tar.gz
drakx-backup-do-not-use-ffb1cd20b1e8d389b9136ca513eeb4b479e1bc28.tar.bz2
drakx-backup-do-not-use-ffb1cd20b1e8d389b9136ca513eeb4b479e1bc28.tar.xz
drakx-backup-do-not-use-ffb1cd20b1e8d389b9136ca513eeb4b479e1bc28.zip
- new function subpart_from_wild_device_name()
- use it
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/fs.pm58
1 files changed, 38 insertions, 20 deletions
diff --git a/perl-install/fs.pm b/perl-install/fs.pm
index b389d2984..0219aaaa6 100644
--- a/perl-install/fs.pm
+++ b/perl-install/fs.pm
@@ -75,27 +75,12 @@ sub read_fstab {
if_(member('keep_freq_passno', @reading_options), freq => $freq, passno => $passno),
};
- if ($dev =~ /^LABEL=(.*)/) {
- $h->{device_LABEL} = $1;
- $h->{prefer_device_LABEL} = 1 if member('keep_device_LABEL', @reading_options);
- }
- if ($dev =~ m,^/(tmp|dev)/,) {
- ($h->{major}, $h->{minor}) = unmakedev((stat "$prefix$dev")[6]);
+ put_in_hash($h, subpart_from_wild_device_name($dev));
- my $symlink = readlink("$prefix$dev");
- $dev =~ s,^/(tmp|dev)/,,;
-
- if ($symlink =~ m|^[^/]+$|) {
- $h->{device_alias} = $dev;
- $h->{device} = $symlink;
- } else {
- $h->{device} = $dev;
- }
-
- if ($h->{device} =~ m!/(disc|part\d+)$!) {
- $h->{devfs_device} = $h->{device};
- $h->{prefer_devfs_name} = 1 if member('keep_devfs_name', @reading_options);
- }
+ if ($h->{device_LABEL} && member('keep_device_LABEL', @reading_options)) {
+ $h->{prefer_device_LABEL} = 1;
+ } elsif ($h->{devfs_device} && member('keep_devfs_name', @reading_options)) {
+ $h->{prefer_devfs_name} = 1;
}
if ($h->{options} =~ /credentials=/ && !member('verbatim_credentials', @reading_options)) {
@@ -139,6 +124,39 @@ sub merge_fstabs {
@l;
}
+sub subpart_from_wild_device_name {
+ my ($dev) = @_;
+
+ if ($dev =~ /^LABEL=(.*)/) {
+ { device_LABEL => $1 };
+ } elsif ($dev =~ m,^/(tmp|dev)/,) {
+ my %part;
+ ($part{major}, $part{minor}) = unmakedev((stat "$::prefix$dev")[6]);
+
+ if (my $symlink = readlink("$::prefix$dev")) {
+ if ($symlink =~ m|^[^/]+$|) {
+ $part{device_alias} = $dev;
+ $dev = $symlink;
+ }
+ }
+ $dev =~ s,^/(tmp|dev)/,,;
+
+ my $is_devfs = $dev =~ m!/(disc|part\d+)$!;
+ $part{$is_devfs ? 'devfs_device' : 'device'} = $dev;
+ \%part;
+ } else {
+ if ($dev eq 'none') {
+ } elsif ($dev =~ m!^(\w+):/\w!) {
+ #- nfs
+ } elsif ($dev =~ m!^//\w!) {
+ #- smb
+ } else {
+ log::l("part_from_wild_device_name: unknown device $dev");
+ }
+ { device => $dev };
+ }
+}
+
sub add2all_hds {
my ($all_hds, @l) = @_;