summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntoine Ginies <aginies@mandriva.com>2005-08-22 16:33:39 +0000
committerAntoine Ginies <aginies@mandriva.com>2005-08-22 16:33:39 +0000
commitf29685505ed6363d615a7382ca0b559ab8f180b9 (patch)
tree55ba375aebabbb864908f2ef1473f361f1d8b829
parentb3c8b7000b8b99a0e524f2f75118ef8665fc1a38 (diff)
downloaddrakwizard-f29685505ed6363d615a7382ca0b559ab8f180b9.tar
drakwizard-f29685505ed6363d615a7382ca0b559ab8f180b9.tar.gz
drakwizard-f29685505ed6363d615a7382ca0b559ab8f180b9.tar.bz2
drakwizard-f29685505ed6363d615a7382ca0b559ab8f180b9.tar.xz
drakwizard-f29685505ed6363d615a7382ca0b559ab8f180b9.zip
add backend to write smb.conf (user and public share)
-rwxr-xr-xsamba_wizard/Sambashare.pm96
1 files changed, 90 insertions, 6 deletions
diff --git a/samba_wizard/Sambashare.pm b/samba_wizard/Sambashare.pm
index a62d90e9..d3ca3108 100755
--- a/samba_wizard/Sambashare.pm
+++ b/samba_wizard/Sambashare.pm
@@ -348,17 +348,16 @@ $o->{pages} = {
next => 'summary_addcdromshare',
},
add_user_share => {
- name => N("Add a user share") . "\n" . N("Comment: description of the share") . "\n",
+ name => N("Add a user 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("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} },
@@ -381,7 +380,7 @@ $o->{pages} = {
return 1;
} else { return 0 }
},
- next => 'endd_add_user_share',
+ next => 'summary_add_user_share',
},
add_public_share => {
name => N("Add a public share") . "\n" . N("Comment: description of the share") . "\n",
@@ -417,7 +416,7 @@ $o->{pages} = {
return 1;
} else { return 0 }
},
- next => 'endd_add_public_share',
+ next => 'summary_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."),
@@ -484,6 +483,7 @@ $o->{pages} = {
name => N("Specific roving profile share, use the user's home directory"),
pre => sub {
$o->{var}{wiz_profiles_path} = "/var/lib/samba/profiles";
+ $o->{var}{wiz_profiles_comment} = "User Profiles";
$o->{var}{wiz_profiles_browseable} = "no";
$o->{var}{wiz_profiles_guest_ok} = "yes";
$o->{var}{wiz_profiles_writable} = "yes";
@@ -549,7 +549,7 @@ $o->{pages} = {
],
next => 'end_add_share',
},
- summary_delete => {
+ summary_delete => {
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."),
pre => sub {
my $dshare = $o->{var}{wiz_selected_share};
@@ -562,6 +562,32 @@ $o->{pages} = {
post => \&do_it_remove_share,
next => 'end_delete_share',
},
+ summary_add_user_share => {
+ name => N("Summary of add a user share") . "\n\n" . N("If you really want to add this share, click the Next button or use the Back button."),
+ pre => sub {
+ },
+ 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} },
+ ],
+ post => \&do_it_add_user_share,
+ next => 'end_add_user_share',
+ },
+ summary_add_public_share => {
+ name => N("Summary of add a public share") . "\n\n" . N("If you really want to add this share, click the Next button or use the Back button."),
+ pre => sub {
+ },
+ 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} },
+ ],
+ post => \&do_it_add_public_share,
+ next => 'end_add_public_share',
+ },
end => {
name => N("Congratulations") . "\n\n" . N("The wizard successfully configured your Samba samba."),
post => sub {
@@ -580,6 +606,16 @@ $o->{pages} = {
end => 1,
next => 0
},
+ end_add_user_share => {
+ name => N("Congratulations") . "\n\n" . N("The wizard successfully add your user share."),
+ end => 1,
+ next => 0
+ },
+ end_add_public_share => {
+ name => N("Congratulations") . "\n\n" . N("The wizard successfully add your public share."),
+ end => 1,
+ next => 0
+ },
end_add_profiles => {
name => N("Congratulations") . "\n\n" . N("The wizard successfully add your Profiles share."),
end => 1,
@@ -730,6 +766,7 @@ sub do_it_add_profiles {
$samba->{global}{'logon home'} = "\\\\%L\\Profiles\\%u";
$samba->{Profiles}{browseable} = $o->{var}{wiz_profiles_browseable};
$samba->{Profiles}{'guest ok'} = $o->{var}{wiz_profiles_guest_ok};
+ $samba->{Profiles}{'comment'} = $o->{var}{wiz_profiles_comment};
$samba->{Profiles}{writable} = $o->{var}{wiz_profiles_writable};
$samba->{Profiles}{'root preexec'} = "PROFILE='/var/lib/samba/profiles/\%u'; if [ ! -e \$PROFILE ]; then mkdir -pm700 \$PROFILE; chown '\%u':'\%g' \$PROFILE;fi";
@@ -770,6 +807,53 @@ sub do_it_add_homeshare {
check_started('smbd');
}
+sub do_it_add_public_share {
+ $::testing and return;
+ my $in = 'interactive'->vnew('su', 'Samba');
+ my $share = $o->{var}{wiz_add_public_share_name};
+ my $w = $in->wait_message(N("Samba share"), N("Configuring your Samba server..."));
+
+ $samba->{$share};
+ $samba->{$share}{browseable} = $o->{var}{wiz_add_public_share_browseable};
+ $samba->{$share}{public} = $o->{var}{wiz_add_public_share_public};
+ $samba->{$share}{path} = $o->{var}{wiz_add_public_share_createmode};
+ $samba->{$share}{'create mask'} = $o->{var}{wiz_add_public_share_createmask};
+ $samba->{$share}{'directory mask'} = $o->{var}{wiz_add_public_share_directorymask};
+ $samba->{$share}{comment} = $o->{var}{wiz_add_public_share_comment};
+ $samba->{$share}{path} = $o->{var}{wiz_add_public_share_path};
+
+ write_conf_restart_smb();
+ undef $w;
+ check_started('smbd');
+
+}
+
+sub do_it_add_user_share {
+ $::testing and return;
+ my $in = 'interactive'->vnew('su', 'Samba');
+ my $share = $o->{var}{wiz_add_user_share_name};
+ my $w = $in->wait_message(N("Samba share"), N("Configuring your Samba server..."));
+
+ $samba->{$share};
+ $samba->{$share}{browseable} = $o->{var}{wiz_add_user_share_browseable};
+ $samba->{$share}{public} = $o->{var}{wiz_add_user_share_public};
+ $samba->{$share}{path} = $o->{var}{wiz_add_user_share_createmode};
+ $samba->{$share}{'create mask'} = $o->{var}{wiz_add_user_share_createmask};
+ $samba->{$share}{'directory mask'} = $o->{var}{wiz_add_user_share_directorymask};
+ $samba->{$share}{comment} = $o->{var}{wiz_add_user_share_comment};
+ $samba->{$share}{path} = $o->{var}{wiz_add_user_share_path};
+
+ $samba->{$share}{'write list'} = $o->{var}{wiz_add_user_share_writelist};
+ if ($o->{var}{wiz_owner}) {
+ system("chown -R $o->{var}{wiz_add_user_share_writelist}.users $o->{var}{wiz_add_user_share_path}");
+ }
+ create_smbuser($o->{var}{wiz_add_user_share_writelist});
+
+ write_conf_restart_smb();
+ undef $w;
+ check_started('smbd');
+
+}
sub do_it_add_share {
$::testing and return;