koha-cvs
[Top][All Lists]
Advanced

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

[Koha-cvs] CVS: koha Install.pm,1.1.2.1,1.1.2.2 installer.pl,1.2.2.60,1.


From: Steve Tonnesen
Subject: [Koha-cvs] CVS: koha Install.pm,1.1.2.1,1.1.2.2 installer.pl,1.2.2.60,1.2.2.61
Date: Wed, 24 Jul 2002 10:37:28 -0700

Update of /cvsroot/koha/koha
In directory usw-pr-cvs1:/tmp/cvs-serv4329

Modified Files:
      Tag: rel-1-2
        Install.pm installer.pl 
Log Message:
More work on modularizing the installation scripts.  Also adding more extensive
error checking.


Index: Install.pm
===================================================================
RCS file: /cvsroot/koha/koha/Attic/Install.pm,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -r1.1.2.1 -r1.1.2.2
*** Install.pm  23 Jul 2002 20:59:04 -0000      1.1.2.1
--- Install.pm  24 Jul 2002 17:37:26 -0000      1.1.2.2
***************
*** 16,19 ****
--- 16,21 ----
                &getinstallationdirectories
                &getdatabaseinfo
+               &getapacheinfo
+               &getapachevhostinfo
                );
  
***************
*** 90,93 ****
--- 92,104 ----
  %s
  |;
+ $messages->{'AllPerlModulesInstalled'}->{en}=qq|
+ 
+ ==============================
+ = ALL PERL MODULES INSTALLED =
+ ==============================
+ 
+ All mandatory perl modules are installed.
+ 
+ Press <ENTER> to continue: |;
  $messages->{'KohaVersionInstalled'}->{en}="You currently have Koha %s on your 
system.";
  $messages->{'KohaUnknownVersionInstalled'}->{en}="I am not able to determine 
