summaryrefslogtreecommitdiffstats
path: root/samba_wizard
diff options
context:
space:
mode:
authorAntoine Ginies <aginies@mandriva.com>2005-05-31 15:16:07 +0000
committerAntoine Ginies <aginies@mandriva.com>2005-05-31 15:16:07 +0000
commit7216b1988b74ca023cee78729d720dd43c6bb02a (patch)
treec31e96474dc724516ee75fa03374128eb3378905 /samba_wizard
parenta8b68e313616d6c74000043afb17946851c9ecf6 (diff)
downloaddrakwizard-7216b1988b74ca023cee78729d720dd43c6bb02a.tar
drakwizard-7216b1988b74ca023cee78729d720dd43c6bb02a.tar.gz
drakwizard-7216b1988b74ca023cee78729d720dd43c6bb02a.tar.bz2
drakwizard-7216b1988b74ca023cee78729d720dd43c6bb02a.tar.xz
drakwizard-7216b1988b74ca023cee78729d720dd43c6bb02a.zip
add a new wizard to manage share
Diffstat (limited to 'samba_wizard')
-rwxr-xr-xsamba_wizard/Sambasharing.pm506
1 files changed, 506 insertions, 0 deletions
diff --git a/samba_wizard/Sambasharing.pm b/samba_wizard/Sambasharing.pm
new file mode 100755
index 00000000..e7e674db
--- /dev/null
+++ b/samba_wizard/Sambasharing.pm
@@ -0,0 +1,506 @@
+#!/usr/bin/perl
+
+# Drakwizard
+# Copyright (C) 2005 Mandriva
+#
+# Authors: antoine Ginies <aginies @ mandriva>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+package MDK::Wizard::Sambasharing;
+use strict;
+
+use common;
+use services;
+use MDK::Wizard::Wizcommon;
+
+use Libconf::Templates;
+use Libconf::Glueconf::Samba::Smb_conf;
+
+my $wiz = new MDK::Wizard::Wizcommon;
+
+my @listshare;
+
+my $o = {
+ name => 'Samba wizard',
+ var => {
+ wiz_do_homes => '',
+ wiz_dir => '',
+ wiz_share_comment => '', wiz_share_browseable => '', wiz_share_writable => '',
+ wiz_write_list => '',
+ wiz_read_list => '',
+ wiz_hosts_deny => '',
+ wiz_home_writable => '', wiz_home_browseable => '', wiz_home_createmode => '',
+ wiz_home_comment => '',
+ wiz_addshare_comment => '', wiz_addshare_browseable => '', wiz_addshare_writable => '',
+ wiz_addshare_createmode => '', wiz_addshare_dotfiles => '',
+ wiz_selected_share => '',
+ wiz_selected_share_comment => '',
+ },
+ needed_rpm => [ 'samba-server' ],
+ defaultimage => "/usr/share/wizards/samba_wizard/images/samba.png"
+ };
+
+# we ask glueconf to give us the structure representing /etc/samba/smb.conf
+my $samba = new Libconf::Glueconf::Samba::Smb_conf({ filename => '/etc/samba/smb.conf', show_commented_info => 1 });
+
+use Data::Dumper;
+#print Dumper($samba);
+
+my %level = (
+ 1 => N('All - No access restriction'),
+ 2 => N('My rules - Ask me allowed and denied hosts')
+);
+
+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'),
+ 5 => N('Homes - share home user dir'),
+ );
+
+my @yesorno = qw(yes no);# push @yesorno, " ";
+
+$o->{pages} = {
+ welcome => {
+ name => N('What do you want todo with your share ?') . "\n\n" . N('add/remove/modify a share'),
+ data => [
+ { label => N("what do you want:"), val => \$o->{var}{wiz_share}, list => [ keys %share ], format => sub { $share{$_[0]} } },
+ ],
+ post => sub {
+ if ($o->{var}{wiz_share} == 1) {
+ return 'add_share' }
+ elsif ($o->{var}{wiz_share} == 2) {
+ return 'choose_share' }
+ elsif ($o->{var}{wiz_share} == 3) {
+ return 'choose_share' }
+ elsif ($o->{var}{wiz_share} == 4) {
+ return 'add_cdrom_share' }
+ elsif ($o->{var}{wiz_share} == 5) {
+ return 'ask_homes' }
+ },
+ no_back => 1,
+ },
+ choose_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) {
+ return 'delete_share';
+ } else {
+ return 'modify_share';
+ }
+ },
+ data => [
+ { 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;
+ }
+ if ($o->{var}{wiz_selected_share} =~ /homes/ || $o->{var}{wiz_share} == 2) {
+ $::in->ask_warn(N('Error'), N('Can\'t modify homes share, please choose another share.'));
+ return 1;
+ }
+ },
+ },
+ delete_share => {
+ name => N('Remove a share'),
+ pre => sub {
+ my $dshare = $o->{var}{wiz_selected_share};
+ $o->{var}{wiz_selected_share_comment} = $samba->{$dshare}{comment};
+ },
+ data => [
+ { label => N('Delete this share:'), fixed_val => \$o->{var}{wiz_selected_share} },
+ { label => N('Comment for this share:'), fixed_val => \$o->{var}{wiz_selected_share_comment} },
+ ],
+ next => 'summary_delete',
+ },
+ modify_share => {
+ name => N('Modify a share'),
+ pre => sub {
+ my $share = $o->{var}{wiz_selected_share};
+ $o->{var}{wiz_share_comment} = $samba->{$share}{comment};
+ $o->{var}{wiz_add_share_writable} = $samba->{$share}{writable};
+ $o->{var}{wiz_share_browseable} = $samba->{$share}{browseable};
+ $o->{var}{wiz_share_path} = $samba->{$share}{path};
+ $o->{var}{wiz_share_public} = $samba->{$share}{public};
+ },
+ complete => sub {
+ if (!($o->{var}{wiz_share_comment})) {
+ $::in->ask_warn(N('Error'), N('Please enter a share comment.'));
+ return 1;
+ }
+ },
+ data => [
+ { label => N('Name of the share:'), fixed_val => \$o->{var}{wiz_selected_share} },
+ { label => N('Comment:'), val => \$o->{var}{wiz_share_comment} },
+ { label => N('Path:'), val => \$o->{var}{wiz_share_path} },
+ { label => N('Browseable:'), val => \$o->{var}{wiz_share_browseable}, fixed_list => \@yesorno, help => N("Allows share to be displayed in list of share.") },
+ { label => N('Writable:'), val => \$o->{var}{wiz_share_writable}, fixed_list => \@yesorno },
+ { label => N('Public:'), val => \$o->{var}{wiz_share_public}, fixed_list => \@yesorno },
+ ],
+ next => 'modify_share_options',
+ },
+ modify_share_options => {
+ name => N('Modify a share') . "\n\n" . N('Advanced options, use them if you know what you are doing.'),
+ pre => sub {
+ my $share = $o->{var}{wiz_selected_share};
+ $o->{var}{wiz_share_createmode} = $samba->{$share}{'create mode'};
+ $o->{var}{wiz_share_readlist} = exists $samba->{$share}{'read list'};
+ $o->{var}{wiz_share_writelist} = exists $samba->{$share}{'write list'};
+ $o->{var}{wiz_share_dotfiles} = exists $samba->{$share}{'hide dot files'};
+ },
+ data => [
+ { label => N('Create mode:'), val => \$o->{var}{wiz_share_createmode} },
+ { label => N('Read list:'), val => \$o->{var}{wiz_share_readlist}, help => N('Specifies a list of users that have read-only access to a writable share. ie: root fred @users @wheel') },
+ { label => N('Write list:'), val => \$o->{var}{wiz_share_writelist}, help => N('Specifies a list of users that have read-write access to a read-only share. ie: root fred @users @wheel') },
+ { label => N('Show dot files:'), val => \$o->{var}{wiz_share_dotfiles}, fixed_list => \@yesorno, help => N("The hide dot files option hides any files on the server that begin with a dot (.)") },
+ { label => N('Hide files:'), val => \$o->{var}{wiz_share_hidefiles}, help => N("The hide files option provides one or more directory or filename patterns to Samba. Any file matching this pattern will be treated as a hidden file from the perspective of the client. ie: /.icewm/") },
+ ],
+ next => 'summary_modify',
+ },
+ add_share => {
+ name => N('Add a share') . "\n" . N('Comment: description of the share') . "\n" . N('Browseable: view share') . "\n" . N('Writable: user can write in the share'),
+ data => [
+ { label => N('Name of the share:'), val => \$o->{var}{wiz_addshare_name} },
+ { label => N('Comment:'), val => \$o->{var}{wiz_addshare_comment} },
+ { label => N('Path:'), val => \$o->{var}{wiz_addshare_path} },
+ { label => N('Browseable:'), val => \$o->{var}{wiz_addshare_browseable}, fixed_list => \@yesorno, help => N("Allows share to be displayed in list of share.") },
+ { label => N('Public:'), val => \$o->{var}{wiz_addshare_public}, fixed_list => \@yesorno },
+ ],
+ complete => sub {
+ foreach my $clef (keys %$samba) {
+ if ($clef =~ /$o->{var}{wiz_addshare_name}/) {
+ $::in->ask_warn(N("Error"), N("Share with the same name already exist, please choose another name."));
+ return 1
+ }
+ }
+ },
+ 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 of this options, leave it blanck.'),
+ pre => sub {
+ $o->{var}{wiz_addshare_createmode} = "0700";
+ $o->{var}{wiz_addshare_public} = "no";
+ },
+ data => [
+ { label => N('Writable:'), val => \$o->{var}{wiz_addshare_writable}, fixed_list => \@yesorno },
+ { label => N('Create mode:'), val => \$o->{var}{wiz_addshare_createmode} },
+ { label => N('Read list:'), val => \$o->{var}{wiz_addshare_readlist}, help => N('Specifies a list \of users that have read-only access to a writable share. ie: root fred @users @wheel') },
+ { label => N('Write list:'), val => \$o->{var}{wiz_addshare_writelist}, help => N('Specifies a lis\t of users that have read-write access to a read-only share. ie: root fred @users @wheel') },
+ { label => N('Show dot files:'), val => \$o->{var}{wiz_addshare_dotfiles}, fixed_list => \@yesorno, help => N("The hide dot files option hides any files on the server that begin with a dot (.)") },
+ { label => N('Hide files:'), val => \$o->{var}{wiz_addshare_hidefiles}, help => N("The hide files option provides one or more directory or filename patterns to Samba. Any file matching this pattern will be treated as a hidden file from the perspective of the client. ie: /.icewm/") },
+ ],
+ next => 'summary_addshare',
+ },
+ ask_homes => {
+ name => N('Users home options') . "\n" . N('You have selected to allow user access their home directories via samba but you/they must use smbpasswd to set a password.') . "\n" . N('Comment: description of users home directory') . "\n" . N('Browseable: view share') . "\n" . N('Writable: user can write in their home') . "\n" . N('Create mode: man chmod for more info'),
+ pre => sub {
+ if ($samba->{homes}{comment}) {
+ $o->{var}{wiz_home_comment} ||= $samba->{homes}{comment};
+ } else {
+ $o->{var}{wiz_home_comment} = "Home Directories";
+ }
+ $o->{var}{wiz_home_browseable} ||= $samba->{homes}{browseable};
+ $o->{var}{wiz_home_writable} ||= $samba->{homes}{writable};
+ if ($samba->{homes}{'create mode'}) {
+ $o->{var}{wiz_home_createmode} ||= $samba->{homes}{'create mode'};
+ } else {
+ $o->{var}{wiz_home_createmode} = "0755";
+ }
+ },
+ data => [
+ { label => N('Comment:'), val => \$o->{var}{wiz_home_comment} },
+ { label => N('Browseable:'), val => \$o->{var}{wiz_home_browseable}, fixed_list => \@yesorno },
+ { label => N('Writable:'), val => \$o->{var}{wiz_home_writable}, fixed_list => \@yesorno },
+ { label => N('Create mode:'), val => \$o->{var}{wiz_home_createmode} },
+ ],
+ next => 'summary_homeshare',
+ },
+ summary_homeshare => {
+ name => N('Summary add home 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_homeshare,
+ data => [
+ { label => N('Comment:'), fixed_val => \$o->{var}{wiz_home_comment} },
+ { label => N('Browseable:'), fixed_val => \$o->{var}{wiz_home_browseable}, },
+ { label => N('Writable:'), fixed_val => \$o->{var}{wiz_home_writable}, },
+ { label => N('Create mode:'), fixed_val => \$o->{var}{wiz_home_createmode} },
+ ],
+ next => 'end_add_share',
+ },
+ summary_modify => {
+ 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} },
+ { label => N('Browseable:'), fixed_val => \$o->{var}{wiz_share_browseable} },
+ { label => N('Writable:'), fixed_val => \$o->{var}{wiz_share_writable} },
+ { label => N('Public:'), fixed_val => \$o->{var}{wiz_share_public} },
+ { label => N('Create mode:'), fixed_val => \$o->{var}{wiz_share_createmode} },
+ { label => N('Read list:'), fixed_val => \$o->{var}{wiz_share_readlist} },
+ { label => N('Write list:'), fixed_val => \$o->{var}{wiz_share_writelist} },
+ { label => N('Show dot files:'), fixed_val => \$o->{var}{wiz_share_dotfiles} },
+ { label => N('Hide files:'), fixed_val => \$o->{var}{wiz_share_hidefiles} },
+ ],
+ 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') . "\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} },
+ { label => N('Comment:'), fixed_val => \$o->{var}{wiz_addshare_comment} },
+ { label => N('Browseable:'), fixed_val => \$o->{var}{wiz_addshare_browseable} },
+ { label => N('Writable:'), fixed_val => \$o->{var}{wiz_addshare_writable} },
+ { label => N('Public:'), fixed_val => \$o->{var}{wiz_addshare_public} },
+ { label => N('Create mode:'), fixed_val => \$o->{var}{wiz_addshare_createmode} },
+ { label => N('Read list:'), fixed_val => \$o->{var}{wiz_addshare_readlist} },
+ { label => N('Write list:'), fixed_val => \$o->{var}{wiz_addshare_writelist} },
+ { label => N('Show dot files:'), fixed_val => \$o->{var}{wiz_addshare_dotfiles} },
+ ],
+ next => 'end_add_share',
+ },
+ 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.'),
+ 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',
+ },
+ end => {
+ name => N('Congratulations') . "\n\n" . N('The wizard successfully configured your Samba server.'),
+ post => sub {
+ store_samba_type($o->{var}{wiz_type});
+ },
+ end => 1,
+ next => 0
+ },
+ end_modify_share => {
+ name => N('Congratulations') . "\n\n" . N('The wizard successfully modify your share.'),
+ end => 1,
+ next => 0
+ },
+ end_add_share => {
+ name => N('Congratulations') . "\n\n" . N('The wizard successfully add your share.'),
+ end => 1,
+ next => 0
+ },
+ end_delete_share => {
+ name => N('Congratulations') . "\n\n" . N('The wizard successfully remove your share.'),
+ end => 1,
+ next => 0
+ },
+ error_end => {
+ name => N("Failed"),
+ data => [ { label => N("Please relaunch drakwizard, and try to change some parameters.") } ],
+ no_back => 1,
+ end => 1,
+ next => 0,
+ },
+ };
+
+sub new {
+ my ($class, $conf) = @_;
+ bless {
+ o => $o,
+ }, $class;
+}
+
+sub wiz_mkdir_p {
+ my ($dir) = @_;
+ if (-d $dir) {
+ # Do nothing, directory exists
+ } elsif (-e $dir) {
+ # Directory is file, we are not going to delete it
+ return 0;
+ } else {
+ # Create parent directory
+ wiz_mkdir_p(dirname($dir)) or return 0;
+ # Create our directory
+ mkdir($dir, 0755) or return 0;
+ chown "nobody", "users", $dir;
+ }
+ 1;
+}
+
+sub check() {
+ $> and return 1;
+ $wiz->{net}->is_dhcp() and return 2;
+ 0;
+}
+
+sub remove_share {
+ my ($share) = @_;
+ delete $samba->{$share};
+}
+
+sub list_all_shares() {
+ undef @listshare;
+ foreach my $clef (keys %$samba) {
+ if ($samba->{$clef}{printable} =~ /yes/i) {
+ print "$clef is a printer\n";
+ } elsif ($clef =~ /global/ or $clef =~ /print\$/) {
+ print "unwanted\n";
+ } else {
+ push @listshare, $clef;
+ }
+ }
+ return @listshare;
+}
+
+sub write_conf_restart_smb {
+ $samba->write_conf("/etc/samba/smb.conf");
+ if (services::is_service_running('smb')) {
+ services::restart('smb')
+ } else { services::start('smb') }
+}
+
+sub do_it_remove_share {
+ $::testing and return;
+ my $in = 'interactive'->vnew('su', 'Samba');
+ my $w = $in->wait_message(N("Samba server"), N("Configuring your Samba server..."));
+ my $share = $o->{var}{wiz_selected_share};
+ delete $samba->{$share};
+
+ write_conf_restart_smb();
+ undef $w;
+ check_started('smbd');
+}
+
+sub do_it_modify_share {
+ $::testing and return;
+ my $in = 'interactive'->vnew('su', 'Samba');
+ my $w = $in->wait_message(N("Samba server"), N("Configuring your Samba server..."));
+ my $share = $o->{var}{wiz_selected_share};
+ $samba->{$share};
+ $samba->{$share}{comment} = $o->{var}{wiz_share_comment};
+ $samba->{$share}{browseable} = $o->{var}{wiz_share_browseable};
+ $samba->{$share}{writable} = $o->{var}{wiz_share_writable};
+ $samba->{$share}{public} = $o->{var}{wiz_share_public};
+ $o->{var}{wiz_share_hidefiles} and $samba->{$share}{'hide files'} = $o->{var}{wiz_share_hidefiles};
+ $o->{var}{wiz_share_dotfiles} and $samba->{$share}{'hide dot files'} = $o->{var}{wiz_share_dotfiles};
+ $o->{var}{wiz_share_readlist} and $samba->{$share}{'read list'} = $o->{var}{wiz_share_readlist};
+ $o->{var}{wiz_share_writelist} and $samba->{$share}{'write list'} = $o->{var}{wiz_share_writelist};
+ $o->{var}{wiz_share_createmode} and $samba->{$share}{'create mode'} = $o->{var}{wiz_share_createmode};
+
+ write_conf_restart_smb();
+ undef $w;
+ check_started('smbd');
+}
+
+sub do_it_add_cdromshare {
+ $::testing and return;
+ my $in = 'interactive'->vnew('su', 'Samba');
+ my $w = $in->wait_message(N("Samba server"), N("Configuring your Samba server..."));
+ $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();
+ undef $w;
+ check_started('smbd');
+}
+
+sub do_it_add_homeshare {
+ $::testing and return;
+ my $in = 'interactive'->vnew('su', 'Samba');
+ my $w = $in->wait_message(N("Samba server"), N("Configuring your Samba server..."));
+ $samba->{homes};
+ $samba->{homes}{comment} = $o->{var}{wiz_home_comment};
+ $samba->{homes}{browseable} = $o->{var}{wiz_home_browseable};
+ $samba->{homes}{writable} = $o->{var}{wiz_home_writable};
+ $samba->{homes}{'create mode'} = $o->{var}{wiz_home_createmode};
+
+ write_conf_restart_smb();
+ undef $w;
+ check_started('smbd');
+}
+
+
+sub do_it_add_share {
+ $::testing and return;
+ my $in = 'interactive'->vnew('su', 'Samba');
+ my $w = $in->wait_message(N("Samba server"), N("Configuring your Samba server..."));
+
+ my $share = $o->{var}{wiz_addshare_name};
+ $samba->{$share};
+ $samba->{$share}{comment} = $o->{var}{wiz_addshare_comment};
+ $samba->{$share}{path} = $o->{var}{wiz_addshare_path};
+ $samba->{$share}{browseable} = $o->{var}{wiz_addshare_browseable};
+ $samba->{$share}{writable} = $o->{var}{wiz_addshare_writable};
+ $samba->{$share}{public} = $o->{var}{wiz_addshare_public};
+ $o->{var}{wiz_addshare_dotfiles} and $samba->{$share}{'hide dot files'} = $o->{var}{wiz_addshare_dotfiles};
+ $o->{var}{wiz_addshare_hidefiles} and $samba->{$share}{'hide files'} = $o->{var}{wiz_addshare_hidefiles};
+ $o->{var}{wiz_addshare_readlist} and $samba->{$share}{'read list'} = $o->{var}{wiz_addshare_readlist};
+ $o->{var}{wiz_addshare_writelist} and $samba->{$share}{'write list'} = $o->{var}{wiz_addshare_writelist};
+ $o->{var}{wiz_addshare_createmode} and $samba->{$share}{'create mode'} = $o->{var}{wiz_addshare_createmode};
+
+ write_conf_restart_smb();
+ undef $w;
+ check_started('smbd');
+}
+
+1;