diff options
Diffstat (limited to 'perl-install/fs/get.pm')
| -rw-r--r-- | perl-install/fs/get.pm | 46 |
1 files changed, 39 insertions, 7 deletions
diff --git a/perl-install/fs/get.pm b/perl-install/fs/get.pm index aa23d1c61..00c807738 100644 --- a/perl-install/fs/get.pm +++ b/perl-install/fs/get.pm @@ -1,4 +1,4 @@ -package fs::get; # $Id$ +package fs::get; use diagnostics; use strict; @@ -11,24 +11,35 @@ use fs; use common; use log; + +=head1 SYNOPSYS + +B<fs::get> + +=head1 Functions + +=over + +=cut + sub empty_all_hds() { - { hds => [], lvms => [], raids => [], loopbacks => [], raw_hds => [], nfss => [], smbs => [], davs => [], special => [] }; + { hds => [], lvms => [], raids => [], dmcrypts => [], loopbacks => [], raw_hds => [], nfss => [], smbs => [], davs => [], special => [] }; } sub fstab { my ($all_hds) = @_; my @parts = map { partition_table::get_normal_parts($_) } hds($all_hds); - @parts, @{$all_hds->{raids}}, @{$all_hds->{loopbacks}}; + @parts, @{$all_hds->{raids}}, @{$all_hds->{dmcrypts}}, @{$all_hds->{loopbacks}}; } sub really_all_fstab { my ($all_hds) = @_; my @l = fstab($all_hds); - @l, @{$all_hds->{raw_hds}}, @{$all_hds->{nfss}}, @{$all_hds->{smbs}}, @{$all_hds->{davs}}; + @l, (grep { !$_->{is_removable} } @{$all_hds->{raw_hds}}), @{$all_hds->{nfss}}, @{$all_hds->{smbs}}, @{$all_hds->{davs}}; } sub fstab_and_holes { my ($all_hds, $b_non_readonly) = @_; my @hds = grep { !($b_non_readonly && $_->{readonly}) } hds($all_hds); - hds_fstab_and_holes(@hds), @{$all_hds->{raids}}, @{$all_hds->{loopbacks}}; + hds_fstab_and_holes(@hds), @{$all_hds->{raids}}, @{$all_hds->{dmcrypts}}, @{$all_hds->{loopbacks}}; } sub holes { @@ -51,7 +62,12 @@ sub hds { (@{$all_hds->{hds}}, @{$all_hds->{lvms}}); } -#- get all normal partition including special ones as found on sparc. +=item hds_fstab(@hds) + +Get all normal partition. + +=cut + sub hds_fstab { map { partition_table::get_normal_parts($_) } @_; } @@ -119,6 +135,15 @@ sub has_mntpoint { my ($mntpoint, $all_hds) = @_; mntpoint2part($mntpoint, [ really_all_fstab($all_hds) ]); } + +sub root_from_mounted() { + foreach (`df -P`) { + next if m!^[^/]!; # ignore tootfs + my ($fs, undef, undef, undef, undef, $mntpnt) = split(/\s+/); + return $fs if $mntpnt eq '/'; + } +} + sub root_ { my ($fstab, $o_boot) = @_; $o_boot && mntpoint2part("/boot", $fstab) || mntpoint2part("/", $fstab); @@ -144,7 +169,10 @@ sub is_same_hd { } else { $hd1->{device_LABEL} && $hd2->{device_LABEL} && $hd1->{device_LABEL} eq $hd2->{device_LABEL} || $hd1->{device_UUID} && $hd2->{device_UUID} && $hd1->{device_UUID} eq $hd2->{device_UUID} - || $hd1->{device} && $hd2->{device} && $hd1->{device} eq $hd2->{device}; + || $hd1->{device} && $hd2->{device} && $hd1->{device} eq $hd2->{device} + || $hd1->{device} && $hd2->{device_alias} && $hd1->{device} eq $hd2->{device_alias} + || $hd1->{device_alias} && $hd2->{device} && $hd1->{device_alias} eq $hd2->{device} + || $hd1->{device_alias} && $hd2->{device_alias} && $hd1->{device_alias} eq $hd2->{device_alias}; } } @@ -153,4 +181,8 @@ sub mntpoint_prefixed { $::prefix . $part->{mntpoint}; } +=back + +=cut + 1; |
