summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2001-08-18 17:30:02 +0000
committerPascal Rigaux <pixel@mandriva.com>2001-08-18 17:30:02 +0000
commit623eb752368c94f95a12ac2ee791177da62d78be (patch)
treee316c253ac05e58de964eaf37b2095420bfca3dd
parent3dac3f7fef033ef37c4c476c10b9cf8a97d12ef2 (diff)
downloaddrakx-623eb752368c94f95a12ac2ee791177da62d78be.tar
drakx-623eb752368c94f95a12ac2ee791177da62d78be.tar.gz
drakx-623eb752368c94f95a12ac2ee791177da62d78be.tar.bz2
drakx-623eb752368c94f95a12ac2ee791177da62d78be.tar.xz
drakx-623eb752368c94f95a12ac2ee791177da62d78be.zip
cleanup mounting options parsing
-rw-r--r--perl-install/fs.pm60
1 files changed, 56 insertions, 4 deletions
diff --git a/perl-install/fs.pm b/perl-install/fs.pm
index 8f7099044..1ab5695a8 100644
--- a/perl-install/fs.pm
+++ b/perl-install/fs.pm
@@ -74,14 +74,66 @@ sub mount_options {
sync => 'async', noatime => 'atime', noauto => 'auto', ro => 'rw',
user => 'nouser', nodev => 'dev', noexec => 'exec', nosuid => 'suid',
);
+ my @user_implies = qw(noexec nodev nosuid);
+ \%non_defaults, \@user_implies;
+}
+
+sub mount_options_unpack {
+ my ($packed_options, $part) = @_;
+
+ my ($non_defaults, $user_implies) = mount_options();
+
+ my @auto_fs = auto_fs();
my %per_fs = (
iso9660 => [ qw(unhide) ],
vfat => [ qw(umask=0) ],
nfs => [ 'rsize=8192,wsize=8192' ],
);
- my @user_implies = qw(noexec nodev nosuid);
- my @options = keys %non_defaults;
- my %help = map { $_ => '' } (@options, map { @$_ } values %per_fs);
+ while (my ($fs, $l) = each %per_fs) {
+ isThisFs($fs, $part) || $part->{type} eq 'auto' && member($fs, @auto_fs) or next;
+ $non_defaults->{$_} = 1 foreach @$l;
+ }
+
+ my $defaults = { reverse %$non_defaults };
+ my %options = map { $_ => 0 } keys %$non_defaults;
+ my @unknown;
+ foreach (split(",", $packed_options)) {
+ if ($_ eq 'user') {
+ $options{$_} = 1 foreach ('user', @$user_implies);
+ } elsif (exists $non_defaults->{$_}) {
+ $options{$_} = 1;
+ } elsif ($defaults->{$_}) {
+ $options{$defaults->{$_}} = 0;
+ } else {
+ push @unknown, $_;
+ }
+ }
+ my $unknown = join(",", @unknown);
+ \%options, $unknown;
+}
+
+sub mount_options_pack {
+ my ($options, $unknown) = @_;
+
+ my ($non_defaults, $user_implies) = mount_options();
+ my @l;
+ if (delete $options->{user}) {
+ push @l, 'user';
+ foreach (@$user_implies) {
+ if (!delete $options->{$_}) {
+ # overriding
+ $options->{$non_defaults->{$_}} = 1;
+ }
+ }
+ }
+ push @l, grep { $options->{$_} } keys %$options;
+ push @l, $unknown;
+
+ join(",", @l);
+}
+
+sub mount_options_help {
+ my %help = map { $_ => '' } @_;
my %short = map { /(.*?)=/ ? ("$1=" => $_) : () } keys %help;
foreach (split(':', $ENV{LANGUAGE}), '') {
@@ -108,7 +160,7 @@ sub mount_options {
}
}
}
- \%help, \%non_defaults, \%per_fs, \@user_implies;
+ %help;
}
sub get_mntpoints_from_fstab {