diff options
Diffstat (limited to 'samba_wizard/scripts/Smbconf.pm')
-rwxr-xr-x | samba_wizard/scripts/Smbconf.pm | 53 |
1 files changed, 46 insertions, 7 deletions
diff --git a/samba_wizard/scripts/Smbconf.pm b/samba_wizard/scripts/Smbconf.pm index ddf09ee9..1466caf0 100755 --- a/samba_wizard/scripts/Smbconf.pm +++ b/samba_wizard/scripts/Smbconf.pm @@ -5,7 +5,7 @@ require "__WIZ_HOME__/common/scripts/Vareqval.pm"; require "__WIZ_HOME__/common/scripts/DrakconnectConf.pm"; use MDK::Common; use strict; - +use Data::Dumper; # All possibilies in the config file must be precedeed by ";" # This script can just comment, uncomment or/and change values # but can not add anything. @@ -20,8 +20,9 @@ sub check { } sub check_services { - $ENV{wiz_do_homes} and return 2; - $ENV{wiz_do_file_sharing} and return 1; + $ENV{wiz_do_homes} and return 3; + $ENV{wiz_do_file_sharing} and return 2; + $ENV{wiz_do_printer_sharing} and return 1; 0; } @@ -73,6 +74,22 @@ sub write_conf { } } } + +sub list_printers { + my $file = "/etc/printcap"; + my $i; + + sort grep /^(?!\#).*/, map { + my @toto = split(':', $_); + $i++; + $toto[0]; + } cat_($file); +} + +sub check_users { + return 1 if $ENV{wiz_do_printer_sharing}; + 0; +} sub comment_menu { my $self = shift; @@ -120,17 +137,35 @@ sub printer_sharing { } sub check_workgroup { - !$ENV{workgroup} and return 1; + !$ENV{wiz_workgroup} and return 1; 10; } -sub check_banner { - !$ENV{banner} and return 1; +sub ask_acces { 10; } +sub check_printers { + foreach (keys %::bool) { + print "$::bool{$_}\n"; + } +} + my $old = read_conf("/etc/samba/smb.conf"); +sub get_write { + $old->{conf}->{public}{"write list"}{value}; +} + +sub get_read { + $old->{conf}->{public}{"read list"}{value}; +} + +sub check_banner { + !$ENV{wiz_banner} and return 1; + 10; +} + sub get_workgroup { $old->{conf}->{global}{workgroup}{value}; } @@ -140,7 +175,9 @@ sub get_banner { } sub ask_dir { - $ENV{wiz_do_file_sharing}; + return 2 if $ENV{wiz_do_file_sharing}; + return 1 if $ENV{wiz_do_printer_sharing}; + 0; } sub get_dir { @@ -152,6 +189,8 @@ sub do_it { my $conf = read_conf("__WIZ_HOME__/samba_wizard/scripts/smb.conf.default"); $conf->chg_var("global", "workgroup", $ENV{wiz_workgroup}); $conf->chg_var("global", "server string", $ENV{wiz_banner}); + $conf->chg_var("public", "write list", $ENV{wiz_write_list}) if $ENV{wiz_do_file_sharing}; + $conf->chg_var("public", "read list", $ENV{wiz_read_list}) if $ENV{wiz_do_file_sharing}; my $ip = $o->get_from_known_dev("IP"); $conf->file_sharing() if $ENV{wiz_do_file_sharing}; $conf->printer_sharing() if $ENV{wiz_do_printer_sharing}; |