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

Steve Tonnesen tonnesen at users.sourceforge.net
Tue Jul 23 22:59:06 CEST 2002


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

Modified Files:
      Tag: rel-1-2
	installer.pl 
Added Files:
      Tag: rel-1-2
	Install.pm 
Log Message:
Creating a separate Install.pm module that will be shared by installer.pl and
koha.upgrade.  Also providing for eventual translation of messages in the
installer and upgrader tools.


--- NEW FILE ---
package Install; #assumes Install.pm

use strict;
require Exporter;

use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);

# set the version for version checking
$VERSION = 0.01;

@ISA = qw(Exporter);
@EXPORT = qw(	&checkperlmodules
		&getmessage
		&showmessage
		&releasecandidatewarning
		&getinstallationdirectories
		&getdatabaseinfo
		);


my $messages;
$messages->{'continuing'}->{en}="Great!  Continuing setup.\n\n";
$messages->{'WelcomeToKohaInstaller'}->{en}=qq|
=================================
= Welcome to the Koha Installer =
=================================

Welcome to the Koha install script!  This script will prompt you for some
basic information about your desired setup, then install Koha according to
your specifications.  To accept the default value for any question, simply hit
Enter at the prompt.

Please be sure to read the documentation, or visit the Koha website at 
http://www.koha.org for more information.

Are you ready to begin the installation? (Y/[N]): |;
$messages->{'ReleaseCandidateWarning'}->{en}=qq|
=====================
= RELEASE CANDIDATE =
=====================

WARNING WARNING WARNING WARNING WARNING

You are about to install Koha version %s.  This version of Koha is a
release candidate.  It is not intended to be installed on production systems.
It is being released so that users can test it before we release a final
version.

Are you sure you want to install Koha %s? (Y/[N]): |;
$messages->{'WatchForReleaseAnnouncements'}->{en}=qq|

Watch for announcements of Koha releases on the Koha mailing list or the Koha
web site (http://www.koha.org/).

|;

$messages->{'NETZ3950Missing'}->{en}=qq|

The Net::Z3950 module is missing.  This module is necessary if you want to use
Koha's Z39.50 client to download bibliographic records from other libraries.
To install this module, you will need the yaz client installed from
http://www.indexdata.dk/yaz/ and then you can install the perl module with the
command:

perl -MCPAN -e 'install Net::Z3950'

Press the <ENTER> key to continue: |;

$messages->{'CheckingPerlModules'}->{en}=qq|

==================
= PERL & MODULES =
==================

Checking perl modules ...
|;

$messages->{'PerlVersionFailure'}->{en}="Sorry, you need at least Perl %s\n";

$messages->{'MissingPerlModules'}->{en}=qq|

========================
= MISSING PERL MODULES =
========================

You are missing some Perl modules which are required by Koha.
Once these modules have been installed, rerun this installer.
They can be installed by running (as root) the following:

%s
|;
$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.";
$messages->{'KohaAlreadyInstalled'}->{en}=qq|
==========================
= Koha already installed =
==========================

It looks like Koha is already installed on your system (/etc/koha.conf exists
already).  If you would like to upgrade your system to %s, please use
the koha.upgrade script in this directory.

%s

|;
$messages->{'GetOpacDir'}->{en}=qq|
==================
= OPAC DIRECTORY =
==================

Please supply the directory you want Koha to store its OPAC files in.  This
directory will be auto-created for you if it doesn't exist.

OPAC Directory [%s]: |;

$messages->{'GetIntranetDir'}->{en}=qq|
=================================
= INTRANET/LIBRARIANS DIRECTORY =
=================================

Please supply the directory you want Koha to store its Intranet/Librarians
files in.  This directory will be auto-created for you if it doesn't exist.

Intranet Directory [%s]: |;

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;
    };
}


