summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntoine Ginies <aginies@mandriva.com>2005-05-31 05:30:00 +0000
committerAntoine Ginies <aginies@mandriva.com>2005-05-31 05:30:00 +0000
commitd2481c122a275c06cdf4dbec9a38ec10d269d3db (patch)
treefd882c1eae0487161227b6e6464857a4067e545b
parentc6223b1bcd5bd58598e61b5f8b3e014c1a640df1 (diff)
downloaddrakwizard-d2481c122a275c06cdf4dbec9a38ec10d269d3db.tar
drakwizard-d2481c122a275c06cdf4dbec9a38ec10d269d3db.tar.gz
drakwizard-d2481c122a275c06cdf4dbec9a38ec10d269d3db.tar.bz2
drakwizard-d2481c122a275c06cdf4dbec9a38ec10d269d3db.tar.xz
drakwizard-d2481c122a275c06cdf4dbec9a38ec10d269d3db.zip
add feature to share cdrom
-rwxr-xr-xsamba_wizard/Samba.pm81
1 files changed, 73 insertions, 8 deletions
diff --git a/samba_wizard/Samba.pm b/samba_wizard/Samba.pm
index 224c9016..1ebdcdfc 100755
--- a/samba_wizard/Samba.pm
+++ b/samba_wizard/Samba.pm
@@ -122,6 +122,7 @@ my %share = (
1 => N('Add - add a share'),
2 => N('Remove - remove a share'),
3 => N('Modify - modify a share'),
+ 4 => N('CDrom - share a CDrom'),
);
my @yesorno = qw(yes no);
@@ -250,11 +251,13 @@ $o->{pages} = {
return 'choose_share' }
elsif ($o->{var}{wiz_share} == 3) {
return 'choose_share' }
+ elsif ($o->{var}{wiz_share} == 4) {
+ return 'add_cdrom_share' }
},
no_back => 1,
},
choose_share => {
- name => N('Modify a share'),
+ name => N('Manage wich share ?') . "\n\n" . N('Please choose the share you want to manage.'),
pre => \&list_all_shares,
post => sub {
if ($o->{var}{wiz_share} == 2) {
@@ -264,11 +267,17 @@ $o->{pages} = {
}
},
data => [
- { label => N('Choose share you want to modifie:'), val => \$o->{var}{wiz_selected_share}, fixed_list => \@listshare },
+ { label => N('Choose share you want to manage:'), val => \$o->{var}{wiz_selected_share}, fixed_list => \@listshare },
],
+ complete => sub {
+ if ($o->{var}{wiz_selected_share} =~ /cdrom/ || $o->{var}{wiz_share} == 2) {
+ $::in->ask_warn(N('Error'), N('Can\'t modify cdrom share, please choose another share.'));
+ return 1;
+ }
+ },
},
delete_share => {
- name => N('Delete a share'),
+ name => N('Remove a share ?'),
pre => sub {
my $dshare = $o->{var}{wiz_selected_share};
$o->{var}{wiz_selected_share_comment} = $samba->{$dshare}{comment};
@@ -336,6 +345,34 @@ $o->{pages} = {
},
next => 'add_share_options',
},
+ add_cdrom_share => {
+ name => N('Add a CDROM share'),
+ pre => sub {
+ if ($samba->{cdrom}{comment}) {
+ $o->{var}{wiz_cdrom_comment} = $samba->{cdrom}{comment};
+ } else {
+ $o->{var}{wiz_cdrom_comment} = "%L CDrom";
+ }
+ if ($samba->{cdrom}{path}) {
+ $o->{var}{wiz_cdrom_path} = $samba->{cdrom}{path}
+ } else {
+ $o->{var}{wiz_cdrom_path} = "/mnt/cdrom";
+ }
+ $o->{var}{wiz_cdrom_browseable} = "yes";
+ $o->{var}{wiz_cdrom_pre} = "/bin/mount /mnt/cdrom";
+ $o->{var}{wiz_cdrom_post} = "/bin/umount /mnt/cdrom";
+ $o->{var}{wiz_cdrom_public} = "yes";
+ },
+ data => [
+ { label => N('Comment:'), fixed_val => \$o->{var}{wiz_cdrom_comment} },
+ { label => N('Cdrom path:'), fixed_val => \$o->{var}{wiz_cdrom_path} },
+ { label => N('Browseable:'), fixed_val => \$o->{var}{wiz_cdrom_browseable} },
+ { label => N('Root preexec:'), fixed_val => \$o->{var}{wiz_cdrom_pre} },
+ { label => N('Root postexec:'), fixed_val => \$o->{var}{wiz_cdrom_post} },
+ { label => N('Public:'), fixed_val => \$o->{var}{wiz_cdrom_public} },
+ ],
+ next => 'summary_addcdromshare',
+ },
add_share_options => {
name => N('Add a share') . "\n" . N('If you doesn\'t want to use one this options, leave it blanck.'),
pre => sub {
@@ -594,7 +631,7 @@ $o->{pages} = {
next => 'summary',
},
summary_modify => {
- name => N('Summary modify a share'),
+ name => N('Summary modify a share') . "\n\n" . N('If you really want to modify this share, click the Next button or use the Back button.'),
data => [
{ label => N('Name of the share:'), fixed_val => \$o->{var}{wiz_share_name} },
{ label => N('Comment:'), fixed_val => \$o->{var}{wiz_share_comment} },
@@ -608,8 +645,21 @@ $o->{pages} = {
post => \&do_it_modify_share,
next => 'end_modify_share',
},
+ summary_addcdromshare => {
+ name => N('CDROM') . "\n\n" . N('If you really want to share a CDROM, click the Next button or use the Back button.'),
+ post => \&do_it_add_cdromshare,
+ data => [
+ { label => N('Comment:'), fixed_val => \$o->{var}{wiz_cdrom_comment} },
+ { label => N('Cdrom path:'), fixed_val => \$o->{var}{wiz_cdrom_path} },
+ { label => N('Browseable:'), fixed_val => \$o->{var}{wiz_cdrom_browseable} },
+ { label => N('Root preexec:'), fixed_val => \$o->{var}{wiz_cdrom_pre} },
+ { label => N('Root postexec:'), fixed_val => \$o->{var}{wiz_cdrom_post} },
+ { label => N('Public:'), fixed_val => \$o->{var}{wiz_cdrom_public} },
+ ],
+ next => 'end_add_share',
+ },
summary_addshare => {
- name => N('Summary add share'),
+ name => N('Summary add share') . "\n\n" . N('If you really want to add this this share, click the Next button or use the Back button.'),
post => \&do_it_add_share,
data => [
{ label => N('Name of the share:'), fixed_val => \$o->{var}{wiz_addshare_name} },
@@ -624,7 +674,10 @@ $o->{pages} = {
next => 'end_add_share',
},
summary_delete => {
- name => N('Summary remove a share'),
+ name => N('Summary remove a share') . "\n\n" . N('If you really want to remove this share, click the Next button or use the Back button.'),
+ data => [
+ { label => N('Name of the share to delete:'), fixed_val => \$o->{var}{wiz_selected_share} },
+ ],
post => \&do_it_remove_share,
next => 'end_delete_share',
},
@@ -747,8 +800,6 @@ sub list_all_shares() {
push @listshare, $clef;
}
}
-# print "------------- \n";
-# foreach (@listshare) { print "$_\n"; }
return @listshare;
}
@@ -854,6 +905,20 @@ sub do_it_modify_share {
check_started('smbd');
}
+sub do_it_add_cdromshare {
+ $::testing and return;
+ $samba->{cdrom}{comment} = $o->{var}{wiz_cdrom_comment};
+ $samba->{cdrom}{path} = $o->{var}{wiz_cdrom_path};
+ $samba->{cdrom}{path} = $o->{var}{wiz_cdrom_path};
+ $samba->{cdrom}{browseable} = $o->{var}{wiz_cdrom_browseable};
+ $samba->{cdrom}{'root preexec'} = $o->{var}{wiz_cdrom_pre};
+ $samba->{cdrom}{'root postexec'} = $o->{var}{wiz_cdrom_post};
+ $samba->{cdrom}{public} = $o->{var}{wiz_cdrom_public};
+
+ write_conf_restart_smb();
+ check_started('smbd');
+}
+
sub do_it_add_share {
$::testing and return;
my $share = $o->{var}{wiz_addshare_name};