koha-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Koha-cvs] CVS: koha/misc Install.pm,1.38,1.39


From: MJ Ray
Subject: [Koha-cvs] CVS: koha/misc Install.pm,1.38,1.39
Date: Wed, 18 Jun 2003 16:03:02 -0700

Update of /cvsroot/koha/koha/misc
In directory sc8-pr-cvs1:/tmp/cvs-serv22525

Modified Files:
        Install.pm 
Log Message:
Closes bug 488 re Webserver config. Also improves display a little and removes 
some code bloopers.

Index: Install.pm
===================================================================
RCS file: /cvsroot/koha/koha/misc/Install.pm,v
retrieving revision 1.38
retrieving revision 1.39
diff -C2 -r1.38 -r1.39
*** Install.pm  21 May 2003 21:47:05 -0000      1.38
--- Install.pm  18 Jun 2003 23:03:00 -0000      1.39
***************
*** 3,7 ****
  
  # Copyright 2000-2002 Katipo Communications
! # my.cnf, etcdir and prefix code Copyright 2003 MJ Ray
  #
  # This file is part of Koha.
--- 3,7 ----
  
  # Copyright 2000-2002 Katipo Communications
! # Contains parts Copyright 2003 MJ Ray
  #
  # This file is part of Koha.
***************
*** 19,25 ****
--- 19,33 ----
  # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
  # Suite 330, Boston, MA  02111-1307 USA
+ #
+ # Recent Authors
+ # MJR: my.cnf, etcdir, prefix, new display, apache conf
  
  use strict;
  use POSIX;
+ #MJR: everyone will have these modules, right?
+ # They look like part of perl core to me
+ use Term::Cap;
+ use Term::ANSIColor qw(:constants);
+ use Text::Wrap;
  require Exporter;
  
***************
*** 91,96 ****
  The heading function takes one string, the text to be displayed as
  the heading, and returns a formatted heading (currently formatted
! in the "traditional Koha installer" style, i.e., surrounded by a
! box of equal signs).
  
  This reduces the likelihood of pod2man(1) etc. misinterpreting
--- 99,103 ----
  The heading function takes one string, the text to be displayed as
  the heading, and returns a formatted heading (currently formatted
! with ANSI colours).
  
  This reduces the likelihood of pod2man(1) etc. misinterpreting
***************
*** 99,107 ****
  =cut
  
  sub heading ($) {
!    my($s) = @_;
!    my $n = length($s) + 4;
!    my $line = ('=' x $n) . "\n";
!    "\n$line= $s =\n$line\n";
  }
  
--- 106,118 ----
  =cut
  