#
# Test for Perl and Modules
#
#
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']);
    }

    my @missing = ();
    unless (eval {require DBI})               { push @missing,"DBI" };
    unless (eval {require Date::Manip})       { push @missing,"Date::Manip" };
    unless (eval {require DBD::mysql})        { push @missing,"DBD::mysql" };
    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) {
	    push @missing, "Net::Z3950";
	}
    }

#
# Print out a list of any missing modules
#

    if (@missing > 0) {
	my $missing='';
	foreach my $module (@missing) {
	    $missing.="   perl -MCPAN -e 'install \"$module\"'\n";
	}
	my $message=getmessage('MissingPerlModules', $language, [$missing]);
	showmessage($message, 'none');
	exit;
    }


}


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;
    }
    return $message;
}


sub showmessage {
    my $message=shift;
    my $responsetype=shift;
    my $defaultresponse=shift;
    my $noclear=shift;
    ($noclear) || (system('clear'));
    if ($responsetype =~ /^yn$/) {
	$responsetype='restrictchar yn';
    }
    print $message;
    SWITCH: {
	if ($responsetype =~/^restrictchar (.*)/i) {
	    my $options=$1;
	    ($defaultresponse) || ($defaultresponse=substr($options,0,1));
	    my $response=<STDIN>;
	    chomp $response;
	    ($response) || ($response=$defaultresponse);
	    return $response;
	}
	if ($responsetype =~/^free$/i) {
	    (defined($defaultresponse)) || ($defaultresponse='');
	    my $response=<STDIN>;
	    chomp $response;
	    ($response) || ($response=$defaultresponse);
	    return $response;
	}
	if ($responsetype =~/^PressEnter$/i) {
	    <STDIN>;
	    return;
	}
	if ($responsetype =~/^none$/i) {
	    return;
	}
    }
}

sub getinstallationdirectories {
    my $language=shift;
    my $opacdir = '/usr/local/koha/opac';
    my $intranetdir = '/usr/local/koha/intranet';
    my $getdirinfo=1;
    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);

	if ($intranetdir eq $opacdir) {
	    print qq|

You must specify different directories for the OPAC and INTRANET files!
 :: $intranetdir :: $opacdir ::
|;
<STDIN>
	} else {
	    $getdirinfo=0;
	}
    }
    return ($opacdir, $intranetdir);
}



$messages->{'DatabaseName'}->{en}=qq|
==========================
= Name of MySQL database =
==========================

Please provide the name of the mysql database for your koha installation.

Database name [%s]: |;

$messages->{'DatabaseHost'}->{en}=qq|
=================
= Database Host =
=================

Please provide the hostname for mysql.  Unless the database is located on
another machine this will be "localhost".

Database host [%s]: |;

$messages->{'DatabaseUser'}->{en}=qq|
=================
= Database User =
=================

Please provide the name of the user, who will have full administrative rights
to the %s database, when authenticating from %s.

Database user [%s]: |;

$messages->{'DatabasePassword'}->{en}=qq|
=====================
= Database Password =
=====================

Please provide a good password for the user %s.

Database Password: |;

$messages->{'BlankPassword'}->{en}=qq|
==================
= BLANK PASSWORD =
==================

You must not use a blank password for your MySQL user!

Press <ENTER> to try again: 
|;

