[Koha-cvs] CVS: koha/misc installer.pl,1.5,1.6 Install.pm,1.1,1.2

Paul POULAIN tipaul at users.sourceforge.net
Fri Dec 20 11:30:18 CET 2002


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

Modified Files:
	installer.pl Install.pm 
Log Message:
bugfixes + language selection during install
road to 1.3.3

Index: installer.pl
===================================================================
RCS file: /cvsroot/koha/koha/misc/installer.pl,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** installer.pl	12 Dec 2002 21:40:40 -0000	1.5
--- installer.pl	20 Dec 2002 10:30:15 -0000	1.6
***************
*** 6,11 ****
--- 6,16 ----
  use strict; # please develop with the strict pragma
  
+ use vars qw( $input );
  
  $::language='en';
+ $::domainname = `hostname -d`;
+ chomp $::domainname;
+ $::etcdir = '/etc';
+ 
  
  unless ($< == 0) {
***************
*** 31,36 ****
  }
  
! if (-e "/etc/koha.conf") {
!     $::installedversion=`grep kohaversion= /etc/koha.conf`;
      chomp $::installedversion;
      $::installedversion=~m/kohaversion=(.*)/;
--- 36,43 ----
  }
  
! checkabortedinstall();
! 
! if (-e "$::etcdir/koha.conf") {
!     $::installedversion=`grep kohaversion= $::etcdir/koha.conf`;
      chomp $::installedversion;
      $::installedversion=~m/kohaversion=(.*)/;
***************
*** 43,47 ****
      }
  
!     my $message=getmessage('KohaAlreadyInstalled', [$::kohaversion, $installedversionmsg]);
      showmessage($message, 'none');
      exit;
--- 50,54 ----
      }
  
!     my $message=getmessage('KohaAlreadyInstalled', [$::etcdir, $::kohaversion, $installedversionmsg]);
      showmessage($message, 'none');
      exit;
***************
*** 57,64 ****
      } else {
      print qq|
! This installer currently does not support a completely automated 
  setup.
  
! Please be sure to read the documentation, or visit the Koha website 
  at http://www.koha.org for more information.
  |;
--- 64,71 ----
      } else {
      print qq|
! This installer currently does not support a completely automated
  setup.
  
! Please be sure to read the documentation, or visit the Koha website
  at http://www.koha.org for more information.
  |;
***************
*** 66,75 ****
  };
  
- my $input;
- $::domainname = `hostname -d`;
- chomp $::domainname;
- $::etcdir = '/etc';
- 
- 
  # Check for missing Perl Modules
  checkperlmodules();
--- 73,76 ----
***************
*** 92,95 ****
--- 93,102 ----
  databasesetup();
  
+ updatedatabase();
+ 
+ updatemarc();
+ 
+ populatedatabase();
+ 
  restartapache();
  
***************
*** 100,108 ****
  
  
! updatedatabase();
! 
! populatedatabase();
! 
! showmessage(getmessage('AuthenticationWarning'), 'PressEnter');
  
  
--- 107,111 ----
  
  
! showmessage(getmessage('AuthenticationWarning', [$::etcdir]), 'PressEnter');
  
  
***************
*** 112,118 ****
  
  
! my $reply=showmessage('Would you like to complete a survey about your library?', 'yn', 'y');
! if ($reply=~/y/i) {
!     system("perl kohareporter");
  }
- 
--- 115,122 ----
  
  
! if (-f "kohareporter") {
!     my $reply=showmessage('Would you like to complete a survey about your library?', 'yn', 'y');
!     if ($reply=~/y/i) {
! 	system("perl kohareporter");
!     }
  }

Index: Install.pm
===================================================================
RCS file: /cvsroot/koha/koha/misc/Install.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** Install.pm	12 Dec 2002 21:40:39 -0000	1.1
--- Install.pm	20 Dec 2002 10:30:15 -0000	1.2
***************
*** 59,63 ****
  Enter at the prompt.
  
! Please be sure to read the documentation, or visit the Koha website at 
  http://www.koha.org for more information.
  
--- 59,63 ----
  Enter at the prompt.
  
