summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xsamba_wizard/Samba.pm21
-rwxr-xr-xsamba_wizard/Sambaprint.pm4
-rwxr-xr-xsamba_wizard/Sambashare.pm52
3 files changed, 39 insertions, 38 deletions
diff --git a/samba_wizard/Samba.pm b/samba_wizard/Samba.pm
index dd1b0605..d665b980 100755
--- a/samba_wizard/Samba.pm
+++ b/samba_wizard/Samba.pm
@@ -33,6 +33,7 @@ use Libconf::Templates;
use Libconf::Glueconf::Samba::Smb_conf;
my $wiz = new MDK::Wizard::Wizcommon;
+my $in = interactive->vnew;
my $DOMAINNAME = chomp_(`dnsdomainname`);
my $SHORTHOSTNAME = chomp_(`hostname -s`);
@@ -98,7 +99,7 @@ $o->{pages} = {
pre => sub {
if (-f $wiz_samba_etc) {
# $::isWizard = 1;
-# $::in->ask_warn(N("Information"), N("It seems you previously setup a Samba server. This wizard will re-read your old configuration, and show you the Samba server type you choose")) and return 0;
+# $in->ask_warn(N("Information"), N("It seems you previously setup a Samba server. This wizard will re-read your old configuration, and show you the Samba server type you choose")) and return 0;
my $data = cat_($wiz_samba_etc);
# detect old Samba type
my ($old_type) = $data =~ /type=(\d)/;
@@ -150,7 +151,7 @@ $o->{pages} = {
],
complete => sub {
if (!$o->{var}{wiz_domain_master}) {
- $::in->ask_warn(N("Error"), N("The domain is wrong."));
+ $in->ask_warn(N("Error"), N("The domain is wrong."));
return 1;
} else { return 0 }
},
@@ -180,7 +181,7 @@ $o->{pages} = {
],
complete => sub {
if ($o->{var}{wiz_wins_support} =~ /no/ and !$o->{var}{wiz_wins_server}) {
- $::in->ask_warn(N("Error"), N("Your server doesn't support Wins. Please provide a Wins server, or leave blank Wins Support entry."));
+ $in->ask_warn(N("Error"), N("Your server doesn't support Wins. Please provide a Wins server, or leave blank Wins Support entry."));
return 1;
} else { return 0 }
},
@@ -224,7 +225,7 @@ $o->{pages} = {
],
complete => sub {
if (!$o->{var}{wiz_password_server}) {
- $::in->ask_warn(N("Error"), N("Please provide the password server."));
+ $in->ask_warn(N("Error"), N("Please provide the password server."));
return 1;
} else { return 0 }
},
@@ -265,19 +266,19 @@ $o->{pages} = {
],
complete => sub {
if (!($o->{var}{wiz_ldap_suffix})) {
- $::in->ask_warn(N("Error"), N("Please provide an LDAP suffix."));
+ $in->ask_warn(N("Error"), N("Please provide an LDAP suffix."));
return 1;
}
if (! ($o->{var}{wiz_ldap_admin_dn})) {
- $::in->ask_warn(N("Error"), N("Please enter an LDAP administrator."));
+ $in->ask_warn(N("Error"), N("Please enter an LDAP administrator."));
return 1;
}
if (! ($o->{var}{wiz_ldap_root_pw})) {
- $::in->ask_warn(N("Error"), N("Please enter an LDAP password."));
+ $in->ask_warn(N("Error"), N("Please enter an LDAP password."));
return 1;
}
if ($o->{var}{wiz_ldap_root_pw} ne $o->{var}{wiz_ldap_root_pw_2}) {
- $::in->ask_warn(N("Error"), N("Passwords do not match."));
+ $in->ask_warn(N("Error"), N("Passwords do not match."));
return 1;
}
},
@@ -296,7 +297,7 @@ $o->{pages} = {
],
complete => sub {
if (!$o->{var}{wiz_workgroup}) {
- $::in->ask_warn(N("Error"), N("The Workgroup is wrong."));
+ $in->ask_warn(N("Error"), N("The Workgroup is wrong."));
return 1;
} else { return 0 }
},
@@ -312,7 +313,7 @@ $o->{pages} = {
],
complete => sub {
if (!$o->{var}{wiz_banner}) {
- $::in->ask_warn(N("Error"), N("The Server Banner is incorrect."));
+ $in->ask_warn(N("Error"), N("The Server Banner is incorrect."));
return 1;
} else { return 0 }
},
diff --git a/samba_wizard/Sambaprint.pm b/samba_wizard/Sambaprint.pm
index 0c5ea761..8a6c5df3 100755
--- a/samba_wizard/Sambaprint.pm
+++ b/samba_wizard/Sambaprint.pm
@@ -30,6 +30,7 @@ use Libconf::Templates;
use Libconf::Glueconf::Samba::Smb_conf;
my $wiz = new MDK::Wizard::Wizcommon;
+my $in = interactive->vnew;
my $wiz_samba_etc = "/etc/sysconfig/wizard_samba";
my @listshare;
@@ -66,8 +67,7 @@ $o->{pages} = {
no_back => 1,
pre => sub {
if (! -f $wiz_samba_etc) {
- $::in->ask_warn(N("Information"), N("It seems that you haven't setup a Samba server. Please setup a Samba server with Samba wizard before manage your shares."));
- exit(1);
+ $in->ask_warn(N("Information"), N("It seems that you haven't setup a Samba server. Please setup a Samba server with Samba wizard before manage your shares.")) or $in->exit;
}
$o->{var}{wiz_do_printer_sharing} = "0";
},
diff --git a/samba_wizard/Sambashare.pm b/samba_wizard/Sambashare.pm
index 870531c2..694581a7 100755
--- a/samba_wizard/Sambashare.pm
+++ b/samba_wizard/Sambashare.pm
@@ -30,6 +30,7 @@ use Libconf::Templates;
use Libconf::Glueconf::Samba::Smb_conf;
my $wiz = new MDK::Wizard::Wizcommon;
+my $in = interactive->vnew;
my @listshare;
my @listshare_tomodify;
@@ -108,8 +109,7 @@ $o->{pages} = {
name => N("What do you want to do?") . "\n\n" . N("Manage, create special share, create public/user share"),
pre => sub {
if (! -f $wiz_samba_etc) {
- $::in->ask_warn(N("Information"), N("It seems that you haven't setup a Samba server. Please setup a Samba server with Samba wizard before manage your shares."));
- exit(1);
+ $in->ask_warn(N("Information"), N("It seems that you haven't setup a Samba server. Please setup a Samba server with Samba wizard before manage your shares.")) or $in->exit;
}
$o->{var}{wiz_share} = 0;
},
@@ -207,7 +207,7 @@ $o->{pages} = {
complete => sub {
map {
if ($_ and !/^\d+$/) {
- $::in->ask_warn(N("Error"), N("Create mask, create mode and directory mask should be numeric. ie: 0755.")) and return 1;
+ $in->ask_warn(N("Error"), N("Create mask, create mode and directory mask should be numeric. ie: 0755.")) and return 1;
}
} $o->{var}{wiz_homes_create_mask}, $o->{var}{wiz_homes_directory_mask}, $o->{var}{wiz_homes_create_mode};
},
@@ -217,7 +217,7 @@ $o->{pages} = {
name => N("Modify a share"),
pre => sub {
if (!$o->{var}{wiz_selected_share}) {
- $::in->ask_warn(N("Information"), N("There is no share to modify, please add one."));
+ $in->ask_warn(N("Information"), N("There is no share to modify, please add one."));
exit(1);
} else {
my $share = $o->{var}{wiz_selected_share};
@@ -230,7 +230,7 @@ $o->{pages} = {
},
complete => sub {
if (!($o->{var}{wiz_share_comment})) {
- $::in->ask_warn(N("Error"), N("Please enter a share comment."));
+ $in->ask_warn(N("Error"), N("Please enter a share comment."));
return 1;
}
},
@@ -280,7 +280,7 @@ $o->{pages} = {
foreach my $user (@users) {
print "$user\n";
if ($user and !any { /^$user:/ } cat_("/etc/passwd")) {
- $::in->ask_warn(N("Error"), N("Please provide a system user, %s not present.", $user));
+ $in->ask_warn(N("Error"), N("Please provide a system user, %s not present.", $user));
return 1; $_;
}
}
@@ -312,7 +312,7 @@ $o->{pages} = {
complete => sub {
map {
if ($_ and $_ !~ /^\d+$/) {
- $::in->ask_warn(N("Error"), N("Create mask, force directory mode and force create mode should be numeric. ie: 0755.")) and return 1;
+ $in->ask_warn(N("Error"), N("Create mask, force directory mode and force create mode should be numeric. ie: 0755.")) and return 1;
}
} $o->{var}{wiz_share_create_mask}, $o->{var}{wiz_share_force_directory_mode}, $o->{var}{wiz_share_force_create_mode};
},
@@ -330,18 +330,18 @@ $o->{pages} = {
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 or share name empty, please choose another name."));
+ $in->ask_warn(N("Error"), N("Share with the same name already exist or share name empty, please choose another name."));
return 1;
}
}
if (!$o->{var}{wiz_addshare_path}) {
- $::in->ask_warn(N("Error"), N("Can\'t create the directory, please enter a correct path.")) and return 1;
+ $in->ask_warn(N("Error"), N("Can\'t create the directory, please enter a correct path.")) and return 1;
}
if (!$o->{var}{wiz_addshare_comment}) {
- $::in->ask_warn(N("Error"), N("Please enter a comment for this share.")) and return 1;
+ $in->ask_warn(N("Error"), N("Please enter a comment for this share.")) and return 1;
}
if (! -d $o->{var}{wiz_addshare_path}) {
- mkdir_p($o->{var}{wiz_addshare_path}) or $::in->ask_warn(N("Error"), N("Can\'t create the directory, please enter a correct path."));
+ mkdir_p($o->{var}{wiz_addshare_path}) or $in->ask_warn(N("Error"), N("Can\'t create the directory, please enter a correct path."));
return 1;
} else { return 0 }
@@ -395,24 +395,24 @@ $o->{pages} = {
complete => sub {
foreach my $clef (keys %$samba) {
if ($clef =~ /$o->{var}{wiz_add_user_share_name}/) {
- $::in->ask_warn(N("Error"), N("Share with the same name already exist or share name empty, please choose another name."));
+ $in->ask_warn(N("Error"), N("Share with the same name already exist or share name empty, please choose another name."));
return 1;
}
}
if (!$o->{var}{wiz_add_user_share_path}) {
- $::in->ask_warn(N("Error"), N("Can\'t create the directory, please enter a correct path.")) and return 1;
+ $in->ask_warn(N("Error"), N("Can\'t create the directory, please enter a correct path.")) and return 1;
}
if (!$o->{var}{wiz_add_user_share_comment}) {
- $::in->ask_warn(N("Error"), N("Please enter a comment for this share.")) and return 1;
+ $in->ask_warn(N("Error"), N("Please enter a comment for this share.")) and return 1;
}
if (! -d $o->{var}{wiz_add_user_share_path}) {
- mkdir_p($o->{var}{wiz_add_user_share_path}) or $::in->ask_warn(N("Error"), N("Can\'t create the directory, please enter a correct path."));
+ mkdir_p($o->{var}{wiz_add_user_share_path}) or $in->ask_warn(N("Error"), N("Can\'t create the directory, please enter a correct path."));
return 1;
} else { return 0 }
map { my @users = split(" ", $_);
foreach my $user (@users) {
if ($user and !any { /^$user:/ } cat_("/etc/passwd")) {
- $::in->ask_warn(N("Error"), N("Please provide a system user, %s not present.", $user));
+ $in->ask_warn(N("Error"), N("Please provide a system user, %s not present.", $user));
return 1; $_;
}
}
@@ -441,21 +441,21 @@ $o->{pages} = {
complete => sub {
foreach my $clef (keys %$samba) {
if ($clef =~ /$o->{var}{wiz_add_public_share_name}/) {
- $::in->ask_warn(N("Error"), N("Share with the same name already exist or share name empty, please choose another name."));
+ $in->ask_warn(N("Error"), N("Share with the same name already exist or share name empty, please choose another name."));
return 1;
}
}
if ($o->{var}{wiz_add_public_share_writable} eq 'yes') {
- $::in->ask_okcancel(N("WARNING"), N("Be careful, you define your public share writable. This wizard will change permission to nobody.users, so do not use this feature on a home directory !")) or return 1;
+ $in->ask_okcancel(N("WARNING"), N("Be careful, you define your public share writable. This wizard will change permission to nobody.users, so do not use this feature on a home directory !")) or return 1;
}
if (!$o->{var}{wiz_add_public_share_path}) {
- $::in->ask_warn(N("Error"), N("Can't create the directory, please enter a correct path.")) and return 1;
+ $in->ask_warn(N("Error"), N("Can't create the directory, please enter a correct path.")) and return 1;
}
if (!$o->{var}{wiz_add_public_share_comment}) {
- $::in->ask_warn(N("Error"), N("Please enter a comment for this share.")) and return 1;
+ $in->ask_warn(N("Error"), N("Please enter a comment for this share.")) and return 1;
}
if (! -d $o->{var}{wiz_add_public_share_path}) {
- mkdir_p($o->{var}{wiz_add_public_share_path}) or $::in->ask_warn(N("Error"), N("Can't create the directory, please enter a correct path."));
+ mkdir_p($o->{var}{wiz_add_public_share_path}) or $in->ask_warn(N("Error"), N("Can't create the directory, please enter a correct path."));
return 1;
} else { return 0 }
},
@@ -482,13 +482,13 @@ $o->{pages} = {
map { my @users = split(" ", $_);
foreach my $user (@users) {
if ($user and !any { /^$user:/ } cat_("/etc/passwd")) {
- $::in->ask_warn(N("Error"), N("Please provide a system user, %s not present.", $user));
+ $in->ask_warn(N("Error"), N("Please provide a system user, %s not present.", $user));
return 1; $_;
}
}
} $o->{var}{wiz_addshare_writelist}, $o->{var}{wiz_addshare_readlist};
if ($o->{var}{wiz_addshare_createmask} and $o->{var}{wiz_addshare_createmask} !~ /^\d+$/) {
- $::in->ask_warn(N("Error"), N("Create mask should be a number. ie: 0755.")) and return 1;
+ $in->ask_warn(N("Error"), N("Create mask should be a number. ie: 0755.")) and return 1;
}
},
next => 'summary_addshare',
@@ -518,7 +518,7 @@ $o->{pages} = {
next => 'summary_homeshare',
complete => sub {
if ($o->{var}{wiz_home_createmode} and $o->{var}{wiz_home_createmode} !~ /^\d+$/) {
- $::in->ask_warn(N("Error"), N("Create mode should be a number. ie: 0755.")) and return 1;
+ $in->ask_warn(N("Error"), N("Create mode should be a number. ie: 0755.")) and return 1;
}
},
},
@@ -767,7 +767,7 @@ sub do_it_modify_share {
if (!-d $samba->{$share}{path}) {
mkdir($samba->{$share}{path});
if (!-d $samba->{$share}{path}) {
- $::in->ask_warn(N("Error"), N("Can\'t create %s. Please check why wizard can\'t create this directory.", $samba->{$share}{path}));
+ $in->ask_warn(N("Error"), N("Can\'t create %s. Please check why wizard can\'t create this directory.", $samba->{$share}{path}));
}
}
my $w = $in->wait_message(N("Samba share"), N("Configuring your Samba server..."));
@@ -933,7 +933,7 @@ sub do_it_add_share {
if (!-d $samba->{$share}{path}) {
system("mkdir $samba->{$share}{path}");
if (!-d $samba->{$share}{path}) {
- $::in->ask_warn(N("Error"), N("Can\'t create %s. Please check why wizard can\'t create this directory.", $samba->{$share}{path}));
+ $in->ask_warn(N("Error"), N("Can\'t create %s. Please check why wizard can\'t create this directory.", $samba->{$share}{path}));
}
}
my $w = $in->wait_message(N("Samba share"), N("Configuring your Samba server..."));