sub getdatabaseinfo {
    my ($language,$dbname,$hostname,$user,$pass)=@_;
#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)


Index: installer.pl
===================================================================
RCS file: /cvsroot/koha/koha/installer.pl,v
retrieving revision 1.2.2.59
retrieving revision 1.2.2.60
diff -C2 -r1.2.2.59 -r1.2.2.60
*** installer.pl	23 Jul 2002 06:05:26 -0000	1.2.2.59
--- installer.pl	23 Jul 2002 20:59:04 -0000	1.2.2.60
***************
*** 2,7 ****
--- 2,12 ----
  
  #use diagnostics;
+ 
+ use Install;
  use strict; # please develop with the strict pragma
  
+ 
+ my $language='en';
+ 
  if ($<) {
      print "\n\nYou must run koha.upgrade as root.\n\n";
***************
*** 18,50 ****
  
  if ($kohaversion =~ /RC/) {
!     print qq|
! =====================
! = RELEASE CANDIDATE =
! =====================
! 
! WARNING WARNING WARNING WARNING WARNING
! 
! You are about to install Koha version $kohaversion.  This version of Koha is a
! release candidate.  It is not intended to be installed on production systems.
! It is being released so that users can test it before we release a final
! version.
! 
! |;
!     print "Are you sure you want to install Koha $kohaversion? (Y/[N]): ";
! 
!     my $answer = <STDIN>;
!     chomp $answer;
! 
!     if ($answer eq "Y" || $answer eq "y") {
! 	print "Great! continuing setup... \n";
!     } else {
! 	print qq|
! 
! Watch for announcements of Koha releases on the Koha mailing list or the Koha
! web site (http://www.koha.org/).
! 
! |;
! 	exit;
!     };
  }
  
--- 23,27 ----
  
  if ($kohaversion =~ /RC/) {
!     releasecandidatewarning($language, $kohaversion);
  }
  
***************
*** 55,99 ****
      $installedversion=$1;
      if ($installedversion) {
! 	$installedversion="You currently have Koha $installedversion on your system.\n";
      } else {
! 	$installedversion="I am not able to determine what version of Koha is installed now.\n";
      }
  
!     print qq|
! 			==========================
! 			= Koha already installed =
! 			==========================
! 
! It looks like Koha is already installed on your system (/etc/koha.conf exists
! already).  If you would like to upgrade your system to $kohaversion, please use
! the koha.upgrade script in this directory.
! 
! $installedversion
! 
! |;
      exit;
  }
  
! system('clear');
! print qq|
! **********************************
! * Welcome to the Koha Installer  *
! **********************************
! Welcome to the Koha install script!  This script will prompt you for some
! basic information about your desired setup, then install Koha according to
! your specifications.  To accept the default value for any question, simply hit
! Enter at the prompt.
! 
! Please be sure to read the documentation, or visit the Koha website at 
! http://www.koha.org for more information.
! 
! Are you ready to begin the installation? (Y/[N]):
! |;
  
! my $answer = <STDIN>;
! chomp $answer;
  
  if ($answer eq "Y" || $answer eq "y") {
! 	print "Great! continuing setup... \n";
      } else {
      print qq|
--- 32,52 ----
      $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');
  
  if ($answer eq "Y" || $answer eq "y") {
! 	print $continuingmsg;
      } else {
      print qq|
***************
*** 107,223 ****
  };
  
- print "\n";
- 
- #
- # Test for Perl and Modules
- #
- print qq|
- 
- PERL & MODULES
- ==============
- 
- |;
- 
- print "\nChecking perl modules ...\n";
-     unless (eval "require 5.004") {
-     die "Sorry, you need at least Perl 5.004\n";
- }
- 
- my @missing = ();
- unless (eval {require DBI})               { push @missing,"DBI" };
- unless (eval {require Date::Manip})       { push @missing,"Date::Manip" };
- unless (eval {require DBD::mysql})        { push @missing,"DBD::mysql" };
- unless (eval {require Set::Scalar})       { push @missing,"Set::Scalar" };
- unless (eval {require Net::Z3950})        { 
-     print qq|
- 
- The Net::Z3950 module is missing.  This module is necessary if you want to use
- Koha's Z39.50 client to download bibliographic records from other libraries.
- To install this module, you will need the yaz client installed from
- http://www.indexdata.dk/yaz/ and then you can install the perl module with the
- command:
- 
- perl -MCPAN -e 'install Net::Z3950'
- 
- Press the <ENTER> key to continue:
- |;
-     <STDIN>;
- }
- 
- #
- # Print out a list of any missing modules
- #
- if (@missing > 0) {
-     print "\n\n";
-     print "You are missing some Perl modules which are required by Koha.\n";
-     print "Once these modules have been installed, rerun this installer.\n";
-     print "They can be installed by running (as root) the following:\n";
-     foreach my $module (@missing) {
- 	print "   perl -MCPAN -e 'install \"$module\"'\n";
- 	exit(1);
-     }} else{
-     print "All modules appear to be installed, continuing...\n";
- };
- 
- 
- print "\n";
  my $input;
  my $domainname = `hostname -d`;
  chomp $domainname;
- my $opacdir = '/usr/local/koha/opac';
- my $kohadir = '/usr/local/koha/intranet';
- my $getdirinfo=1;
- while ($getdirinfo) {
-     # Loop until opac directory and koha directory are different
-     print qq|
  
- OPAC DIRECTORY
- ==============
- Please supply the directory you want Koha to store its OPAC files in.  Leave off
- the trailing slash.  This directory will be auto-created for you if it doesn't
- exist.
  
! Usually $opacdir
! |;
  
!     print "Enter directory [$opacdir]: ";
!     chomp($input = <STDIN>);
  
-     if ($input) {
-       $opacdir = $input;
-     }
  
  
!     print qq|
  
- INTRANET/LIBRARIANS DIRECTORY
- =============================
- Please supply the directory you want Koha to store its Intranet/Librarians files 
- in.  Leave off the trailing slash.  This directory will be auto-created for you if 
- it doesn't exist.
  
- |;
  
-     print "Enter directory [$kohadir]: ";
-     chomp($input = <STDIN>);
  
!     if ($input) {
!       $kohadir = $input;
!     }
!     if ($kohadir eq $opacdir) {
! 	print qq|
  
- You must specify different directories for the OPAC and INTRANET files!
  
- |;
-     } else {
- 	$getdirinfo=0;
-     }
- }
  
- #
- #KOHA conf
- #
- my $etcdir = '/etc';
  my $dbname = 'Koha';
  my $hostname = 'localhost';
--- 60,84 ----
  };
  
  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';
***************
*** 225,310 ****
  my $pass = '';
  
- print qq|
- 
- KOHA.CONF
- =========
- Koha uses a small configuration file that is placed in your /etc/ files
- directory. The configuration file, will be created in this directory.
- 
- |;
- 
- #Get the path to the koha.conf directory
- #print "Enter the path to your configuration directory [$etcdir]: ";
- #chomp($input = <STDIN>);
- #
- #if ($input) {
- #  $etcdir = $input;
- #}
  
  
- #Get the database name
  print qq|
! 
! Please provide the name of the mysql database for your koha installation.
! This is normally "$dbname".
! 
  |;
  
- print "Enter database name [$dbname]: ";
- chomp($input = <STDIN>);
- 
- if ($input) {
-   $dbname = $input;
- }
  
  
- #Get the hostname for the database
- print qq|
- 
- Please provide the hostname for mysql.  Unless the database is located on another 
- machine this will be "localhost".
- |;
- 
- print "Enter hostname [$hostname]: ";
- chomp($input = <STDIN>);
- 
- if ($input) {
-   $hostname = $input;
- }
- 
- #Get the username for the database
- print qq|
- 
- Please provide the name of the user, who will have full administrative rights
- to the $dbname database, when authenticating from $hostname.
- 
- If no user is entered it will default to $user.
- |;
- 
- print "Enter username [$user]:";
- chomp($input = <STDIN>);
- 
- if ($input) {
-   $user = $input;
- }
- 
- #Get the password for the database user
- print qq|
- 
- Please provide a good password for the user $user.
- |;
- 
- print "Enter password:";
- chomp($input = <STDIN>);
- 
- if ($input) {
-   $pass = $input;
- }
- 
- print "\n";
- 
- 
- 
- print "Successfully created the Koha configuration file.\n";
  
  my $httpduser;
--- 86,102 ----
  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;
***************
*** 538,542 ****
     ErrorLog $logfiledir/opac-error_log
     TransferLog $logfiledir/opac-access_log
!    SetEnv PERL5LIB "$kohadir/modules"
     $includesdirectives
  </VirtualHost>
--- 330,334 ----
     ErrorLog $logfiledir/opac-error_log
     TransferLog $logfiledir/opac-access_log
!    SetEnv PERL5LIB "$intranetdir/modules"
     $includesdirectives
  </VirtualHost>
***************
*** 545,554 ****
  <VirtualHost $servername\:$kohaport>
     ServerAdmin $svr_admin
!    DocumentRoot $kohadir/htdocs
     ServerName $servername
!    ScriptAlias /cgi-bin/koha/ "$kohadir/cgi-bin/"
     ErrorLog $logfiledir/koha-error_log
     TransferLog $logfiledir/koha-access_log
!    SetEnv PERL5LIB "$kohadir/modules"
     $includesdirectives
  </VirtualHost>
--- 337,346 ----
  <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>
***************
*** 606,610 ****
      print SITE <<EOP
  
! <Directory $kohadir>
      AuthUserFile /etc/kohaintranet.pass
      AuthType Basic
--- 398,402 ----
      print SITE <<EOP
  
! <Directory $intranetdir>
      AuthUserFile /etc/kohaintranet.pass
      AuthType Basic
***************
*** 658,666 ****
  
  
! unless ( -d $kohadir ) {
!    print "Creating $kohadir...\n";
!    my $result=mkdir ($kohadir, oct(770));
     if ($result==0) {
!        my @dirs = split(m#/#, $kohadir);
  	my $checkdir='';
  	foreach (@dirs) {
--- 450,458 ----
  
  
! unless ( -d $intranetdir ) {
!    print "Creating $intranetdir...\n";
!    my $result=mkdir ($intranetdir, oct(770));
     if ($result==0) {
!        my @dirs = split(m#/#, $intranetdir);
  	my $checkdir='';
  	foreach (@dirs) {
***************
*** 671,692 ****
  	}
     }
!    chown (oct(0), (getgrnam($httpduser))[2], "$kohadir");
!    chmod (oct(770), "$kohadir");
  }
! unless ( -d "$kohadir/htdocs" ) {
!    print "Creating $kohadir/htdocs...\n";
!    mkdir ("$kohadir/htdocs", oct(750));
! }
! unless ( -d "$kohadir/cgi-bin" ) {
!    print "Creating $kohadir/cgi-bin...\n";
!    mkdir ("$kohadir/cgi-bin", oct(750));
! }
! unless ( -d "$kohadir/modules" ) {
!    print "Creating $kohadir/modules...\n";
!    mkdir ("$kohadir/modules", oct(750));
! }
! unless ( -d "$kohadir/scripts" ) {
!    print "Creating $kohadir/scripts...\n";
!    mkdir ("$kohadir/scripts", oct(750));
  }
  unless ( -d $opacdir ) {
--- 463,484 ----
  	}
     }
!    chown (oct(0), (getgrnam($httpduser))[2], "$intranetdir");
!    chmod (oct(770), "$intranetdir");
  }
! unless ( -d "$intranetdir/htdocs" ) {
!    print "Creating $intranetdir/htdocs...\n";
!    mkdir ("$intranetdir/htdocs", oct(750));
! }
! unless ( -d "$intranetdir/cgi-bin" ) {
!    print "Creating $intranetdir/cgi-bin...\n";
!    mkdir ("$intranetdir/cgi-bin", oct(750));
! }
! unless ( -d "$intranetdir/modules" ) {
!    print "Creating $intranetdir/modules...\n";
!    mkdir ("$intranetdir/modules", oct(750));
! }
! unless ( -d "$intranetdir/scripts" ) {
!    print "Creating $intranetdir/scripts...\n";
!    mkdir ("$intranetdir/scripts", oct(750));
  }
  unless ( -d $opacdir ) {
***************
*** 719,730 ****
  print "\n\nINSTALLING KOHA...\n";
  print "\n\n==================\n";
! print "Copying internet-html files to $kohadir/htdocs...\n";
! system("cp -R intranet-html/* $kohadir/htdocs/");
! print "Copying intranet-cgi files to $kohadir/cgi-bin...\n";
! system("cp -R intranet-cgi/* $kohadir/cgi-bin/");
! print "Copying script files to $kohadir/scripts...\n";
! system("cp -R scripts/* $kohadir/scripts/");
! print "Copying module files to $kohadir/modules...\n";
! system("cp -R modules/* $kohadir/modules/");
  print "Copying opac-html files to $opacdir/htdocs...\n";
  system("cp -R opac-html/* $opacdir/htdocs/");
--- 511,522 ----
  print "\n\nINSTALLING KOHA...\n";
  print "\n\n==================\n";
! print "Copying internet-html files to $intranetdir/htdocs...\n";
! system("cp -R intranet-html/* $intranetdir/htdocs/");
! print "Copying intranet-cgi files to $intranetdir/cgi-bin...\n";
! system("cp -R intranet-cgi/* $intranetdir/cgi-bin/");
! print "Copying script files to $intranetdir/scripts...\n";
! system("cp -R scripts/* $intranetdir/scripts/");
! print "Copying module files to $intranetdir/modules...\n";
! system("cp -R modules/* $intranetdir/modules/");
  print "Copying opac-html files to $opacdir/htdocs...\n";
  system("cp -R opac-html/* $opacdir/htdocs/");
***************
*** 733,739 ****
  
  system("chown -R root.$httpduser $opacdir");
! system("chown -R root.$httpduser $kohadir");
  
  
  
  #Create the configuration file
--- 525,539 ----
  
  system("chown -R root.$httpduser $opacdir");
! system("chown -R root.$httpduser $intranetdir");
  
  
+ print qq|
+ 
+ KOHA.CONF
+ =========
+ Koha uses a small configuration file that is placed in your /etc/ files
+ directory. The configuration file, will be created in this directory.
+ 
+ |;
  
  #Create the configuration file
***************
*** 745,750 ****
  user=$user
  pass=$pass
! includes=$kohadir/htdocs/includes
! intranetdir=$kohadir
  opacdir=$opacdir
  kohalogdir=$kohalogdir
--- 545,550 ----
  user=$user
  pass=$pass
! includes=$intranetdir/htdocs/includes
! intranetdir=$intranetdir
  opacdir=$opacdir
  kohalogdir=$kohalogdir
***************
*** 762,765 ****
--- 562,566 ----
  
  
+ print "Successfully created the Koha configuration file.\n";
  
  print qq|
***************
*** 820,824 ****
      system("$mysqldir/bin/mysqladmin -u$mysqluser -p$mysqlpass reload");
  
!     system ("perl -I $kohadir/modules scripts/updater/updatedatabase");
  
  
--- 621,625 ----
      system("$mysqldir/bin/mysqladmin -u$mysqluser -p$mysqlpass reload");
  
!     system ("perl -I $intranetdir/modules scripts/updater/updatedatabase");
  
  
***************
*** 912,921 ****
  print "Modifying Z39.50 daemon launch script...\n";
  my $newfile='';
! open (L, "$kohadir/scripts/z3950daemon/z3950-daemon-launch.sh");
  while (<L>) {
      if (/^RunAsUser=/) {
  	$newfile.="RunAsUser=$httpduser\n";
      } elsif (/^KohaZ3950Dir=/) {
! 	$newfile.="KohaZ3950Dir=$kohadir/scripts/z3950daemon\n";
      } else {
  	$newfile.=$_;
--- 713,722 ----
  print "Modifying Z39.50 daemon launch script...\n";
  my $newfile='';
! open (L, "$intranetdir/scripts/z3950daemon/z3950-daemon-launch.sh");
  while (<L>) {
      if (/^RunAsUser=/) {
  	$newfile.="RunAsUser=$httpduser\n";
      } elsif (/^KohaZ3950Dir=/) {
! 	$newfile.="KohaZ3950Dir=$intranetdir/scripts/z3950daemon\n";
      } else {
  	$newfile.=$_;
***************
*** 923,928 ****
  }
  close L;
! system("mv $kohadir/scripts/z3950daemon/z3950-daemon-launch.sh $kohadir/scripts/z3950daemon/z3950-daemon-launch.sh.orig");
! open L, ">$kohadir/scripts/z3950daemon/z3950-daemon-launch.sh";
  print L $newfile;
  close L;
--- 724,729 ----
  }
  close L;
! system("mv $intranetdir/scripts/z3950daemon/z3950-daemon-launch.sh $intranetdir/scripts/z3950daemon/z3950-daemon-launch.sh.orig");
! open L, ">$intranetdir/scripts/z3950daemon/z3950-daemon-launch.sh";
  print L $newfile;
  close L;
***************
*** 932,941 ****
  print "Modifying Z39.50 daemon wrapper script...\n";
  $newfile='';
! open (S, "$kohadir/scripts/z3950daemon/z3950-daemon-shell.sh");
  while (<S>) {
      if (/^KohaModuleDir=/) {
! 	$newfile.="KohaModuleDir=$kohadir/modules\n";
      } elsif (/^KohaZ3950Dir=/) {
! 	$newfile.="KohaZ3950Dir=$kohadir/scripts/z3950daemon\n";
      } elsif (/^LogDir=/) {
  	$newfile.="LogDir=$kohalogdir\n";
--- 733,742 ----
  print "Modifying Z39.50 daemon wrapper script...\n";
  $newfile='';
! open (S, "$intranetdir/scripts/z3950daemon/z3950-daemon-shell.sh");
  while (<S>) {
      if (/^KohaModuleDir=/) {
! 	$newfile.="KohaModuleDir=$intranetdir/modules\n";
      } elsif (/^KohaZ3950Dir=/) {
! 	$newfile.="KohaZ3950Dir=$intranetdir/scripts/z3950daemon\n";
      } elsif (/^LogDir=/) {
  	$newfile.="LogDir=$kohalogdir\n";
***************
*** 946,958 ****
  close S;
  
! system("mv $kohadir/scripts/z3950daemon/z3950-daemon-shell.sh $kohadir/scripts/z3950daemon/z3950-daemon-shell.sh.orig");
! open S, ">$kohadir/scripts/z3950daemon/z3950-daemon-shell.sh";
  print S $newfile;
  close S;
! chmod 0750, "$kohadir/scripts/z3950daemon/z3950-daemon-launch.sh";
! chmod 0750, "$kohadir/scripts/z3950daemon/z3950-daemon-shell.sh";
! chmod 0750, "$kohadir/scripts/z3950daemon/processz3950queue";
! chown(0, (getpwnam($httpduser)) [3], "$kohadir/scripts/z3950daemon/z3950-daemon-shell.sh") or warn "can't chown $kohadir/scripts/z3950daemon/z3950-daemon-shell.sh: $!";
! chown(0, (getpwnam($httpduser)) [3], "$kohadir/scripts/z3950daemon/processz3950queue") or warn "can't chown $kohadir/scripts/z3950daemon/processz3950queue: $!";
  
  print qq|
--- 747,759 ----
  close S;
  
! system("mv $intranetdir/scripts/z3950daemon/z3950-daemon-shell.sh $intranetdir/scripts/z3950daemon/z3950-daemon-shell.sh.orig");
! open S, ">$intranetdir/scripts/z3950daemon/z3950-daemon-shell.sh";
  print S $newfile;
  close S;
! chmod 0750, "$intranetdir/scripts/z3950daemon/z3950-daemon-launch.sh";
! 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|





More information about the Koha-cvs mailing list