! Please be sure to read the documentation, or visit the Koha website at
  http://www.koha.org for more information.
  
***************
*** 199,204 ****
     http://%s\:%s/
  
! 
! Be sure to read the INSTALL, and Hints files. 
  
  For more information visit http://www.koha.org
--- 199,203 ----
     http://%s\:%s/
  
! Be sure to read the INSTALL, and Hints files.
  
  For more information visit http://www.koha.org
***************
*** 227,231 ****
      my $message = getmessage('CheckingPerlModules');
      showmessage($message, 'none');
!     
      unless (eval "require 5.006_000") {
  	die getmessage('PerlVersionFailure', ['5.6.0']);
--- 226,230 ----
      my $message = getmessage('CheckingPerlModules');
      showmessage($message, 'none');
! 
      unless (eval "require 5.006_000") {
  	die getmessage('PerlVersionFailure', ['5.6.0']);
***************
*** 240,244 ****
      unless (eval {require Digest::MD5})       { push @missing,"Digest::MD5" };
      unless (eval {require MARC::Record})       { push @missing,"MARC::Record" };
!     unless (eval {require Net::Z3950})        { 
  	my $message = getmessage('NETZ3950Missing');
  	showmessage($message, 'PressEnter', '', 1);
--- 239,243 ----
      unless (eval {require Digest::MD5})       { push @missing,"Digest::MD5" };
      unless (eval {require MARC::Record})       { push @missing,"MARC::Record" };
!     unless (eval {require Net::Z3950})        {
  	my $message = getmessage('NETZ3950Missing');
  	showmessage($message, 'PressEnter', '', 1);
***************
*** 296,300 ****
  The Koha scripts will _not_ work without a symlink from %s to /usr/bin/perl
  
! May I create this symlink? ([Y]/N): 
  : |;
  
--- 295,299 ----
  The Koha scripts will _not_ work without a symlink from %s to /usr/bin/perl
  
! May I create this symlink? ([Y]/N):
  : |;
  
***************
*** 1213,1216 ****
--- 1212,1226 ----
  Choose MARC definition [1]: |;
  
+ $messages->{'Language'}->{en}=qq|
+ ====================
+ = CHOOSE LANGUAGES  =
+ ====================
+ This version of koha supports a few languages.
+ Enter you languages preferences : either en, fr or es.
+ Note that the en is always choosen when the system does not finds the
+ language you choose in a specific screen.
+ fr : opac is translated (except pictures)
+ es : a few intranet is translated (including pictures)
+ |;
  
  sub updatedatabase {
***************
*** 1224,1237 ****
  
      if ($response == 1) {
! 	system("cat script/misc/marc_datas/marc21_en/structure_def.sql | $mysqldir/bin/mysql -u$mysqluser -p$mysqlpass $dbname");
      }
      if ($response == 2) {
! 	system("cat scripts/misc/marc_datas/unimarc_fr/structure_def.sql | $mysqldir/bin/mysql -u$mysqluser -p$mysqlpass $dbname");
! 	system("cat scripts/misc/lang-datas/fr/stopwords.sql | $mysqldir/bin/mysql -u$mysqluser -p$mysqlpass $dbname");
      }
  
!     system ("perl -I $kohadir/modules scripts/marc/updatedb2marc.pl");
  
-     
      print "\n\nFinished updating database. Press <ENTER> to continue...";
      <STDIN>;
--- 1234,1247 ----
  
      if ($response == 1) {
! 	system("cat script/misc/marc_datas/marc21_en/structure_def.sql | $::mysqldir/bin/mysql -u$::mysqluser -p$::mysqlpass $::dbname");
      }
      if ($response == 2) {
! 	system("cat scripts/misc/marc_datas/unimarc_fr/structure_def.sql | $::mysqldir/bin/mysql -u$::mysqluser -p$::mysqlpass $::dbname");
! 	system("cat scripts/misc/lang-datas/fr/stopwords.sql | $::mysqldir/bin/mysql -u$::mysqluser -p$::mysqlpass $::dbname");
      }
  
!     system ("perl -I $::kohadir/modules scripts/marc/updatedb2marc.pl");
! 
  
      print "\n\nFinished updating database. Press <ENTER> to continue...";
      <STDIN>;
***************
*** 1239,1286 ****
  
  sub populatedatabase {
!     my $response=showmessage(getmessage('SampleData'), 'yn', 'n');
!     if ($response =~/^y/i) {
! 	system("gunzip sampledata-1.2.gz");
! 	system("cat sampledata-1.2 | $::mysqldir/bin/mysql -u$::mysqluser $::mysqlpass_quoted $::dbname");
! 	system("gzip -9 sampledata-1.2");
! 	system("$::mysqldir/bin/mysql -u$::mysqluser $::mysqlpass_quoted $::dbname -e \"insert into branches (branchcode,branchname,issuing) values ('MAIN', 'Main Library', 1)\"");
! 	system("$::mysqldir/bin/mysql -u$::mysqluser $::mysqlpass_quoted $::dbname -e \"insert into branchrelations (branchcode,categorycode) values ('MAIN', 'IS')\"");
! 	system("$::mysqldir/bin/mysql -u$::mysqluser $::mysqlpass_quoted $::dbname -e \"insert into branchrelations (branchcode,categorycode) values ('MAIN', 'CU')\"");
! 	system("$::mysqldir/bin/mysql -u$::mysqluser $::mysqlpass_quoted $::dbname -e \"insert into printers (printername,printqueue,printtype) values ('Circulation Desk Printer', 'lp', 'hp')\"");
! 	showmessage(getmessage('SampleDataInstalled'), 'PressEnter','',1);
!     } else {
! 	my $input;
! 	my $response=showmessage(getmessage('AddBranchPrinter'), 'yn', 'y');
! 
! 	unless ($response =~/^n/i) {
! 	    my $branch='Main Library';
! 	    $branch=showmessage(getmessage('BranchName', [$branch]), 'free', $branch, 1);
! 	    $branch=~s/[^A-Za-z0-9\s]//g;
! 
! 	    my $branchcode=$branch;
! 	    $branchcode=~s/[^A-Za-z0-9]//g;
! 	    $branchcode=uc($branchcode);
! 	    $branchcode=substr($branchcode,0,4);
! 	    $branchcode=showmessage(getmessage('BranchCode', [$branchcode]), 'free', $branchcode, 1);
! 	    $branchcode=~s/[^A-Za-z0-9]//g;
! 	    $branchcode=uc($branchcode);
! 	    $branchcode=substr($branchcode,0,4);
! 	    $branchcode or $branchcode='DEF';
! 
! 	    system("$::mysqldir/bin/mysql -u$::mysqluser $::mysqlpass_quoted $::dbname -e \"insert into branches (branchcode,branchname,issuing) values ('$branchcode', '$branch', 1)\"");
! 	    system("$::mysqldir/bin/mysql -u$::mysqluser $::mysqlpass_quoted $::dbname -e \"insert into branchrelations (branchcode,categorycode) values ('MAIN', 'IS')\"");
! 	    system("$::mysqldir/bin/mysql -u$::mysqluser $::mysqlpass_quoted $::dbname -e \"insert into branchrelations (branchcode,categorycode) values ('MAIN', 'CU')\"");
! 
! 	    my $printername='Library Printer';
! 	    $printername=showmessage(getmessage('PrinterName', [$printername]), 'free', $printername, 1);
! 	    $printername=~s/[^A-Za-z0-9\s]//g;
! 
! 	    my $printerqueue='lp';
! 	    $printerqueue=showmessage(getmessage('PrinterQueue', [$printerqueue]), 'free', $printerqueue, 1);
! 	    $printerqueue=~s/[^A-Za-z0-9]//g;
! 	    system("$::mysqldir/bin/mysql -u$::mysqluser $::mysqlpass_quoted $::dbname -e \"insert into printers (printername,printqueue,printtype) values ('$printername', '$printerqueue', '')\"");
  
  	}
-     }
  }
  
--- 1249,1297 ----
  
  sub populatedatabase {
! 	my $response=showmessage(getmessage('SampleData'), 'yn', 'n');
! 	if ($response =~/^y/i) {
! 		system("gunzip sampledata-1.2.gz");
! 		system("cat sampledata-1.2 | $::mysqldir/bin/mysql -u$::mysqluser $::mysqlpass_quoted $::dbname");
! 		system("gzip -9 sampledata-1.2");
! 		system("$::mysqldir/bin/mysql -u$::mysqluser $::mysqlpass_quoted $::dbname -e \"insert into branches (branchcode,branchname,issuing) values ('MAIN', 'Main Library', 1)\"");
! 		system("$::mysqldir/bin/mysql -u$::mysqluser $::mysqlpass_quoted $::dbname -e \"insert into branchrelations (branchcode,categorycode) values ('MAIN', 'IS')\"");
! 		system("$::mysqldir/bin/mysql -u$::mysqluser $::mysqlpass_quoted $::dbname -e \"insert into branchrelations (branchcode,categorycode) values ('MAIN', 'CU')\"");
! 		system("$::mysqldir/bin/mysql -u$::mysqluser $::mysqlpass_quoted $::dbname -e \"insert into printers (printername,printqueue,printtype) values ('Circulation Desk Printer', 'lp', 'hp')\"");
! 		showmessage(getmessage('SampleDataInstalled'), 'PressEnter','',1);
! 	} else {
! 		my $input;
! 		my $response=showmessage(getmessage('AddBranchPrinter'), 'yn', 'y');
  
+ 		unless ($response =~/^n/i) {
+ 		my $branch='Main Library';
+ 		$branch=showmessage(getmessage('BranchName', [$branch]), 'free', $branch, 1);
+ 		$branch=~s/[^A-Za-z0-9\s]//g;
+ 
+ 		my $branchcode=$branch;
+ 		$branchcode=~s/[^A-Za-z0-9]//g;
+ 		$branchcode=uc($branchcode);
+ 		$branchcode=substr($branchcode,0,4);
+ 		$branchcode=showmessage(getmessage('BranchCode', [$branchcode]), 'free', $branchcode, 1);
+ 		$branchcode=~s/[^A-Za-z0-9]//g;
+ 		$branchcode=uc($branchcode);
+ 		$branchcode=substr($branchcode,0,4);
+ 		$branchcode or $branchcode='DEF';
+ 
+ 		system("$::mysqldir/bin/mysql -u$::mysqluser $::mysqlpass_quoted $::dbname -e \"insert into branches (branchcode,branchname,issuing) values ('$branchcode', '$branch', 1)\"");
+ 		system("$::mysqldir/bin/mysql -u$::mysqluser $::mysqlpass_quoted $::dbname -e \"insert into branchrelations (branchcode,categorycode) values ('MAIN', 'IS')\"");
+ 		system("$::mysqldir/bin/mysql -u$::mysqluser $::mysqlpass_quoted $::dbname -e \"insert into branchrelations (branchcode,categorycode) values ('MAIN', 'CU')\"");
+ 
+ 		my $printername='Library Printer';
+ 		$printername=showmessage(getmessage('PrinterName', [$printername]), 'free', $printername, 1);
+ 		$printername=~s/[^A-Za-z0-9\s]//g;
+ 
+ 		my $printerqueue='lp';
+ 		$printerqueue=showmessage(getmessage('PrinterQueue', [$printerqueue]), 'free', $printerqueue, 1);
+ 		$printerqueue=~s/[^A-Za-z0-9]//g;
+ 		system("$::mysqldir/bin/mysql -u$::mysqluser $::mysqlpass_quoted $::dbname -e \"insert into printers (printername,printqueue,printtype) values ('$printername', '$printerqueue', '')\"");
+ 		}
+ 	my $language=showmessage(getmessage('Language'), 'free', 'en');
+ 	system("$::mysqldir/bin/mysql -u$::mysqluser $::mysqlpass_quoted $::dbname -e \"update systempreferences set value='$language' where variable='opaclanguages'\"");
  	}
  }
  





More information about the Koha-cvs mailing list