summaryrefslogtreecommitdiffstats
path: root/samba_wizard
diff options
context:
space:
mode:
Diffstat (limited to 'samba_wizard')
-rwxr-xr-xsamba_wizard/Samba.pm52
1 files changed, 37 insertions, 15 deletions
diff --git a/samba_wizard/Samba.pm b/samba_wizard/Samba.pm
index ffc36904..52c335d7 100755
--- a/samba_wizard/Samba.pm
+++ b/samba_wizard/Samba.pm
@@ -50,7 +50,7 @@ my $o = {
list_printers => ''
},
needed_rpm => [ 'samba-server' ],
- defaultimage => "$ENV{__WIZ_HOME__}/samba_wizard/images/samba.png",
+ defaultimage => "$ENV{__WIZ_HOME__}samba_wizard/images/samba.png",
init => sub {
my $file = "/etc/samba/smb.conf";
if (-f $file) {
@@ -351,18 +351,28 @@ sub write_conf {
#section has the name of the printer
sub add_printer {
my ($self, $printer) = @_;
+ my @sprintername = split(/\|/, $printer);
if (exists $self->{conf}{$printer}) {
$self->comment_menu($printer, " ");
}
else {
$self->{conf}{$printer}{printable}{comment} = " ";
- $self->{conf}{$printer}{printer}{comment} = " ";
push @{$self->{tab}}, "[$printer]\n";
- push @{$self->{tab}}, "printer = $printer\n";
- push @{$self->{tab}}, "printable = yes\n";
- $self->{conf}{$printer}{printer}{value} = $printer;
+ push @{$self->{tab}}, " printer = $sprintername[0]\n";
+ push @{$self->{tab}}, " comment = $sprintername[1]\n";
+ push @{$self->{tab}}, " printable = yes\n";
+ push @{$self->{tab}}, " browseable = no\n";
+ push @{$self->{tab}}, " createmode = 0700\n";
+ push @{$self->{tab}}, " writable =yes\n";
+ push @{$self->{tab}}, " guestok = yes\n";
+ $self->{conf}{$printer}{printer}{value} = $sprintername[0];
+ $self->{conf}{$printer}{comment}{value} = $sprintername[1];
$self->{conf}{$printer}{printable}{value} = "yes";
+ $self->{conf}{$printer}{writable}{value} = "yes";
+ $self->{conf}{$printer}{browseable}{value} = "no";
+ $self->{conf}{$printer}{createmode}{value} = "0700";
+ $self->{conf}{$printer}{guestok}{value} = "yes";
}
}
@@ -537,19 +547,31 @@ sub do_it {
$conf->chg_var("global", "hosts deny", $o->{var}{wiz_hosts_deny});
$conf->chg_var("global", "hosts allow", $o->{var}{wiz_hosts_allow});
+
if ($o->{var}{wiz_do_printer_sharing}) {
- standalone->explanations("Enabling printer sharing");
- $conf->printer_sharing;
+ standalone->explanations("Enabling printer sharing");
+ $conf->comment_menu("global", " ");
+ $conf->chg_var("global", "printcap name", "cups");
+ $conf->chg_var("global", "printer admin", "\@adm");
+ $conf->printer_sharing;
} else {
- standalone->explanations("Disabling printer sharing");
- for (my $i = 0; $i < @{$o->{var}{wiz_box_list}}; $i++) {
- $conf->comment_menu($o->{var}{list_printers}[$i], ";");
- }
- $conf->comment_menu("printers", ";");
- }
- $conf->write_conf("/etc/samba/smb.conf");
+ standalone->explanations("Disabling printer sharing");
+ for (my $i = 0; $i < @{$o->{var}{wiz_box_list}}; $i++) {
+ $conf->comment_menu($o->{var}{list_printers}[$i], ";");
+ }
+ $conf->comment_menu("printers", ";");
+ }
+
+ my $smbconf = "/etc/samba/smb.conf";
+ $conf->write_conf($smbconf);
+ # horrible fix for createmode and guestok
+ substInFile {
+ s/createmode/create mode/;
+ s/guestok/guest ok/;
+ } "/etc/samba/smb.conf";
+
if (services::is_service_running('smb')) {
- services::restart('smb')
+ services::restart('smb')
} else {
services::start('smb')
}