summaryrefslogtreecommitdiffstats
path: root/samba_wizard/Sambashare.pm
diff options
context:
space:
mode:
Diffstat (limited to 'samba_wizard/Sambashare.pm')
-rwxr-xr-xsamba_wizard/Sambashare.pm52
1 files changed, 26 insertions, 26 deletions
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..."));