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.19,1.1.2.20 installer.pl,1.2.2.67,


From: Steve Tonnesen
Subject: [Koha-cvs] CVS: koha Install.pm,1.1.2.19,1.1.2.20 installer.pl,1.2.2.67,1.2.2.68 koha.upgrade,1.1.2.21,1.1.2.22
Date: Wed, 23 Oct 2002 09:30:17 -0700

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

Modified Files:
      Tag: rel-1-2
        Install.pm installer.pl koha.upgrade 
Log Message:
Fixed a couple of bad bugs in installer.pl.  New koha.conf.tmp file was causing
problems.  In particular, updatedatabase couldn't work because koha.conf didn't
exist yet when it was run.  This, in turn, broke installing the sample data
because the necessary fields weren't in place in the tables yet.  Also, the
installer was trying to set the apache user's access to directories before it
knew what the apache user was.


Index: Install.pm
===================================================================
RCS file: /cvsroot/koha/koha/Attic/Install.pm,v
retrieving revision 1.1.2.19
retrieving revision 1.1.2.20
diff -C2 -r1.1.2.19 -r1.1.2.20
*** Install.pm  23 Oct 2002 15:38:51 -0000      1.1.2.19
--- Install.pm  23 Oct 2002 16:30:14 -0000      1.1.2.20
***************
*** 40,43 ****
--- 40,45 ----
                &installfiles
                &databasesetup
+               &updatedatabase
+               &populatedatabase
                &restartapache
                &loadconfigfile
***************
*** 987,993 ****
  
      showmessage(getmessage('InstallFiles'),'none');
!     print getmessage('CopyingFiles', ['internet-html', 
"$::intranetdir/htdocs" ]);
      system("cp -R intranet-html/* $::intranetdir/htdocs/");
!     print getmessage('CopyingFiles', ['internet-cgi', 
"$::intranetdir/cgi-bin" ]);
      system("cp -R intranet-cgi/* $::intranetdir/cgi-bin/");
      print getmessage('CopyingFiles', ['stand-alone scripts', 
"$::intranetdir/scripts" ]);
--- 989,995 ----
  
      showmessage(getmessage('InstallFiles'),'none');
!     print getmessage('CopyingFiles', ['intranet-html', 
"$::intranetdir/htdocs" ]);
      system("cp -R intranet-html/* $::intranetdir/htdocs/");
!     print getmessage('CopyingFiles', ['intranet-cgi', 
"$::intranetdir/cgi-bin" ]);
      system("cp -R intranet-cgi/* $::intranetdir/cgi-bin/");
      print getmessage('CopyingFiles', ['stand-alone scripts', 
"$::intranetdir/scripts" ]);
***************
*** 1109,1113 ****
  
  sub databasesetup {
-     my $mysqldir;
      $::mysqluser = 'root';
      $::mysqlpass = '';
--- 1111,1114 ----
***************
*** 1118,1130 ****
                          )) {
         if ( -d $mysql  && -f "$mysql/bin/mysqladmin") {
!           $mysqldir=$mysql;
         }
      }
!     if (!$mysqldir){
        print "I don't see mysql in the usual places.\n";
        for (;;) {
            print "Where have you installed mysql? ";
!           chomp($mysqldir = <STDIN>);
!           last if -f "$mysqldir/bin/mysqladmin";
        print <<EOP;
  
--- 1119,1131 ----
                          )) {
         if ( -d $mysql  && -f "$mysql/bin/mysqladmin") {
!           $::mysqldir=$mysql;
         }
      }
