[Koha-cvs] CVS: koha installer.pl,1.2.2.65,1.2.2.66 Install.pm,1.1.2.15,1.1.2.16

Steve Tonnesen tonnesen at users.sourceforge.net
Thu Sep 19 21:34:28 CEST 2002


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

Modified Files:
      Tag: rel-1-2
	installer.pl Install.pm 
Log Message:
Incorporated A.C.Li's fixes for install script.  His patches were against the
old installer.pl in the trunk of CVS.  His fixes were applied to the new
installer.pl and Install.pm in the rel-1-2 branch.  These files will eventually
replace the old installer in the trunk branch as well when we start
distributiong 1.3.x packages.


Index: installer.pl
===================================================================
RCS file: /cvsroot/koha/koha/installer.pl,v
retrieving revision 1.2.2.65
retrieving revision 1.2.2.66
diff -C2 -r1.2.2.65 -r1.2.2.66
*** installer.pl	3 Sep 2002 21:59:48 -0000	1.2.2.65
--- installer.pl	19 Sep 2002 19:34:26 -0000	1.2.2.66
***************
*** 9,19 ****
  $::language='en';
  
- if ($<) {
-     print "\n\nYou must run koha.upgrade as root.\n\n";
-     exit;
- }
  unless ($< == 0) {
      print "You must be root to run this script.\n";
      exit 1;
  }
  
--- 9,24 ----
  $::language='en';
  
  unless ($< == 0) {
      print "You must be root to run this script.\n";
      exit 1;
+ }
+ 
+ 
+ unless (-d 'intranet-html') {
+    print <<EOP;
+ You seem to be installing from CVS. Please run the "buildrelease" script
+ and install from the resulting release tarball.
+ EOP
+    exit 1;
  }
  

Index: Install.pm
===================================================================
RCS file: /cvsroot/koha/koha/Attic/Install.pm,v
retrieving revision 1.1.2.15
retrieving revision 1.1.2.16
diff -C2 -r1.1.2.15 -r1.1.2.16
*** Install.pm	3 Sep 2002 21:59:48 -0000	1.1.2.15
--- Install.pm	19 Sep 2002 19:34:26 -0000	1.1.2.16
***************
*** 1006,1012 ****
      # Create /etc/koha.conf
  
!     open(KC,">$::etcdir/koha.conf") or warn "Couldn't create file
!     at $::etcdir.  Must have write capability.\n";
!     print KC qq|
  database=$::dbname
  hostname=$::hostname
--- 1006,1012 ----
      # Create /etc/koha.conf
  
!     my $old_umask = umask(027); # make sure koha.conf is never world-readable
!     open(SITES,">$::etcdir/koha.conf.tmp") or warn "Couldn't create file at $::etcdir. Must have write capability.\n";
!     print SITES qq|
  database=$::dbname
  hostname=$::hostname
***************
*** 1020,1027 ****
  httpduser=$::httpduser
  |;
!     close(KC);
  
!     chown((getpwnam($::httpduser)) [2,3], "$::etcdir/koha.conf") or warn "can't chown koha.conf: $!";
!     chmod 0440, "$::etcdir/koha.conf";
  
      chmod 0750, "$::intranetdir/scripts/z3950daemon/z3950-daemon-launch.sh";
--- 1020,1028 ----
  httpduser=$::httpduser
  |;
!     close(SITES);
!     umask($old_umask);
  
!     chown((getpwnam($::httpduser)) [2,3], "$::etcdir/koha.conf.tmp") or warn "can't chown koha.conf: $!";
!     chmod 0440, "$::etcdir/koha.conf.tmp";
  
      chmod 0750, "$::intranetdir/scripts/z3950daemon/z3950-daemon-launch.sh";
***************
*** 1114,1124 ****
      foreach my $mysql (qw(/usr/local/mysql
  			  /opt/mysql
  			  )) {
!        if ( -d $mysql ) {
! 		$mysqldir=$mysql;
         }
      }
      if (!$mysqldir){
! 	$mysqldir='/usr';
      }
  
--- 1115,1140 ----
      foreach my $mysql (qw(/usr/local/mysql
  			  /opt/mysql
+ 			  /usr
  			  )) {
!        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;
! 
! I can't find it there either. If you compiled mysql yourself,
! please give the value of --prefix when you ran configure.
! 
! The file mysqladmin should be in bin/mysqladmin under the directory that you
! provide here.
! 
! EOP
! 	}
      }
  
***************
*** 1127,1131 ****
      while ($needpassword) {
  	$::mysqlpass=showmessage(getmessage('MysqlRootPassword'), 'free');
! 	my $result=system("$mysqldir/bin/mysqladmin -u$::mysqluser -p$::mysqlpass proc > /dev/null 2>&1");
  	if ($result) {
  	    print getmessage('InvalidMysqlRootPassword');
--- 1143,1149 ----
      while ($needpassword) {
  	$::mysqlpass=showmessage(getmessage('MysqlRootPassword'), 'free');
! 	$::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');
***************
*** 1141,1148 ****
  	showmessage(getmessage('CreatingDatabaseError'),'PressEnter', '', 1);
      } 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");
  
  	system ("perl -I $::intranetdir/modules scripts/updater/updatedatabase");
--- 1159,1168 ----
  	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");
***************
*** 1226,1229 ****
--- 1246,1253 ----
  
  }
+ 
+ # Installation is complete.  Rename the koha.conf.tmp file
+ 
+ rename "$::etcdir/koha.conf.tmp", "$::etcdir/koha.conf" || warn "Couldn't rename file at $::etcdir. Must have write capability.\n";
  
  sub loadconfigfile {





More information about the Koha-cvs mailing list