+ my $termios = POSIX::Termios->new();
+ $termios->getattr();
+ my $terminal = Term::Cap->Tgetent({OSPEED=>$termios->getospeed()});
+ my $clear_string = $terminal->Tputs('cl');
+ 
  sub heading ($) {
!   my $title = shift;
!   my $bal = 5;
!   return($clear_string."koha-".$kohaversion." 
Installer\n".ON_BLUE.WHITE.BOLD." "x$bal.uc($title)." "x$bal.RESET."\n\n");
  }
  
***************
*** 455,458 ****
--- 466,470 ----
      $result = showmessage($message, 'restrictchar CHARS');
      $result = showmessage($message, 'free');
+     $result = showmessage($message, 'silentfree');
      $result = showmessage($message, 'numerical');
      $result = showmessage($message, 'email');
***************
*** 466,470 ****
  required.
  
! The response type must be one of "none", "yn", "free",
  "numerical", "email", "PressEnter", or a string consisting
  of "restrictchar " followed by a list of allowed characters
--- 478,482 ----
  required.
  
! The response type must be one of "none", "yn", "free", "silentfree"
  "numerical", "email", "PressEnter", or a string consisting
  of "restrictchar " followed by a list of allowed characters
***************
*** 508,511 ****
--- 520,525 ----
  
  sub showmessage {
+     #MJR: Maybe refactor to use anonymous functions that
+     # check the responses instead of RnP branching.
      my $message=shift;
      my $responsetype=shift;
***************
*** 513,517 ****
      my $noclear=shift;
      $noclear = 0 unless defined $noclear; # defaults to "clear"
!     ($noclear) || (system('clear'));
      if ($responsetype =~ /^yn$/) {
        $responsetype='restrictchar ynYN';
--- 527,531 ----
      my $noclear=shift;
      $noclear = 0 unless defined $noclear; # defaults to "clear"
!     ($noclear) || (print $clear_string);
      if ($responsetype =~ /^yn$/) {
        $responsetype='restrictchar ynYN';
***************
*** 527,531 ****
            (length($response)) || ($response=$defaultresponse);
              if ( $response=~/.*[\:\(\)\^\$\*\!\\].*/ ) {
!                 ($noclear) || (system('clear'));
                  print "Response contains invalid characters.  Choose from 
[$options].\n\n";
                  print $message;
--- 541,545 ----
            (length($response)) || ($response=$defaultresponse);
              if ( $response=~/.*[\:\(\)\^\$\*\!\\].*/ ) {
!                 ($noclear) || (print $clear_string);
                  print "Response contains invalid characters.  Choose from 
[$options].\n\n";
                  print $message;
***************
*** 533,537 ****
              } else {
                  unless ($options=~/$response/) {
!                     ($noclear) || (system('clear'));
                      print "Invalid Response.  Choose from [$options].\n\n";
                      print $message;
--- 547,551 ----
              } else {
                  unless ($options=~/$response/) {
!                     ($noclear) || (print $clear_string);
                      print "Invalid Response.  Choose from [$options].\n\n";
                      print $message;
***************
*** 540,546 ****
        }
        return $response;
!     } elsif ($responsetype =~/^free$/i) {
        (defined($defaultresponse)) || ($defaultresponse='');
        my $response=<STDIN>;
        chomp $response;
        ($response) || ($response=$defaultresponse);
--- 554,562 ----
        }
        return $response;
!     } elsif ($responsetype =~/^(silent)?free$/i) {
        (defined($defaultresponse)) || ($defaultresponse='');
+       if ($responsetype =~/^(silent)/i) { setecho(0) }; 
        my $response=<STDIN>;
+       if ($responsetype =~/^(silent)/i) { setecho(1) }; 
        chomp $response;
        ($response) || ($response=$defaultresponse);
***************
*** 554,558 ****
            ($response) || ($response=$defaultresponse);
            unless ($response=~/^\d+$/) {
!               ($noclear) || (system('clear'));
                print "Invalid Response ($response).  Response must be a 
number.\n\n";
                print $message;
--- 570,574 ----
            ($response) || ($response=$defaultresponse);
            unless ($response=~/^\d+$/) {
!               ($noclear) || (print $clear_string);
                print "Invalid Response ($response).  Response must be a 
number.\n\n";
                print $message;
***************
*** 567,574 ****
            chomp $response;
            ($response) || ($response=$defaultresponse);
!           unless ($response=~/address@hidden/) {
!               ($noclear) || (system('clear'));
!               print "Invalid Response ($response).  Response must be a valid 
email address.\n\n";
!               print $message;
            }
        }
--- 583,590 ----
            chomp $response;
            ($response) || ($response=$defaultresponse);
!           if ($response!~/address@hidden/) {
!                       ($noclear) || (print $clear_string);
!                       print "Invalid Response ($response).  Response must be 
a valid email address.\n\n";
!                       print $message;
            }
        }
***************
*** 1022,1030 ****
  for the virtual hosts.  There are other ways to set this up,
  and the installer will leave comments in
! $etcdir/koha-httpd.conf detailing
  what these other options are.
  
  NOTE: You will need to add lines to your main httpd.conf to
!   Include $etcdir/koha-httpd.conf
  and to make sure it is listening on the right ports
  (using the Listen directive).
--- 1038,1046 ----
  for the virtual hosts.  There are other ways to set this up,
  and the installer will leave comments in
! %s/koha-httpd.conf detailing
  what these other options are.
  
  NOTE: You will need to add lines to your main httpd.conf to
!   Include %s/koha-httpd.conf
  and to make sure it is listening on the right ports
  (using the Listen directive).
***************
*** 1069,1073 ****
      $intranetport=8080;
  
!     showmessage(getmessage('ApacheConfigIntroduction'), 'PressEnter');
  
      $svr_admin=showmessage(getmessage('GetVirtualHostEmail', [$svr_admin]), 
'email', $svr_admin);
--- 1085,1089 ----
      $intranetport=8080;
  
!     showmessage(getmessage('ApacheConfigIntroduction',[$etcdir,$etcdir]), 
'PressEnter');
  
      $svr_admin=showmessage(getmessage('GetVirtualHostEmail', [$svr_admin]), 
'email', $svr_admin);
***************
*** 1129,1147 ****
  
  sub updateapacheconf {
!     my $logfiledir=`grep ^ErrorLog "$realhttpdconf"`;
!     chomp $logfiledir;
!     
      my $httpdconf = $etcdir."/koha-httpd.conf";
! 
!     if ($logfiledir) {
!       $logfiledir=~m#ErrorLog (.*)/[^/]*$#
!           or die "Can't parse ErrorLog directive\n";
!       $logfiledir=$1;
!     }
! 
!     unless ($logfiledir) {
!       $logfiledir='logs';
!     }
! 
      showmessage(getmessage('StartUpdateApache'), 'none');
        # to be polite about it: I don't think this should touch the main 
httpd.conf
--- 1145,1151 ----
  
  sub updateapacheconf {
!     my $logfiledir=$kohalogdir.'/logs';
      my $httpdconf = $etcdir."/koha-httpd.conf";
!    
      showmessage(getmessage('StartUpdateApache'), 'none');
        # to be polite about it: I don't think this should touch the main 
httpd.conf
***************
*** 1182,1187 ****
  
  # Ports to listen to for Koha
! $opaclisten
! $intranetlisten
  
  # NameVirtualHost is used by one of the optional configurations detailed below
--- 1186,1192 ----
  
  # Ports to listen to for Koha
! # uncomment these if they aren't already in main httpd.conf
! #$opaclisten
! #$intranetlisten
  
  # NameVirtualHost is used by one of the optional configurations detailed below
***************
*** 1198,1201 ****
--- 1203,1207 ----
     TransferLog $logfiledir/opac-access_log
     SetEnv PERL5LIB "$intranetdir/modules"
+    SetEnv KOHA_CONF "$etcdir/koha.conf"
     $includesdirectives
  </VirtualHost>
***************
*** 1463,1467 ****
      }
      # we must not put the mysql root password on the command line
!       $mysqlpass=     showmessage(getmessage('MysqlRootPassword'),'free');
        
        showmessage(getmessage('CreatingDatabase'),'none');
--- 1469,1473 ----
      }
      # we must not put the mysql root password on the command line
!       $mysqlpass=     
showmessage(getmessage('MysqlRootPassword'),'silentfree');
        
        showmessage(getmessage('CreatingDatabase'),'none');
***************
*** 1734,1737 ****
--- 1740,1759 ----
  
  END { }       # module clean-up code here (global destructor)
+ 
+ ### These things may move
+ 
+ sub setecho {
+ my $state=shift;
+ my $t = POSIX::Termios->new;
+ 
+ $t->getattr();
+ if ($state) {
+   $t->setlflag(($t->getlflag) | &POSIX::ECHO);
+   }
+ else {
+   $t->setlflag(($t->getlflag) & !(&POSIX::ECHO));
+   }
+ $t->setattr();
+ }
  
  sub setmysqlclipass {




reply via email to

[Prev in Thread] Current Thread [Next in Thread]