diff options
Diffstat (limited to 'perl-install')
-rw-r--r-- | perl-install/Makefile | 4 | ||||
-rw-r--r-- | perl-install/install_steps_interactive.pm | 4 | ||||
-rw-r--r-- | perl-install/interactive.pm | 24 |
3 files changed, 24 insertions, 8 deletions
diff --git a/perl-install/Makefile b/perl-install/Makefile index 7ae8bb947..f9a160426 100644 --- a/perl-install/Makefile +++ b/perl-install/Makefile @@ -78,7 +78,7 @@ install_pms: all for i in $(PMS); do \ dest=$(DESTREP4PMS)/`dirname $$i`; \ install -d $$dest; \ - perl -ne 'print #unless /^use (diagnostics|vars|strict)/' $$i > $(DESTREP4PMS)/$$i; \ + perl -ne 'print unless (/^=head/ .. /^=cut/) || /^\s*#-/ || /use (diagnostics|vars|strict)/' $$i > $(DESTREP4PMS)/$$i; \ done rm $(DESTREP4PMS)/c/c.xs.pm @@ -117,7 +117,7 @@ get_needed_files: $(SO_FILES) d=`echo $(DEST)/$$i | sed 's/\/usr\/local\//\/usr\//'`; \ install -d `dirname $$d` && \ if (echo $$i | grep -q "\.pm"); then \ - perl -ne '$$_ =~ /^__END__/ and exit(0); print unless /\s*#-/' $$i > $$d; \ + perl -pe '$$_ =~ /^__END__/ and exit(0);' $$i > $$d; \ else \ cp -f $$i $$d; \ strip $$d 2>/dev/null || true; \ diff --git a/perl-install/install_steps_interactive.pm b/perl-install/install_steps_interactive.pm index e4bb09f97..b2b42036c 100644 --- a/perl-install/install_steps_interactive.pm +++ b/perl-install/install_steps_interactive.pm @@ -451,7 +451,9 @@ sub addUser($) { {val => \$u->{shell}, list => \@shells, not_edit => !$::expert}, ], focus_out => sub { - $u->{name} = lc first($u->{realname} =~ /(\w+)/) if $_[0] eq 0; + if ($_[0] eq 0) { + $u->{name} = lc first($u->{realname} =~ /((\w|-)+)/); + } }, complete => sub { $u->{password} eq $u->{password2} or $o->ask_warn('', [ _("You must enter the same password"), _("Please try again") ]), return (1,3); diff --git a/perl-install/interactive.pm b/perl-install/interactive.pm index cf22eae85..4cf9ef95b 100644 --- a/perl-install/interactive.pm +++ b/perl-install/interactive.pm @@ -44,27 +44,41 @@ sub new($) { #-###################################################################################### sub ask_warn($$$) { my ($o, $title, $message) = @_; - ask_from_list($o, $title, $message, [ _("Ok") ]); + ask_from_list2($o, $title, $message, [ _("Ok") ]); } sub ask_yesorno($$$;$) { my ($o, $title, $message, $def) = @_; - ask_from_list_($o, $title, $message, [ __("Yes"), __("No") ], $def ? "No" : "Yes") eq "Yes"; + ask_from_list2_($o, $title, $message, [ __("Yes"), __("No") ], $def ? "No" : "Yes") eq "Yes"; } sub ask_okcancel($$$;$) { my ($o, $title, $message, $def) = @_; - ask_from_list_($o, $title, $message, [ __("Ok"), __("Cancel") ], $def ? "Cancel" : "Ok") eq "Ok"; + ask_from_list2_($o, $title, $message, [ __("Ok"), __("Cancel") ], $def ? "Cancel" : "Ok") eq "Ok"; } -sub ask_from_list_($$$$;$) { +sub ask_from_list_ { + my ($o, $title, $message, $l, $def) = @_; + @$l == 0 and die; + @$l == 1 and return $l->[0]; + goto &ask_from_list2_; +} + +sub ask_from_list { + my ($o, $title, $message, $l, $def) = @_; + @$l == 0 and die; + @$l == 1 and return $l->[0]; + goto &ask_from_list2; +} + +sub ask_from_list2_($$$$;$) { my ($o, $title, $message, $l, $def) = @_; untranslate( ask_from_list($o, $title, $message, [ map { translate($_) } @$l ], translate($def)), @$l); } -sub ask_from_list($$$$;$) { +sub ask_from_list2($$$$;$) { my ($o, $title, $message, $l, $def) = @_; $message = ref $message ? $message : [ $message ]; |