diff options
Diffstat (limited to 'perl-install/fs/get.pm')
| -rw-r--r-- | perl-install/fs/get.pm | 57 |
1 files changed, 45 insertions, 12 deletions
diff --git a/perl-install/fs/get.pm b/perl-install/fs/get.pm index 02e18fed5..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,28 +11,40 @@ 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) = @_; - hds_fstab_and_holes(hds($all_hds)), @{$all_hds->{raids}}, @{$all_hds->{loopbacks}}; + 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->{dmcrypts}}, @{$all_hds->{loopbacks}}; } sub holes { - my ($all_hds) = @_; - grep { isEmpty($_) } fstab_and_holes($all_hds); + my ($all_hds, $b_non_readonly) = @_; + grep { isEmpty($_) } fstab_and_holes($all_hds, $b_non_readonly); } sub hds_holes { grep { isEmpty($_) } hds_fstab_and_holes(@_); @@ -50,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($_) } @_; } @@ -118,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); @@ -141,9 +167,12 @@ sub is_same_hd { my ($s2) = $hd2->{device} =~ m|https?://(.+?)/*$|; $s1 eq $s2; } else { - $hd1->{devfs_device} && $hd2->{devfs_device} && $hd1->{devfs_device} eq $hd2->{devfs_device} - || $hd1->{device_LABEL} && $hd2->{device_LABEL} && $hd1->{device_LABEL} eq $hd2->{device_LABEL} - || $hd1->{device} && $hd2->{device} && $hd1->{device} eq $hd2->{device}; + $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_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}; } } @@ -152,4 +181,8 @@ sub mntpoint_prefixed { $::prefix . $part->{mntpoint}; } +=back + +=cut + 1; |
