diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2004-02-06 19:49:10 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2004-02-06 19:49:10 +0000 |
commit | 428226c89c0b9631f120af80e0138f4c1ac9a794 (patch) | |
tree | 3646a46f90c2205bf22f9eee1b6a255ee0a288b7 /perl-install/any.pm | |
parent | 5fb90f8d684687e0066fd09a5a1b2d58d117b28d (diff) | |
download | drakx-backup-do-not-use-428226c89c0b9631f120af80e0138f4c1ac9a794.tar drakx-backup-do-not-use-428226c89c0b9631f120af80e0138f4c1ac9a794.tar.gz drakx-backup-do-not-use-428226c89c0b9631f120af80e0138f4c1ac9a794.tar.bz2 drakx-backup-do-not-use-428226c89c0b9631f120af80e0138f4c1ac9a794.tar.xz drakx-backup-do-not-use-428226c89c0b9631f120af80e0138f4c1ac9a794.zip |
(fileshare_config): quite different way of handling it, asking first if user
wants sharing or not, then asking which protocol (when users wants sharing).
Removing or installing the server package handling the protocols (smb or nfs).
Diffstat (limited to 'perl-install/any.pm')
-rw-r--r-- | perl-install/any.pm | 49 |
1 files changed, 24 insertions, 25 deletions
diff --git a/perl-install/any.pm b/perl-install/any.pm index 301709830..9a2c17472 100644 --- a/perl-install/any.pm +++ b/perl-install/any.pm @@ -810,28 +810,6 @@ sub fileshare_config { my @l = (N_("No sharing"), N_("Allow all users"), N_("Custom")); my $restrict = exists $conf{RESTRICT} ? text2bool($conf{RESTRICT}) : 1; - if ($restrict) { - #- verify we can export in $type - my %type2file = (nfs => [ '/etc/init.d/nfs', 'nfs-utils' ], smb => [ '/etc/init.d/smb', 'samba' ]); - my @wanted = $type ? $type : keys %type2file; - my @have = grep { -e $type2file{$_}[0] } @wanted; - if (!@have) { - if (@wanted == 1) { - $in->ask_okcancel('', N("The package %s needs to be installed. Do you want to install it?", $type2file{$wanted[0]}[1]), 1) or return; - } else { - my $wanted = $in->ask_many_from_list('', N("You can export using NFS or Samba. Please select which you'd like to use."), - { list => \@wanted }) or return; - @wanted = @$wanted or return; - } - $in->do_pkgs->install(map { $type2file{$_}[1] } @wanted); - @have = grep { -e $type2file{$_}[0] } @wanted; - } - if (!@have) { - $in->ask_warn('', N("Mandatory package %s is missing", $wanted[0])); - return; - } - } - my $r = $in->ask_from_list_('fileshare', N("Would you like to allow users to share some of their directories? Allowing this will permit users to simply click on \"Share\" in konqueror and nautilus. @@ -840,11 +818,32 @@ Allowing this will permit users to simply click on \"Share\" in konqueror and na "), \@l, $l[$restrict ? 0 : 1]) or return; $restrict = $r ne $l[1]; + my $custom = $r eq $l[2]; + if ($r ne $l[0]) { + #- verify we can export in $type + my %type2file = (nfs => [ 'nfs-utils', '/etc/init.d/nfs' ], smb => [ 'samba-server', '/etc/init.d/smb' ]); + my %l; + if ($type) { + %l = ($type => 1); + } else { + %l = map_each { $::a => -e $::b->[1] } %type2file; + $in->ask_from('', N("You can export using NFS or Samba. Please select which you'd like to use."), + [ map { { text => $_, val => \$l{$_}, type => 'bool' } } keys %l ]) or return; + } + foreach (keys %l) { + my ($pkg, $file) = @{$type2file{$_}} or die "unknown type $_\n"; + if ($l{$_}) { + $in->do_pkgs->ensure_is_installed($pkg, $file) or return; + } elsif (-e $file) { + $in->ask_okcancel('', N("The package %s is going to be removed.", $pkg), 1) or return; + $in->do_pkgs->remove($pkg); + } + } + } $conf{RESTRICT} = bool2yesno($restrict); - setVarsInSh($file, \%conf); - if ($r eq $l[2]) { - # custom + + if ($custom) { run_program::rooted($::prefix, 'groupadd', '-r', 'fileshare'); if ($in->ask_from_no_check( { |