!     if (!$::mysqldir){
        print "I don't see mysql in the usual places.\n";
        for (;;) {
            print "Where have you installed mysql? ";
!           chomp($::mysqldir = <STDIN>);
!           last if -f "$::mysqldir/bin/mysqladmin";
        print <<EOP;
  
***************
*** 1145,1149 ****
        $::mysqlpass_quoted = $::mysqlpass;
        $::mysqlpass_quoted =~ s/"/\\"/g;
!       my $result=system("$mysqldir/bin/mysqladmin -u$::mysqluser 
-p\"$::mysqlpass_quoted\" proc > /dev/null 2>&1");
        if ($result) {
            print getmessage('InvalidMysqlRootPassword');
--- 1146,1150 ----
        $::mysqlpass_quoted = $::mysqlpass;
        $::mysqlpass_quoted =~ s/"/\\"/g;
!       my $result=system("$::mysqldir/bin/mysqladmin -u$::mysqluser 
-p\"$::mysqlpass_quoted\" proc > /dev/null 2>&1");
        if ($result) {
            print getmessage('InvalidMysqlRootPassword');
***************
*** 1155,1220 ****
      showmessage(getmessage('CreatingDatabase'),'none');
  
!     my $result=system("$mysqldir/bin/mysqladmin -u$::mysqluser -p$::mysqlpass 
create $::dbname");
      if ($result) {
        showmessage(getmessage('CreatingDatabaseError'),'PressEnter', '', 1);
      } else {
        # Populate the Koha database
!       system("$mysqldir/bin/mysql -u$::mysqluser -p\"$::mysqlpass_quoted\" 
$::dbname < koha.mysql");
        # Set up permissions
!       system("$mysqldir/bin/mysql -u$::mysqluser -p\"$::mysqlpass_quoted\" 
mysql -e \"insert into user (Host,User,Password) values 
('$::hostname','$::user',password('$::pass'))\"\;");
!       system("$mysqldir/bin/mysql -u$::mysqluser -p\"$::mysqlpass_quoted\" 
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_quoted\" reload");
! 
!       system ("perl -I $::intranetdir/modules 
scripts/updater/updatedatabase");
! 
! 
!       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 
-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 branchrelations (branchcode,categorycode) values ('MAIN', 
'IS')\"");
!           system("$mysqldir/bin/mysql -u$::mysqluser -p$::mysqlpass $::dbname 
-e \"insert into branchrelations (branchcode,categorycode) values ('MAIN', 
'CU')\"");
!           system("$mysqldir/bin/mysql -u$::mysqluser -p$::mysqlpass $::dbname 
-e \"insert into printers (printername,printqueue,printtype) values 
('Circulation Desk Printer', 'lp', 'hp')\"");
!           showmessage(getmessage('SampleDataInstalled'), 'PressEnter');
!       } else {
!           my $input;
!           my $response=showmessage(getmessage('AddBranchPrinter'), 'yn', 'y');
  
-           unless ($response =~/^n/i) {
-               my $branch='Main Library';
-               print "Enter a name for the library branch [$branch]: ";
-               $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-Z]//g;
-               $branchcode=uc($branchcode);
-               $branchcode=substr($branchcode,0,4);
- 
-               system("$mysqldir/bin/mysql -u$::mysqluser -p$::mysqlpass 
$::dbname -e \"insert into branches (branchcode,branchname,issuing) values 
('$branchcode', '$branch', 1)\"");
-               system("$mysqldir/bin/mysql -u$::mysqluser -p$::mysqlpass 
$::dbname -e \"insert into branchrelations (branchcode,categorycode) values 
('MAIN', 'IS')\"");
-               system("$mysqldir/bin/mysql -u$::mysqluser -p$::mysqlpass 
$::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 -p$::mysqlpass 
$::dbname -e \"insert into printers (printername,printqueue,printtype) values 
('$printername', '$printerqueue', '')\"");
  
-           }
-       }
  
  
      }
  
  }
  
--- 1156,1233 ----
      showmessage(getmessage('CreatingDatabase'),'none');
  
!     my $result=system("$::mysqldir/bin/mysqladmin -u$::mysqluser 
-p$::mysqlpass create $::dbname");
      if ($result) {
        showmessage(getmessage('CreatingDatabaseError'),'PressEnter', '', 1);
      } else {
        # Populate the Koha database
!       system("$::mysqldir/bin/mysql -u$::mysqluser -p\"$::mysqlpass_quoted\" 
$::dbname < koha.mysql");
        # Set up permissions
!       system("$::mysqldir/bin/mysql -u$::mysqluser -p\"$::mysqlpass_quoted\" 
mysql -e \"insert into user (Host,User,Password) values 
('$::hostname','$::user',password('$::pass'))\"\;");
!       system("$::mysqldir/bin/mysql -u$::mysqluser -p\"$::mysqlpass_quoted\" 
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_quoted\" reload");
! 
  
  
  
  
      }
  
+ }
+ 
+ sub updatedatabase {
+     my $result=system ("perl -I $::intranetdir/modules 
scripts/updater/updatedatabase");
+     if ($result) {
+       print "Problem updating database...\n";
+       exit;
+     }
+     print "\n\nFinished updating database. Press <ENTER> to continue...";
+     <STDIN>;
+ }
+ 
+ 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 
-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 branchrelations (branchcode,categorycode) values ('MAIN', 
'IS')\"");
+       system("$::mysqldir/bin/mysql -u$::mysqluser -p$::mysqlpass $::dbname 
-e \"insert into branchrelations (branchcode,categorycode) values ('MAIN', 
'CU')\"");
+       system("$::mysqldir/bin/mysql -u$::mysqluser -p$::mysqlpass $::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';
+           print "Enter a name for the library branch [$branch]: ";
+           $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-Z]//g;
+           $branchcode=uc($branchcode);
+           $branchcode=substr($branchcode,0,4);
+ 
+           system("$::mysqldir/bin/mysql -u$::mysqluser -p$::mysqlpass 
$::dbname -e \"insert into branches (branchcode,branchname,issuing) values 
('$branchcode', '$branch', 1)\"");
+           system("$::mysqldir/bin/mysql -u$::mysqluser -p$::mysqlpass 
$::dbname -e \"insert into branchrelations (branchcode,categorycode) values 
('MAIN', 'IS')\"");
+           system("$::mysqldir/bin/mysql -u$::mysqluser -p$::mysqlpass 
$::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 -p$::mysqlpass 
$::dbname -e \"insert into printers (printername,printqueue,printtype) values 
('$printername', '$printerqueue', '')\"");
+ 
+       }
+     }
  }
  