what version of Koha is installed now.";
***************
*** 125,137 ****
  
  sub releasecandidatewarning {
!     my $language=shift;
!     my $kohaversion=shift;
!     my $message=getmessage('ReleaseCandidateWarning', $language, 
[$kohaversion, $kohaversion]);
      my $answer=showmessage($message, 'yn', 'n');
  
      if ($answer =~ /y/i) {
!       print getmessage('continuing', $language);
      } else {
!       my $message=getmessage('WatchForReleaseAnnouncements', $language);
        print $message;
        exit;
--- 136,146 ----
  
  sub releasecandidatewarning {
!     my $message=getmessage('ReleaseCandidateWarning', [$::kohaversion, 
$::kohaversion]);
      my $answer=showmessage($message, 'yn', 'n');
  
      if ($answer =~ /y/i) {
!       print getmessage('continuing');
      } else {
!       my $message=getmessage('WatchForReleaseAnnouncements');
        print $message;
        exit;
***************
*** 145,154 ****
  #
  sub checkperlmodules {
!     my $language=shift;
!     my $message = getmessage('CheckingPerlModules', $language);
      showmessage($message, 'none');
      
      unless (eval "require 5.6.0") {
!       die getmessage('PerlVersionFailure', $language, ['5.6.0']);
      }
  
--- 154,162 ----
  #
  sub checkperlmodules {
!     my $message = getmessage('CheckingPerlModules');
      showmessage($message, 'none');
      
      unless (eval "require 5.6.0") {
!       die getmessage('PerlVersionFailure', ['5.6.0']);
      }
  
***************
*** 159,163 ****
      unless (eval {require Set::Scalar})       { push @missing,"Set::Scalar" };
      unless (eval {require Net::Z3950})        { 
!       my $message = getmessage('NETZ3950Missing', $language);
        showmessage($message, 'PressEnter', '', 1);
        if ($#missing>=0) {
--- 167,171 ----
      unless (eval {require Set::Scalar})       { push @missing,"Set::Scalar" };
      unless (eval {require Net::Z3950})        { 
!       my $message = getmessage('NETZ3950Missing');
        showmessage($message, 'PressEnter', '', 1);
        if ($#missing>=0) {
***************
*** 175,181 ****
            $missing.="   perl -MCPAN -e 'install \"$module\"'\n";
        }
!       my $message=getmessage('MissingPerlModules', $language, [$missing]);
        showmessage($message, 'none');
        exit;
      }
  
--- 183,191 ----
            $missing.="   perl -MCPAN -e 'install \"$module\"'\n";
        }
!       my $message=getmessage('MissingPerlModules', [$missing]);
        showmessage($message, 'none');
        exit;
+     } else {
+       showmessage(getmessage('AllPerlModulesInstalled'), 'PressEnter', '', 1);
      }
  
***************
*** 186,192 ****
  sub getmessage {
      my $messagename=shift;
-     my $lang=shift;
      my $variables=shift;
!     my $message=$messages->{$messagename}->{$lang} || 
$messages->{$messagename}->{en} || "Error: No message named $messagename in 
Install.pm\n";
      if (defined($variables)) {
        $message=sprintf $message, @$variables;
--- 196,201 ----
  sub getmessage {
      my $messagename=shift;
      my $variables=shift;
!     my $message=$messages->{$messagename}->{$::language} || 
$messages->{$messagename}->{en} || "Error: No message named $messagename in 
Install.pm\n";
      if (defined($variables)) {
        $message=sprintf $message, @$variables;
***************
*** 208,216 ****
      SWITCH: {
        if ($responsetype =~/^restrictchar (.*)/i) {
            my $options=$1;
!           ($defaultresponse) || ($defaultresponse=substr($options,0,1));
!           my $response=<STDIN>;
!           chomp $response;
!           ($response) || ($response=$defaultresponse);
            return $response;
        }
--- 217,233 ----
      SWITCH: {
        if ($responsetype =~/^restrictchar (.*)/i) {
+           my $response='\0';
            my $options=$1;
!           until ($options=~/$response/) {
!               ($defaultresponse) || ($defaultresponse=substr($options,0,1));
!               $response=<STDIN>;
!               chomp $response;
!               (length($response)) || ($response=$defaultresponse);
!               unless ($options=~/$response/) {
!                   ($noclear) || (system('clear'));
!                   print "Invalid Response.  Choose from [$options].\n\n";
!                   print $message;
!               }
!           }
            return $response;
        }
***************
*** 233,237 ****
  
  sub getinstallationdirectories {
-     my $language=shift;
      my $opacdir = '/usr/local/koha/opac';
      my $intranetdir = '/usr/local/koha/intranet';
--- 250,253 ----
***************
*** 239,246 ****
      while ($getdirinfo) {
        # Loop until opac directory and koha directory are different
!       my $message=getmessage('GetOpacDir', $language, [$opacdir]);
        $opacdir=showmessage($message, 'free', $opacdir);
  
!       my $message=getmessage('GetIntranetDir', $language, [$intranetdir]);
        $intranetdir=showmessage($message, 'free', $intranetdir);
  
--- 255,262 ----
      while ($getdirinfo) {
        # Loop until opac directory and koha directory are different
!       my $message=getmessage('GetOpacDir', [$opacdir]);
        $opacdir=showmessage($message, 'free', $opacdir);
  
!       my $message=getmessage('GetIntranetDir', [$intranetdir]);
        $intranetdir=showmessage($message, 'free', $intranetdir);
  
***************
*** 310,341 ****
  
  sub getdatabaseinfo {
-     my ($language,$dbname,$hostname,$user,$pass)address@hidden;
  #Get the database name
  
!     my $message=getmessage('DatabaseName', $language, [$dbname]);
!     $dbname=showmessage($message, 'free', $dbname);
  
  #Get the hostname for the database
      
!     $message=getmessage('DatabaseHost', $language, [$hostname]);
!     $hostname=showmessage($message, 'free', $hostname);
  
  #Get the username for the database
  
!     $message=getmessage('DatabaseUser', $language, [$dbname, $hostname, 
$user]);
!     $user=showmessage($message, 'free', $user);
  
  #Get the password for the database user
  
!     while ($pass eq '') {
!       my $message=getmessage('DatabasePassword', $language, [$user]);
!       $pass=showmessage($message, 'free', $pass);
!       if ($pass eq '') {
!           my $message=getmessage('BlankPassword', $language);
            showmessage($message,'PressEnter');
        }
      }
-     return($dbname,$hostname,$user,$pass);
  }
  
  END { }       # module clean-up code here (global destructor)
--- 326,531 ----
  
  sub getdatabaseinfo {
  #Get the database name
  
!     my $message=getmessage('DatabaseName', [$::dbname]);
!     $::dbname=showmessage($message, 'free', $::dbname);
  
  #Get the hostname for the database
      
!     $message=getmessage('DatabaseHost', [$::hostname]);
!     $::hostname=showmessage($message, 'free', $::hostname);
  
  #Get the username for the database
  
!     $message=getmessage('DatabaseUser', [$::dbname, $::hostname, $::user]);
!     $::user=showmessage($message, 'free', $::user);
  
  #Get the password for the database user
  
!     while ($::pass eq '') {
!       my $message=getmessage('DatabasePassword', [$::user]);
!       $::pass=showmessage($message, 'free', $::pass);
!       if ($::pass eq '') {
!           my $message=getmessage('BlankPassword');
            showmessage($message,'PressEnter');
        }
      }
  }
+ 
+ 
+ 
+ $messages->{'FoundMultipleApacheConfFiles'}->{en}=qq|
+ ================================
+ = MULTIPLE APACHE CONFIG FILES =
+ ================================
+ 
+ I found more than one possible Apache configuration file:
+ 
+ %s
+ 
+ Choose the correct file [1]: |;
+ 
+ $messages->{'NoApacheConfFiles'}->{en}=qq|
+ ===============================
+ = NO APACHE CONFIG FILE FOUND =
+ ===============================
+ 
+ I was not able to find your Apache configuration file.
+ 
+ The file is usually called httpd.conf or apache.conf.
+ 
+ Please specify the location of your config file: |;
+ 
+ $messages->{'NotAFile'}->{en}=qq|
+ =======================
+ = FILE DOES NOT EXIST =
+ =======================
+ 
+ The file %s does not exist.
+ 
+ Please press <ENTER> to continue: |;
+ 
+ $messages->{'EnterApacheUser'}->{en}=qq|
+ ====================
+ = NEED APACHE USER =
+ ====================
+ 
+ I was not able to determine the user that Apache is running as.  This
+ information is necessary in order to set the access privileges correctly on
+ /etc/koha.conf.  This user should be set in one of the Apache configuration
+ files using the "User" directive.
+ 
+ Enter the Apache userid: |;
+ 
+ $messages->{'InvalidUserid'}->{en}=qq|
+ ==================
+ = INVALID USERID =
+ ==================
+ 
+ The userid %s is not a valid userid on this system.
+ 
+ Press <ENTER> to continue: |;
+ 
+ sub getapacheinfo {
+     my @confpossibilities;
+ 
+     foreach my $httpdconf (qw(/usr/local/apache/conf/httpd.conf
+                         /usr/local/etc/apache/httpd.conf
+                         /usr/local/etc/apache/apache.conf
+                         /var/www/conf/httpd.conf
+                         /etc/apache/conf/httpd.conf
+                         /etc/apache/conf/apache.conf
+                         /etc/apache-ssl/conf/apache.conf
+                         /etc/httpd/conf/httpd.conf
+                         /etc/httpd/httpd.conf)) {
+       if ( -f $httpdconf ) {
+           push @confpossibilities, $httpdconf;
+       }
+     }
+ 
+     if ($#confpossibilities==-1) {
+       my $message=getmessage('NoApacheConfFiles');
+       my $choice='';
+       until (-f $choice) {
+           $choice=showmessage($message, "free", 1);
+           unless (-f $choice) {
+               showmessage(getmessage('NotAFile', [$choice]),'PressEnter', '', 
1);
+           }
+       }
+     } elsif ($#confpossibilities>0) {
+       my $conffiles='';
+       my $counter=1;
+       my $options='';
+       foreach (@confpossibilities) {
+           $conffiles.="   $counter: $_\n";
+           $options.="$counter";
+           $counter++;
+       }
+       my $message=getmessage('FoundMultipleApacheConfFiles', [$conffiles]);
+       my $choice=showmessage($message, "restrictchar $options", 1);
+       $::realhttpdconf=$confpossibilities[$choice-1];
+     } else {
+       $::realhttpdconf=$confpossibilities[0];
+     }
+     open (HTTPDCONF, $::realhttpdconf) or warn "Insufficient privileges to 
open $::realhttpdconf for reading.\n";
+     while (<HTTPDCONF>) {
+       if (/^\s*User\s+"?([-\w]+)"?\s*$/) {
+           $::httpduser = $1;
+       }
+     }
+     close(HTTPDCONF);
+ 
+ 
+ 
+ 
+     unless ($::httpduser) {
+       my $message=getmessage('EnterApacheUser');
+       until (length($::httpduser) && getpwnam($::httpduser)) {
+           $::httpduser=showmessage($message, "free", '');
+           if (length($::httpduser)>0) {
+               unless (getpwnam($::httpduser)) {
+                   my $message=getmessage('InvalidUserid', [$::httpduser]);
+                   showmessage($message,'PressEnter');
+               }
+           } else {
+           }
+       }
+       print "AU: $::httpduser\n";
+     }
+     exit;
+ }
+ 
+ 
+ sub getapachevhostinfo {
+ 
+     my $svr_admin = "address@hidden::domainname";
+     my $servername=`hostname -f`;
+     chomp $servername;
+     my $opacport=80;
+     my $kohaport=8080;
+ 
+     print qq|
+ 
+ OPAC and KOHA/LIBRARIAN CONFIGURATION
+ =====================================
+ Koha needs to setup your Apache configuration file for the
+ OPAC and LIBRARIAN virtual hosts.  By default this installer
+ will do this by using one ip address and two different ports
+ for the virtual hosts.  There are other ways to set this up,
+ and the installer will leave comments in httpd.conf detailing
+ what these other options are.
+ 
+ Please enter the e-mail address for your webserver admin.
+ Usually $svr_admin
+ |;
+ 
+     print "Enter e-mail address [$svr_admin]:";
+       #$svr_admin = $input;
+ 
+ 
+     print qq|
+ 
+ 
+ Please enter the domain name or ip address of your computer.
+ |;
+       #$servername = $input;
+ 
+     print qq|
+ 
+ Please enter the port for your OPAC interface.
+ |;
+     print "Enter OPAC port [$opacport]:";
+       #$opacport = $input;
+ 
+     print qq|
+ 
+ Please enter the port for your Intranet/Librarian interface.
+ |;
+       #$kohaport = $input;
+ 
+ 
+ 
+ }
+ 
  
  END { }       # module clean-up code here (global destructor)

Index: installer.pl
===================================================================
RCS file: /cvsroot/koha/koha/installer.pl,v
retrieving revision 1.2.2.60
retrieving revision 1.2.2.61
diff -C2 -r1.2.2.60 -r1.2.2.61
*** installer.pl        23 Jul 2002 20:59:04 -0000      1.2.2.60
--- installer.pl        24 Jul 2002 17:37:26 -0000      1.2.2.61
***************
*** 7,11 ****
  
  
! my $language='en';
  
  if ($<) {
--- 7,11 ----
  
  
! $::language='en';
  
  if ($<) {
***************
*** 18,48 ****
  }
  
! my $kohaversion=`cat koha.version`;
! chomp $kohaversion;
  
  
! if ($kohaversion =~ /RC/) {
!     releasecandidatewarning($language, $kohaversion);
  }
  
  if (-e "/etc/koha.conf") {
!     my $installedversion=`grep kohaversion= /etc/koha.conf`;
!     chomp $installedversion;
!     $installedversion=~m/kohaversion=(.*)/;
!     $installedversion=$1;
!     if ($installedversion) {
!       $installedversion=getmessage('KohaVersionInstalled', $language, 
[$installedversion]);
      } else {
!       $installedversion=getmessage('KohaUnknownVersionInstalled', $language);
      }
  
!     my $message=getmessage('KohaAlreadyInstalled', $language, [$kohaversion, 
$installedversion]);
      showmessage($message, 'none');
      exit;
  }
  
! my $continuingmsg=getmessage('continuing', $language);
  
! my $message=getmessage('WelcomeToKohaInstaller', $language);
  my $answer=showmessage($message, 'yn');
  
--- 18,49 ----
  }
  
! $::kohaversion=`cat koha.version`;
! chomp $::kohaversion;
  
  
! if ($::kohaversion =~ /RC/) {
!     releasecandidatewarning();
  }
  
  if (-e "/etc/koha.conf") {
!     $::installedversion=`grep kohaversion= /etc/koha.conf`;
!     chomp $::installedversion;
!     $::installedversion=~m/kohaversion=(.*)/;
!     $::installedversion=$1;
!     my $installedversionmsg;
!     if ($::installedversion) {
!       $installedversionmsg=getmessage('KohaVersionInstalled', 
[$::installedversion]);
      } else {
!       $installedversionmsg=getmessage('KohaUnknownVersionInstalled');
      }
  
!     my $message=getmessage('KohaAlreadyInstalled', [$::kohaversion, 
$installedversionmsg]);
      showmessage($message, 'none');
      exit;
  }
  
! my $continuingmsg=getmessage('continuing');
  
! my $message=getmessage('WelcomeToKohaInstaller');
  my $answer=showmessage($message, 'yn');
  
***************
*** 61,236 ****
  
  my $input;
! my $domainname = `hostname -d`;
! chomp $domainname;
  
  
  # Check for missing Perl Modules
  
! checkperlmodules($language);
  
  
  # Ask for installation directories
  
! my ($opacdir, $intranetdir) = getinstallationdirectories($language);
  
  
  
  
! my $etcdir = '/etc';
  
  
  
! my $dbname = 'Koha';
! my $hostname = 'localhost';
! my $user = 'kohaadmin';
! my $pass = '';
  
  
! ($dbname, $hostname,$user, $pass) = 
getdatabaseinfo($language,$dbname,$hostname,$user,$pass);
  
- print qq|
- DBNAME:               $dbname
- HOSTNAME:     $hostname
- USER:         $user
- PASS:         $pass
- |;
- exit;
- 
- 
- 
- 
- my $httpduser;
- my $realhttpdconf;
- 
- foreach my $httpdconf (qw(/usr/local/apache/conf/httpd.conf
-                       /usr/local/etc/apache/httpd.conf
-                       /usr/local/etc/apache/apache.conf
-                       /var/www/conf/httpd.conf
-                       /etc/apache/conf/httpd.conf
-                       /etc/apache/conf/apache.conf
-                       /etc/apache-ssl/conf/apache.conf
-                       /etc/httpd/conf/httpd.conf
-                       /etc/httpd/httpd.conf)) {
-    if ( -f $httpdconf ) {
-             $realhttpdconf=$httpdconf;
-             open (HTTPDCONF, $httpdconf) or warn "Insufficient privileges to 
open $httpdconf for reading.\n";
-       while (<HTTPDCONF>) {
-          if (/^\s*User\s+"?([-\w]+)"?\s*$/) {
-             $httpduser = $1;
-          }
-       }
-       close(HTTPDCONF);
-    }
- }
- unless ($realhttpdconf) {
-     print qq|
- 
- I was not able to find your apache configuration file.  It is usually
- called httpd.conf or apache.conf.
- |;
-     print "Where is your Apache configuratin file? ";
-     chomp($input = <STDIN>);
- 
-     if ($input) {
-       $realhttpdconf = $input;
-     } else {
-       $realhttpdconf='';
-     }
-     if ( -f $realhttpdconf ) {
-       open (HTTPDCONF, $realhttpdconf) or warn "Insufficient privileges to 
open $realhttpdconf for reading.\n";
-       while (<HTTPDCONF>) {
-           if (/^\s*User\s+"?([-\w]+)"?\s*$/) {
-               $httpduser = $1;
-           }
-       }
-       close(HTTPDCONF);
-     }
- }
- 
- unless ($httpduser) {
-     print qq|
- 
- I was not able to determine the user that Apache is running as.  This
- information is necessary in order to set the access privileges correctly on
- /etc/koha.conf.  This user should be set in one of the Apache configuration
- files using the "User" directive.
- |;
-     print "What is your Apache user? ";
-     chomp($input = <STDIN>);
- 
-     if ($input) {
-       $httpduser = $input;
-     } else {
-       $httpduser='Undetermined';
-     }
- }
- 
- 
- #
- #SETUP opac
- #
- my $svr_admin = "address@hidden";
- my $servername=`hostname -f`;
- chomp $servername;
- my $opacport=80;
- my $kohaport=8080;
- 
- print qq|
- 
- OPAC and KOHA/LIBRARIAN CONFIGURATION
- =====================================
- Koha needs to setup your Apache configuration file for the
- OPAC and LIBRARIAN virtual hosts.  By default this installer
- will do this by using one ip address and two different ports
- for the virtual hosts.  There are other ways to set this up,
- and the installer will leave comments in httpd.conf detailing
- what these other options are.
- 
- Please enter the e-mail address for your webserver admin.
- Usually $svr_admin
- |;
- 
- print "Enter e-mail address [$svr_admin]:";
- chomp($input = <STDIN>);
- 
- if ($input) {
-   $svr_admin = $input;
- }
- 
- 
- print qq|
- 
- 
- Please enter the domain name or ip address of your computer.
- |;
- print "Enter server name/ip address [$servername]:";
- chomp($input = <STDIN>);
- 
- if ($input) {
-   $servername = $input;
- }
- 
- print qq|
- 
- Please enter the port for your OPAC interface.
- |;
- print "Enter OPAC port [$opacport]:";
- chomp($input = <STDIN>);
  
- if ($input) {
-   $opacport = $input;
- }
  
! print qq|
  
- Please enter the port for your Intranet/Librarian interface.
- |;
- print "Enter intranet port [$kohaport]:";
- chomp($input = <STDIN>);
  
! if ($input) {
!   $kohaport = $input;
! }
  
  
  #
--- 62,103 ----
  
  my $input;
! $::domainname = `hostname -d`;
! chomp $::domainname;
  
  
  # Check for missing Perl Modules
  
! checkperlmodules();
  
  
  # Ask for installation directories
  
! my ($opacdir, $intranetdir) = getinstallationdirectories();
  
  
  
  
! $::etcdir = '/etc';
  
  
  
! $::dbname = 'Koha';
! $::hostname = 'localhost';
! $::user = 'kohaadmin';
! $::pass = '';
  
  
! getdatabaseinfo();
  
  
  
! getapacheinfo();
  
  
! print "user: $::httpduser\n";
! print "conf:  $::realhttpdconf\n";
! exit;
  
+ getapachevhostinfo();
  
  #
***************
*** 239,243 ****
  #
  
! my $logfiledir=`grep ^ErrorLog $realhttpdconf`;
  chomp $logfiledir;
  
--- 106,110 ----
  #
  
! my $logfiledir=`grep ^ErrorLog $$::realhttpdconf`;
  chomp $logfiledir;
  
***************
*** 262,266 ****
  my $envmodule=0;
  my $includesmodule=0;
! open HC, $realhttpdconf;
  while (<HC>) {
      if (/^\s*#\s*LoadModule env_module /) {
--- 129,133 ----
  my $envmodule=0;
  my $includesmodule=0;
! open HC, $$::realhttpdconf;
  while (<HC>) {
      if (/^\s*#\s*LoadModule env_module /) {
***************
*** 281,287 ****
  my $apachebackupmade=0;
  if ($envmodule || $includesmodule) {
!     system("mv -f $realhttpdconf $realhttpdconf\.prekoha");
      $apachebackupmade=1;
!     open HC, ">$realhttpdconf";
      print HC $httpdconf;
      close HC;
--- 148,154 ----
  my $apachebackupmade=0;
  if ($envmodule || $includesmodule) {
!     system("mv -f $$::realhttpdconf $$::realhttpdconf\.prekoha");
      $apachebackupmade=1;
!     open HC, ">$$::realhttpdconf";
      print HC $httpdconf;
      close HC;
***************
*** 289,301 ****
  
  
! if (`grep 'VirtualHost $servername' $realhttpdconf`) {
!     print qq|
! $realhttpdconf appears to already have an entry for Koha
! Virtual Hosts.  You may need to edit $realhttpdconf
! if anything has changed since it was last set up.  This
! script will not attempt to modify an existing Koha apache
! configuration.
! 
! |;
      print "Press <ENTER> to continue...";
      <STDIN>;
--- 156,169 ----
  
  
! if (0) {
! #if (`grep 'VirtualHost $servername' $$::realhttpdconf`) {
! #    print qq|
! #$$::realhttpdconf appears to already have an entry for Koha
! #Virtual Hosts.  You may need to edit $$::realhttpdconf
! #if anything has changed since it was last set up.  This
! #script will not attempt to modify an existing Koha apache
! #configuration.
! #
! #|;
      print "Press <ENTER> to continue...";
      <STDIN>;
***************
*** 303,307 ****
  } else {
      unless ($apachebackupmade) {
!       system("cp -f $realhttpdconf $realhttpdconf\.prekoha");
      }
      my $includesdirectives='';
--- 171,175 ----
  } else {
      unless ($apachebackupmade) {
!       system("cp -f $$::realhttpdconf $$::realhttpdconf\.prekoha");
      }
      my $includesdirectives='';
***************
*** 310,362 ****
        $includesdirectives.="   AddHandler server-parsed .html\n";
      }
!     open(SITE,">>$realhttpdconf") or warn "Insufficient priveleges to open 
$realhttpdconf for writing.\n";
!     print SITE <<EOP
! 
! 
! # Ports to listen to for Koha
! Listen $opacport
! Listen $kohaport
! 
! # NameVirtualHost is used by one of the optional configurations detailed below
! 
! #NameVirtualHost 11.22.33.44
! 
! # KOHA's OPAC Configuration
! <VirtualHost $servername\:$opacport>
!    ServerAdmin $svr_admin
!    DocumentRoot $opacdir/htdocs
!    ServerName $servername
!    ScriptAlias /cgi-bin/koha/ $opacdir/cgi-bin/
!    ErrorLog $logfiledir/opac-error_log
!    TransferLog $logfiledir/opac-access_log
!    SetEnv PERL5LIB "$intranetdir/modules"
!    $includesdirectives
! </VirtualHost>
! 
! # KOHA's INTRANET Configuration
! <VirtualHost $servername\:$kohaport>
!    ServerAdmin $svr_admin
!    DocumentRoot $intranetdir/htdocs
!    ServerName $servername
!    ScriptAlias /cgi-bin/koha/ "$intranetdir/cgi-bin/"
!    ErrorLog $logfiledir/koha-error_log
!    TransferLog $logfiledir/koha-access_log
!    SetEnv PERL5LIB "$intranetdir/modules"
!    $includesdirectives
! </VirtualHost>
! 
! # If you want to use name based Virtual Hosting:
! #   1. remove the two Listen lines
! #   2. replace $servername\:$opacport wih your.opac.domain.name
! #   3. replace ServerName $servername wih ServerName your.opac.domain.name
! #   4. replace $servername\:$kohaport wih your intranet domain name
! #   5. replace ServerName $servername wih ServerName your.intranet.domain.name
! #
! # If you want to use NameVirtualHost'ing (using two names on one ip address):
! #   1.  Follow steps 1-5 above
! #   2.  Uncomment the NameVirtualHost line and set the correct ip address
! 
! EOP
! ;
  
  
--- 178,230 ----
        $includesdirectives.="   AddHandler server-parsed .html\n";
      }
!     open(SITE,">>$$::realhttpdconf") or warn "Insufficient priveleges to open 
$$::realhttpdconf for writing.\n";
! #    print SITE <<EOP
! #
! #
! ## Ports to listen to for Koha
! #Listen $opacport
! #Listen $kohaport
! #
! ## NameVirtualHost is used by one of the optional configurations detailed 
below
! #
! ##NameVirtualHost 11.22.33.44
! #
! ## KOHA's OPAC Configuration
! #<VirtualHost $servername\:$opacport>
! #   ServerAdmin $svr_admin
! #   DocumentRoot $opacdir/htdocs
! #   ServerName $servername
! #   ScriptAlias /cgi-bin/koha/ $opacdir/cgi-bin/
! #   ErrorLog $logfiledir/opac-error_log
! #   TransferLog $logfiledir/opac-access_log
! #   SetEnv PERL5LIB "$intranetdir/modules"
! #   $includesdirectives
! #</VirtualHost>
! #
! ## KOHA's INTRANET Configuration
! #<VirtualHost $servername\:$kohaport>
! #   ServerAdmin $svr_admin
! #   DocumentRoot $intranetdir/htdocs
! #   ServerName $servername
! #   ScriptAlias /cgi-bin/koha/ "$intranetdir/cgi-bin/"
! #   ErrorLog $logfiledir/koha-error_log
! #   TransferLog $logfiledir/koha-access_log
! #   SetEnv PERL5LIB "$intranetdir/modules"
! #   $includesdirectives
! #</VirtualHost>
! #
! ## If you want to use name based Virtual Hosting:
! ##   1. remove the two Listen lines
! ##   2. replace $servername\:$opacport wih your.opac.domain.name
! ##   3. replace ServerName $servername wih ServerName your.opac.domain.name
! ##   4. replace $servername\:$kohaport wih your intranet domain name
! ##   5. replace ServerName $servername wih ServerName 
your.intranet.domain.name
! ##
! ## If you want to use NameVirtualHost'ing (using two names on one ip address):
! ##   1.  Follow steps 1-5 above
! ##   2.  Uncomment the NameVirtualHost line and set the correct ip address
! #
! #EOP
! #;
  
  
***************
*** 463,467 ****
        }
     }
!    chown (oct(0), (getgrnam($httpduser))[2], "$intranetdir");
     chmod (oct(770), "$intranetdir");
  }
--- 331,335 ----
        }
     }
!    chown (oct(0), (getgrnam($::httpduser))[2], "$intranetdir");
     chmod (oct(770), "$intranetdir");
  }
***************
*** 495,499 ****
        }
     }
!    chown (oct(0), (getgrnam($httpduser))[2], "$opacdir");
     chmod (oct(770), "$opacdir");
  }
--- 363,367 ----
        }
     }
!    chown (oct(0), (getgrnam($::httpduser))[2], "$opacdir");
     chmod (oct(770), "$opacdir");
  }
***************
*** 524,529 ****
  system("cp -R opac-cgi/* $opacdir/cgi-bin/");
  
! system("chown -R root.$httpduser $opacdir");
! system("chown -R root.$httpduser $intranetdir");
  
  
--- 392,397 ----
  system("cp -R opac-cgi/* $opacdir/cgi-bin/");
  
! system("chown -R root.$::httpduser $opacdir");
! system("chown -R root.$::httpduser $intranetdir");
  
  
***************
*** 538,554 ****
  
  #Create the configuration file
! open(SITES,">$etcdir/koha.conf") or warn "Couldn't create file
! at $etcdir.  Must have write capability.\n";
  print SITES <<EOP
! database=$dbname
! hostname=$hostname
! user=$user
! pass=$pass
  includes=$intranetdir/htdocs/includes
  intranetdir=$intranetdir
  opacdir=$opacdir
  kohalogdir=$kohalogdir
! kohaversion=$kohaversion
! httpduser=$httpduser
  EOP
  ;
--- 406,422 ----
  
  #Create the configuration file
! open(SITES,">$::etcdir/koha.conf") or warn "Couldn't create file
! at $::etcdir.  Must have write capability.\n";
  print SITES <<EOP
! database=$::dbname
! hostname=$::hostname
! user=$::user
! pass=$::pass
  includes=$intranetdir/htdocs/includes
  intranetdir=$intranetdir
  opacdir=$opacdir
  kohalogdir=$kohalogdir
! kohaversion=$::kohaversion
! httpduser=$::httpduser
  EOP
  ;
***************
*** 558,563 ****
  # Set ownership of the koha.conf file for security
  #
! chown((getpwnam($httpduser)) [2,3], "$etcdir/koha.conf") or warn "can't chown 
koha.conf: $!";
! chmod 0440, "$etcdir/koha.conf";
  
  
--- 426,431 ----
  # Set ownership of the koha.conf file for security
  #
! chown((getpwnam($::httpduser)) [2,3], "$::etcdir/koha.conf") or warn "can't 
chown koha.conf: $!";
! chmod 0440, "$::etcdir/koha.conf";
  
  
***************
*** 608,612 ****
  =================
  |;
! my $result=system("$mysqldir/bin/mysqladmin -u$mysqluser -p$mysqlpass create 
$dbname");
  if ($result) {
      print "\nCouldn't connect to the MySQL server for the reason given 
above.\n";
--- 476,480 ----
  =================
  |;
! my $result=system("$mysqldir/bin/mysqladmin -u$mysqluser -p$mysqlpass create 
$::dbname");
  if ($result) {
      print "\nCouldn't connect to the MySQL server for the reason given 
above.\n";
***************
*** 616,622 ****
      print "\n";
  } else {
!     system("$mysqldir/bin/mysql -u$mysqluser -p$mysqlpass $dbname < 
koha.mysql");
!     system("$mysqldir/bin/mysql -u$mysqluser -p$mysqlpass mysql -e \"insert 
into user (Host,User,Password) values 
('$hostname','$user',password('$pass'))\"\;");
!     system("$mysqldir/bin/mysql -u$mysqluser -p$mysqlpass mysql -e \"insert 
into db 
(Host,Db,User,Select_priv,Insert_priv,Update_priv,Delete_priv,Create_priv,Drop_priv,
 index_priv, alter_priv) values 
('%','$dbname','$user','Y','Y','Y','Y','Y','Y','Y','Y')\"");
      system("$mysqldir/bin/mysqladmin -u$mysqluser -p$mysqlpass reload");
  
--- 484,490 ----
      print "\n";
  } else {
!     system("$mysqldir/bin/mysql -u$mysqluser -p$mysqlpass $::dbname < 
koha.mysql");
!     system("$mysqldir/bin/mysql -u$mysqluser -p$mysqlpass mysql -e \"insert 
into user (Host,User,Password) values 
('$::hostname','$::user',password('$::pass'))\"\;");
!     system("$mysqldir/bin/mysql -u$mysqluser -p$mysqlpass mysql -e \"insert 
into db 
(Host,Db,User,Select_priv,Insert_priv,Update_priv,Delete_priv,Create_priv,Drop_priv,
 index_priv, alter_priv) values 
('%','$::dbname','$::user','Y','Y','Y','Y','Y','Y','Y','Y')\"");
      system("$mysqldir/bin/mysqladmin -u$mysqluser -p$mysqlpass reload");
  
***************
*** 638,645 ****
      if ($input =~/^y/i) {
        system("gunzip sampledata-1.2.gz");
!       system("cat sampledata-1.2 | $mysqldir/bin/mysql -u$mysqluser 
-p$mysqlpass $dbname");
        system("gzip -9 sampledata-1.2");
!       system("$mysqldir/bin/mysql -u$mysqluser -p$mysqlpass $dbname -e 
\"insert into branches (branchcode,branchname,issuing) values ('MAIN', 'Main 
Library', 1)\"");
!       system("$mysqldir/bin/mysql -u$mysqluser -p$mysqlpass $dbname -e 
\"insert into printers (printername,printqueue,printtype) values ('Circulation 
Desk Printer', 'lp', 'hp')\"");
        print qq|
  
--- 506,513 ----
      if ($input =~/^y/i) {
        system("gunzip sampledata-1.2.gz");
!       system("cat sampledata-1.2 | $mysqldir/bin/mysql -u$mysqluser 
-p$mysqlpass $::dbname");
        system("gzip -9 sampledata-1.2");
!       system("$mysqldir/bin/mysql -u$mysqluser -p$mysqlpass $::dbname -e 
\"insert into branches (branchcode,branchname,issuing) values ('MAIN', 'Main 
Library', 1)\"");
!       system("$mysqldir/bin/mysql -u$mysqluser -p$mysqlpass $::dbname -e 
\"insert into printers (printername,printqueue,printtype) values ('Circulation 
Desk Printer', 'lp', 'hp')\"");
        print qq|
  
***************
*** 684,688 ****
            $branchcode=substr($branchcode,0,4);
            print "Adding branch '$branch' with code '$branchcode'.\n";
!           system("$mysqldir/bin/mysql -u$mysqluser -p$mysqlpass $dbname -e 
\"insert into branches (branchcode,branchname,issuing) values ('$branchcode', 
'$branch', 1)\"");
            my $printername='Library Printer';
            print "Enter a name for the printer [$printername]: ";
--- 552,556 ----
            $branchcode=substr($branchcode,0,4);
            print "Adding branch '$branch' with code '$branchcode'.\n";
!           system("$mysqldir/bin/mysql -u$mysqluser -p$mysqlpass $::dbname -e 
\"insert into branches (branchcode,branchname,issuing) values ('$branchcode', 
'$branch', 1)\"");
            my $printername='Library Printer';
            print "Enter a name for the printer [$printername]: ";
***************
*** 699,703 ****
            }
            $printerqueue=~s/[^A-Za-z0-9]//g;
!           system("$mysqldir/bin/mysql -u$mysqluser -p$mysqlpass $dbname -e 
\"insert into printers (printername,printqueue,printtype) values 
('$printername', '$printerqueue', '')\"");
        }
      }
--- 567,571 ----
            }
            $printerqueue=~s/[^A-Za-z0-9]//g;
!           system("$mysqldir/bin/mysql -u$mysqluser -p$mysqlpass $::dbname -e 
\"insert into printers (printername,printqueue,printtype) values 
('$printername', '$printerqueue', '')\"");
        }
      }
***************
*** 708,712 ****
  
  chmod 0770, $kohalogdir;
! chown((getpwnam($httpduser)) [2,3], $kohalogdir) or warn "can't chown 
$kohalogdir: $!";
  
  # LAUNCH SCRIPT
--- 576,580 ----
  
  chmod 0770, $kohalogdir;
! chown((getpwnam($::httpduser)) [2,3], $kohalogdir) or warn "can't chown 
$kohalogdir: $!";
  
  # LAUNCH SCRIPT
***************
*** 716,720 ****
  while (<L>) {
      if (/^RunAsUser=/) {
!       $newfile.="RunAsUser=$httpduser\n";
      } elsif (/^KohaZ3950Dir=/) {
        $newfile.="KohaZ3950Dir=$intranetdir/scripts/z3950daemon\n";
--- 584,588 ----
  while (<L>) {
      if (/^RunAsUser=/) {
!       $newfile.="RunAsUser=$::httpduser\n";
      } elsif (/^KohaZ3950Dir=/) {
        $newfile.="KohaZ3950Dir=$intranetdir/scripts/z3950daemon\n";
***************
*** 754,759 ****
  chmod 0750, "$intranetdir/scripts/z3950daemon/z3950-daemon-shell.sh";
  chmod 0750, "$intranetdir/scripts/z3950daemon/processz3950queue";
! chown(0, (getpwnam($httpduser)) [3], 
"$intranetdir/scripts/z3950daemon/z3950-daemon-shell.sh") or warn "can't chown 
$intranetdir/scripts/z3950daemon/z3950-daemon-shell.sh: $!";
! chown(0, (getpwnam($httpduser)) [3], 
"$intranetdir/scripts/z3950daemon/processz3950queue") or warn "can't chown 
$intranetdir/scripts/z3950daemon/processz3950queue: $!";
  
  print qq|
--- 622,627 ----
  chmod 0750, "$intranetdir/scripts/z3950daemon/z3950-daemon-shell.sh";
  chmod 0750, "$intranetdir/scripts/z3950daemon/processz3950queue";
! chown(0, (getpwnam($::httpduser)) [3], 
"$intranetdir/scripts/z3950daemon/z3950-daemon-shell.sh") or warn "can't chown 
$intranetdir/scripts/z3950daemon/z3950-daemon-shell.sh: $!";
! chown(0, (getpwnam($::httpduser)) [3], 
"$intranetdir/scripts/z3950daemon/processz3950queue") or warn "can't chown 
$intranetdir/scripts/z3950daemon/processz3950queue: $!";
  
  print qq|
***************
*** 778,803 ****
  #RESTART APACHE
  print "\n\n";
! print qq|
! 
! COMPLETED
! =========
! Congratulations ... your Koha installation is almost complete!
! The final step is to restart your webserver.
! 
! You will be able to connect to your Librarian interface at:
! 
!    http://$servername\:$kohaport/
! 
! and the OPAC interface at :
! 
!    http://$servername\:$opacport/
! 
! 
! Be sure to read the INSTALL, and Hints files. 
! 
! For more information visit http://www.koha.org
! 
! Would you like to restart your webserver now? (Y/[N]):
! |;
  
  my $restart = <STDIN>;
--- 646,671 ----
  #RESTART APACHE
  print "\n\n";
! #print qq|
! #
! #COMPLETED
! #=========
! #Congratulations ... your Koha installation is almost complete!
! #The final step is to restart your webserver.
! #
! #You will be able to connect to your Librarian interface at:
! #
! #   http://$servername\:$kohaport/
! #
! #and the OPAC interface at :
! #
! #   http://$servername\:$opacport/
! #
! #
! #Be sure to read the INSTALL, and Hints files. 
! #
! #For more information visit http://www.koha.org
! #
! #Would you like to restart your webserver now? (Y/[N]):
! #|;
  
  my $restart = <STDIN>;




reply via email to

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