summaryrefslogtreecommitdiffstats
path: root/samba_wizard
diff options
context:
space:
mode:
authorAntoine Ginies <aginies@mandriva.com>2005-08-22 15:17:43 +0000
committerAntoine Ginies <aginies@mandriva.com>2005-08-22 15:17:43 +0000
commitb3c8b7000b8b99a0e524f2f75118ef8665fc1a38 (patch)
tree06a6aa41a137958a98b4b796bfa7e5a33ecefdd9 /samba_wizard
parent9ab930cfed03248afb4660ad91d1f3e6002841f5 (diff)
downloaddrakwizard-b3c8b7000b8b99a0e524f2f75118ef8665fc1a38.tar
drakwizard-b3c8b7000b8b99a0e524f2f75118ef8665fc1a38.tar.gz
drakwizard-b3c8b7000b8b99a0e524f2f75118ef8665fc1a38.tar.bz2
drakwizard-b3c8b7000b8b99a0e524f2f75118ef8665fc1a38.tar.xz
drakwizard-b3c8b7000b8b99a0e524f2f75118ef8665fc1a38.zip
various imprvement (add Public and User share)
Diffstat (limited to 'samba_wizard')
-rwxr-xr-xsamba_wizard/Sambashare.pm146
1 files changed, 133 insertions, 13 deletions
diff --git a/samba_wizard/Sambashare.pm b/samba_wizard/Sambashare.pm
index 53273191..a62d90e9 100755
--- a/samba_wizard/Sambashare.pm
+++ b/samba_wizard/Sambashare.pm
@@ -71,6 +71,25 @@ my %understanding = (
2 => N("Expert - advanced options"),
);
+my %menu_root_share = (
+ 1 => N("Add/remove/modify share (expert only)"),
+ 2 => N("Special share (CDrom, Homes, Profiles)"),
+ 3 => N("Public share"),
+ 4 => N("User share"),
+ );
+
+my %menu_special_share = (
+ 1 => N("CDrom - share a CDrom"),
+ 2 => N("Homes - share home user dir"),
+ 3 => N("Profiles - profiles directory on the fly"),
+ );
+
+my %menu_manage = (
+ 1 => N("Add - add a share"),
+ 2 => N("Remove - remove a share"),
+ 3 => N("Modify - modify a share"),
+ );
+
my %share = (
1 => N("Add - add a share"),
2 => N("Remove - remove a share"),
@@ -86,33 +105,62 @@ my $wiz_samba_etc = "/etc/sysconfig/wizard_samba";
$o->{pages} = {
welcome => {
- name => N("What do you want todo with your share?") . "\n\n" . N("add/remove/modify a share"),
+ name => N("What do you want todo?") . "\n\n" . N("Manage, create special share, create public/user share"),
pre => sub {
if (! -f $wiz_samba_etc) {
$::in->ask_warn(N("Information"), N("It seems that you don\'t setup a Samba server. Please setup a Samba server with Samba wizard before manage your share."));
exit(1);
}
- $o->{var}{wiz_share} = 1;
+ $o->{var}{wiz_share} = 0;
},
data => [
- { label => '', val => \$o->{var}{wiz_share}, type => 'list', list => [ keys %share ], format => sub { $share{$_[0]} } },
+ { label => '', val => \$o->{var}{wiz_share}, type => 'list', list => [ sort keys %menu_root_share ], format => sub { $menu_root_share{$_[0]} } },
],
post => sub {
if ($o->{var}{wiz_share} == 1) {
- return 'add_share' }
+ return 'manage_share' }
elsif ($o->{var}{wiz_share} == 2) {
- return 'choose_share_to_delete' }
+ return 'special_share' }
elsif ($o->{var}{wiz_share} == 3) {
- return 'understanding' }
+ return 'add_public_share' }
elsif ($o->{var}{wiz_share} == 4) {
- return 'add_cdrom_share' }
- elsif ($o->{var}{wiz_share} == 5) {
- return 'add_homes' }
- elsif ($o->{var}{wiz_share} == 6) {
- return 'add_profiles' }
+ return 'add_user_share' }
},
no_back => 1,
},
+ manage_share => {
+ name => N("What do you want todo with your share?") . "\n\n" . N("add/remove/modify a share"),
+ pre => sub { $o->{var}{manage_share} = 0; },
+ data => [
+ { label => '', val => \$o->{var}{manage_share}, type => 'list', list => [ keys %menu_manage ], format => sub { $menu_manage{$_[0]} } },
+ ],
+ post => sub {
+ if ($o->{var}{manage_share} == 1) {
+ return 'add_share' }
+ elsif ($o->{var}{manage_share} == 2) {
+ return 'choose_share_to_delete' }
+ elsif ($o->{var}{manage_share} == 3) {
+ return 'understanding' }
+ },
+ no_back => 1,
+ },
+ special_share => {
+ name => N("Create a special share, what kind?"),
+ pre => sub { $o->{var}{special_share} = 1; },
+ data => [
+ { label => '', val => \$o->{var}{special_share}, type => 'list', list => [ keys %menu_special_share ], format => sub { $menu_special_share{$_[0]} } },
+ ],
+ post => sub {
+ if ($o->{var}{special_share} == 1) {
+ return 'add_cdrom_share' }
+ elsif ($o->{var}{special_share} == 2) {
+ return 'add_homes' }
+ elsif ($o->{var}{special_share} == 3) {
+ return 'add_profiles' }
+ },
+ no_back => 1,
+ },
+
understanding => {
name => N("Now I need to know your understanding in Samba server configuration"),
data => [
@@ -185,7 +233,7 @@ $o->{pages} = {
exists $samba->{$share}{'write list'} and $o->{var}{wiz_share_writelist} = $samba->{$share}{'write list'};
exists $samba->{$share}{'hide dot files'} and $o->{var}{wiz_share_dotfiles} = $samba->{$share}{'hide dot files'};
exists $samba->{$share}{'hide files'} and $o->{var}{wiz_share_hidefiles} = $samba->{$share}{'hide files'};
- $o->{var}{wiz_owner} = 1;
+ $o->{var}{wiz_owner} = "0";
exists $samba->{$share}{'valid users'} and $o->{var}{wiz_share_valid_users} = $samba->{$share}{'valid users'};
exists $samba->{$share}{'admin users'} and $o->{var}{wiz_share_admin_users} = $samba->{$share}{'admin users'};
},
@@ -299,11 +347,83 @@ $o->{pages} = {
],
next => 'summary_addcdromshare',
},
+ add_user_share => {
+ name => N("Add a user share") . "\n" . N("Comment: description of the share") . "\n",
+ pre => sub {
+ $o->{var}{wiz_add_user_share_browseable} = "yes";
+ $o->{var}{wiz_add_user_share_public} = "no";
+ $o->{var}{wiz_add_user_share_createmode} = "0700";
+ $o->{var}{wiz_add_user_owner} = "";
+ $o->{var}{wiz_add_user_share_createmask} = "664";
+ $o->{var}{wiz_add_user_share_directorymask} = "775";
+ },
+ data => [
+ { label => N("Name of the share:"), val => \$o->{var}{wiz_add_user_share_name} },
+ { label => N("Comment:"), val => \$o->{var}{wiz_add_user_share_comment} },
+ { label => N("Path:"), val => \$o->{var}{wiz_add_user_share_path} },
+ { label => N("Public:"), fixed_val => \$o->{var}{wiz_add_user_share_public} },
+ ],
+ complete => sub {
+ foreach my $clef (keys %$samba) {
+ if ($clef =~ /$o->{var}{wiz_add_user_share_name}/) {
+ $::in->ask_warn(N("Error"), N("Share with the same name already exist or share name empty, please choose another name."));
+ return 1;
+ }
+ }
+ if (!$o->{var}{wiz_add_user_share_path}) {
+ $::in->ask_warn(N("Error"), N("Can\'t create the directory, please enter a correct path.")) and return 1;
+ }
+ if (!$o->{var}{wiz_add_user_share_comment}) {
+ $::in->ask_warn(N("Error"), N("Please enter a Comment for this share.")) and return 1;
+ }
+ if (! -d $o->{var}{wiz_add_user_share_path}) {
+ mkdir_p($o->{var}{wiz_add_user_share_path}) or $::in->ask_warn(N("Error"), N("Can\'t create the directory, please enter a correct path."));
+ return 1;
+ } else { return 0 }
+ },
+ next => 'endd_add_user_share',
+ },
+ add_public_share => {
+ name => N("Add a public share") . "\n" . N("Comment: description of the share") . "\n",
+ pre => sub {
+ $o->{var}{wiz_add_public_share_browseable} = "yes";
+ $o->{var}{wiz_add_public_share_public} = "yes";
+ $o->{var}{wiz_add_public_share_createmode} = "0700";
+ $o->{var}{wiz_add_public_owner} = "";
+ $o->{var}{wiz_add_public_share_createmask} = "664";
+ $o->{var}{wiz_add_public_share_directorymask} = "775";
+ },
+ data => [
+ { label => N("Name of the share:"), val => \$o->{var}{wiz_add_public_share_name} },
+ { label => N("Comment:"), val => \$o->{var}{wiz_add_public_share_comment} },
+ { label => N("Path:"), val => \$o->{var}{wiz_add_public_share_path} },
+ { label => N("Public:"), fixed_val => \$o->{var}{wiz_add_public_share_public} },
+ ],
+ complete => sub {
+ foreach my $clef (keys %$samba) {
+ if ($clef =~ /$o->{var}{wiz_add_public_share_name}/) {
+ $::in->ask_warn(N("Error"), N("Share with the same name already exist or share name empty, please choose another name."));
+ return 1;
+ }
+ }
+ if (!$o->{var}{wiz_add_public_share_path}) {
+ $::in->ask_warn(N("Error"), N("Can\'t create the directory, please enter a correct path.")) and return 1;
+ }
+ if (!$o->{var}{wiz_add_public_share_comment}) {
+ $::in->ask_warn(N("Error"), N("Please enter a Comment for this share.")) and return 1;
+ }
+ if (! -d $o->{var}{wiz_add_public_share_path}) {
+ mkdir_p($o->{var}{wiz_add_public_share_path}) or $::in->ask_warn(N("Error"), N("Can\'t create the directory, please enter a correct path."));
+ return 1;
+ } else { return 0 }
+ },
+ next => 'endd_add_public_share',
+ },
add_share_options => {
name => N("Add a share") . "\n" . N("If you don\'t want to use one of this options, leave it blanck."),
pre => sub {
$o->{var}{wiz_addshare_createmode} = "0700";
- $o->{var}{wiz_owner} = 0;
+ $o->{var}{wiz_owner} = "0";
$o->{var}{wiz_addshare_createmask} = "664";
$o->{var}{wiz_addshare_directorymask} = "775";
},