Index: installer.pl
===================================================================
RCS file: /cvsroot/koha/koha/installer.pl,v
retrieving revision 1.2.2.67
retrieving revision 1.2.2.68
diff -C2 -r1.2.2.67 -r1.2.2.68
*** installer.pl        23 Oct 2002 15:34:11 -0000      1.2.2.67
--- installer.pl        23 Oct 2002 16:30:14 -0000      1.2.2.68
***************
*** 76,85 ****
  
  # Ask for installation directories
  getinstallationdirectories();
  
  getdatabaseinfo();
  
- getapacheinfo();
- 
  getapachevhostinfo();
  
--- 76,85 ----
  
  # Ask for installation directories
+ getapacheinfo();
+ 
  getinstallationdirectories();
  
  getdatabaseinfo();
  
  getapachevhostinfo();
  
***************
*** 98,101 ****
--- 98,106 ----
  
  rename "$::etcdir/koha.conf.tmp", "$::etcdir/koha.conf" || warn "Couldn't 
rename file at $::etcdir. Must have write capability.\n";
+ 
+ 
+ updatedatabase();
+ 
+ populatedatabase();
  
  showmessage(getmessage('AuthenticationWarning'), 'PressEnter');

Index: koha.upgrade
===================================================================
RCS file: /cvsroot/koha/koha/koha.upgrade,v
retrieving revision 1.1.2.21
retrieving revision 1.1.2.22
diff -C2 -r1.1.2.21 -r1.1.2.22
*** koha.upgrade        9 Sep 2002 19:45:40 -0000       1.1.2.21
--- koha.upgrade        23 Oct 2002 16:30:15 -0000      1.1.2.22
***************
*** 301,305 ****
  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";
--- 301,305 ----
  print "\n\nINSTALLING KOHA...\n";
  print "\n\n==================\n";
! print "Copying intranet-html files to $::intranetdir/htdocs...\n";
  system("cp -R intranet-html/* $::intranetdir/htdocs/");
  print "Copying intranet-cgi files to $::intranetdir/cgi-bin...\n";




reply via email to

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