summaryrefslogtreecommitdiffstats
path: root/samba_wizard/Samba.pm
diff options
context:
space:
mode:
Diffstat (limited to 'samba_wizard/Samba.pm')
-rwxr-xr-xsamba_wizard/Samba.pm70
1 files changed, 35 insertions, 35 deletions
diff --git a/samba_wizard/Samba.pm b/samba_wizard/Samba.pm
index 0c8ee6e3..2e0edcbc 100755
--- a/samba_wizard/Samba.pm
+++ b/samba_wizard/Samba.pm
@@ -38,8 +38,8 @@ my $o = {
wiz_do_file_sharing => '',
wiz_all_printers => '',
wiz_level => '',
-# wiz_printers => '',
-# wiz_do_printer_sharing => '',
+ wiz_printers => '',
+ wiz_do_printer_sharing => '',
wiz_do_homes => '',
wiz_workgroup => '',
wiz_dir => '',
@@ -47,10 +47,10 @@ my $o = {
wiz_write_list => '',
wiz_read_list => '',
wiz_hosts_deny => '',
-# list_printers => ''
+ list_printers => ''
},
needed_rpm => [ 'samba-server' ],
- defaultimage => "/usr/share/wizards/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) {
@@ -132,13 +132,13 @@ $o->{pages} = {
name => N("Enabled Samba Services") . "\n\n" . N("Samba can provide a common file sharing area to your Windows workstation, and can also provide printer sharing for the printers connected to your server."),
pre => sub {
$o->{var}{wiz_do_file_sharing} ||= get_file_sharing();
-# $o->{var}{wiz_do_printer_sharing} ||= 1;
+ $o->{var}{wiz_do_printer_sharing} ||= 1;
$o->{var}{wiz_do_homes} ||= get_home_sharing()
},
post => \&check_services,
data => [
{ text => N("Enable file sharing area"), type => 'bool', val => \$o->{var}{wiz_do_file_sharing} },
-# { text => N("Enable Server Printer Sharing"), type => 'bool', val => \$o->{var}{wiz_do_printer_sharing} },
+ { text => N("Enable Server Printer Sharing"), type => 'bool', val => \$o->{var}{wiz_do_printer_sharing} },
{ text => N("Make home directories available for their owners"), type => 'bool', val => \$o->{var}{wiz_do_homes} },
],
next => 'ask_dir'
@@ -176,19 +176,19 @@ $o->{pages} = {
{ label => N("read list:"), help => N("root, fred, \@users, \@wheel"), val => \$o->{var}{wiz_read_list} },
{ label => N("write list:"), help => N("root, fred, \@users, \@wheel"), val => \$o->{var}{wiz_write_list} },
],
-# next => 'ask_printers'
-# },
-# ask_printers => {
-# name => N("Select which printers you want to be accessible from known users"),
-# pre => sub {
-# $o->{var}{list_printers} ||= [ list_printers() ];
-# $o->{var}{wiz_box_list} ||= get_previous_printers($o->{var}{list_printers})
- # },
- # post => \&check,
- # data => [
- # { text => N("Enable all printers"), type => 'bool', val => \$o->{var}{wiz_all_printers} },
- # { val => \$o->{var}{wiz_box_list}, boolean_list => \$o->{var}{list_printers}, disabled => sub { $o->{var}{wiz_all_printers} and return 1; 0 } },
- # ],
+ next => 'ask_printers'
+ },
+ ask_printers => {
+ name => N("Select which printers you want to be accessible from known users"),
+ pre => sub {
+ $o->{var}{list_printers} ||= [ list_printers() ];
+ $o->{var}{wiz_box_list} ||= get_previous_printers($o->{var}{list_printers})
+ },
+ post => \&check,
+ data => [
+ { text => N("Enable all printers"), type => 'bool', val => \$o->{var}{wiz_all_printers} },
+ { val => \$o->{var}{wiz_box_list}, boolean_list => \$o->{var}{list_printers}, disabled => sub { $o->{var}{wiz_all_printers} and return 1; 0 } },
+ ],
next => 'summary'
},
warning => {
@@ -207,9 +207,9 @@ $o->{pages} = {
name => N("Configuring Samba") . "\n\n" . N("The wizard collected the following parameters
configure Samba.") . "\n\n" . N("To accept these values, and configure your server, click the Next button or use the Back button to correct them."),
pre => sub {
-# $o->{var}{printers} = get_printers();
+ $o->{var}{printers} = get_printers();
$o->{var}{file_sharing} = $o->{var}{wiz_do_file_sharing} ? N("enabled") : N("disabled");
-# $o->{var}{printer_sharing} = $o->{var}{wiz_do_printer_sharing} ? N("enabled") : N("disabled");
+ $o->{var}{printer_sharing} = $o->{var}{wiz_do_printer_sharing} ? N("enabled") : N("disabled");
$o->{var}{shared_homes} = $o->{var}{wiz_do_homes} ? N("enabled") : N("disabled")
},
data => [
@@ -217,9 +217,9 @@ configure Samba.") . "\n\n" . N("To accept these values, and configure your serv
{ label => N("Server Banner:"), fixed_val => \$o->{var}{wiz_banner} },
{ label => N("File Sharing:"), fixed_val => \$o->{var}{file_sharing} },
{ label => N("Shared directory:"), fixed_val => \$o->{var}{wiz_dir} },
-# { label => N("Print Server:"), fixed_val => \$o->{var}{printer_sharing} },
+ { label => N("Print Server:"), fixed_val => \$o->{var}{printer_sharing} },
{ label => N("Home:"), fixed_val => \$o->{var}{shared_homes} },
-# { label => N("Printers:"), fixed_val => \$o->{var}{printers} },
+ { label => N("Printers:"), fixed_val => \$o->{var}{printers} },
],
post => \&do_it,
next => 'end'
@@ -254,7 +254,7 @@ sub check {
sub check_services {
$o->{var}{wiz_do_homes} and return 'warn_smbpasswd';
$o->{var}{wiz_do_file_sharing} and return 'ask_dir';
-# $o->{var}{wiz_do_printer_sharing} and return 'ask_printers';
+ $o->{var}{wiz_do_printer_sharing} and return 'ask_printers';
}
sub check_dir {
@@ -334,7 +334,7 @@ sub list_printers {
my @list if 0;
return @list if @list;
- sort grep { ! /^#/ } map { /([^:]*):/ and $1 } cat_("/etc/printcap");
+ sort grep { /^(?!#)./ } map { /([^:]*):/ and $1 } cat_("/etc/printcap");
}
@@ -501,16 +501,16 @@ 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;
-# } 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", ";");
-# }
+ if ($o->{var}{wiz_do_printer_sharing}) {
+ standalone->explanations("Enabling printer sharing");
+ $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");
if (services::is_service_running('smb')) {
services::restart('smb')