[Koha-cvs] CVS: koha/misc Install.pm,1.57,1.58 koha.upgrade,1.8,1.9

MJ Ray slef at users.sourceforge.net
Sun Oct 26 14:21:21 CET 2003


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

Modified Files:
	Install.pm koha.upgrade 
Log Message:
first part of upgrade merge: some FIXMEs and testing to do

Index: Install.pm
===================================================================
RCS file: /cvsroot/koha/koha/misc/Install.pm,v
retrieving revision 1.57
retrieving revision 1.58
diff -C2 -r1.57 -r1.58
*** Install.pm	25 Oct 2003 09:53:54 -0000	1.57
--- Install.pm	26 Oct 2003 13:21:19 -0000	1.58
***************
*** 71,74 ****
--- 71,75 ----
  		&populatedatabase
  		&restartapache
+ 		&backupkoha
  		&finalizeconfigfile
  		&loadconfigfile
***************
*** 142,145 ****
--- 143,160 ----
  Are you ready to begin the installation? ([Y]/N): |;
  
+ $messages->{'WelcomeToUpgrader'}->{en} =
+    heading('Welcome to the Koha Upgrader') . qq|
+ You are attempting to upgrade from Koha %s to %s.
+ 
+ We recommend that you do a complete backup of all your files before upgrading.
+ This upgrade script will make a backup copy of your files for you.
+ 
+ Would you like to proceed?  (Y/[N]):|;
+ 
+ $messages->{'AbortingInstall'}->{en} =
+    heading('ABORTING') . qq|
+ Aborting as requested.  Please rerun when you are ready.
+ |;
+ 
  $messages->{'ReleaseCandidateWarning'}->{en} =
     heading('RELEASE CANDIDATE') . qq|
***************
*** 258,261 ****
--- 273,312 ----
  Press <ENTER> to exit the installer: |;
  
+ $messages->{'UpgradeCompleted'}->{en} = heading('UPGRDE COMPLETE') . qq|
+ Congratulations ... your Koha upgrade is finished!
+ 
+ If you are upgrading from a version of Koha
+ prior to 1.2.1, it is likely that you will have to modify your Apache
+ configuration to point it to the new files.
+ 
+ In your INTRANET VirtualHost section you should have:
+   DocumentRoot $::intranetdir/htdocs
+   ScriptAlias /cgi-bin/koha/ $::intranetdir/cgi-bin/
+   SetEnv PERL5LIB $::intranetdir/modules
+ 
+ In the OPAC VirtualHost section you should have:
+   DocumentRoot $::opacdir/htdocs
+   ScriptAlias /cgi-bin/koha/ $::opacdir/cgi-bin/
+   SetEnv PERL5LIB $::intranetdir/modules
+ 
+ You may also need to uncomment a "LoadModules env_module ... " line and restart
+ Apache.
+ If you're upgrading from 1.2.x version of Koha note that the MARC DB is NOT populated.
+ To populate it :
+ * launch Koha
+ * Go to Parameters >> Marc structure option and Koha-MARC links option.
+ * Modify default MARC structure to fit your needs.
+ * open a console
+ * type:
+ cd /path/to/koha/misc
+ export PERL5LIB=/path/to/koha
+ ./koha2marc.pl
+ the old DB is "copied" in the new MARC one.
+ Koha 2.0.0 is ready :-)
+ 
+ Please report any problems you encounter through http://bugs.koha.org/
+ 
+ Press <ENTER> to exit the installer: |;
+ 
  sub releasecandidatewarning {
      my $message=getmessage('ReleaseCandidateWarning', [$newversion, $newversion]);
***************
*** 668,671 ****
--- 719,788 ----
  }
  
+ =item checkpaths
+ 
+ 	checkpaths;
+ 
+ Make sure that we loaded the right dirs from an old koha.conf
+ 
+ =cut
+ 
+ #FIXME: update to use Install.pm
+ sub checkpaths {
+ if ($opacdir && $intranetdir) {
+     print qq|
+ 
+ I believe that your old files are located in:
+ 
+   OPAC:      $opacdir
+   LIBRARIAN: $intranetdir
+ 
+ 
+ Does this look right?  ([Y]/N):
+ |;
+     $answer = <STDIN>;
+     chomp $answer;
+ 
+     if ($answer =~/n/i) {
+ 	$intranetdir='';
+ 	$opacdir='';
+     } else {
+ 	print "Great! continuing upgrade... \n";
+     }
+ }
+ 
+ if (!$opacdir || !$intranetdir) {
+     $intranetdir='';
+     $opacdir='';
+     while (!$intranetdir) {
+ 	print "Please specify the location of your LIBRARIAN files: ";
+ 
+ 	$answer = <STDIN>;
+ 	chomp $answer;
+ 
+ 	if ($answer) {
+ 	    $intranetdir=$answer;
+ 	}
+ 	if (! -e "$intranetdir/htdocs") {
+ 	    print "\nCouldn't find the htdocs directory here.  That doesn't look right.\nPlease enter another location.\n\n";
+ 	    $intranetdir='';
+ 	}
+     }
+     while (!$opacdir) {
+ 	print "Please specify the location of your OPAC files: ";  
+ 
+ 	$answer = <STDIN>;
+ 	chomp $answer;
+ 
+ 	if ($answer) {
+ 	    $opacdir=$answer;
+ 	}
+ 	if (! -e "$opacdir/htdocs") {
+ 	    print "\nCouldn't find the htdocs directory here.  That doesn't look right.\nPlease enter another location.\n\n";
+ 	    $opacdir='';
+ 	}
+     }
+ }
+ 
+ }
  
  =item checkperlmodules
***************
*** 1363,1366 ****
--- 1480,1484 ----
  
  	#MJR: preserve old files, just in case
+ 	#FIXME: use dated backups
  	sub neatcopy {
  		my $desc = shift;
***************
*** 1612,1615 ****
--- 1730,1734 ----
  	}
  
+ 	#FIXME: do not ask if we are upgrading from a MARC-ready system
  	my $response=showmessage(getmessage('UpdateMarcTables'), 'restrictchar 12N', '1');
  
***************
*** 1731,1734 ****
--- 1850,1987 ----
  }
  
+ =item backupkoha
+ 
+    backupkoha;
+ 
+ This function attempts to back up all koha's details.
+ 
+ =cut
+ 
+ #FIXME: rewrite to use Install.pm
+ sub backupkoha {
+ my $backupdir=($ENV{prefix}||'/usr/local/koha').'/backups';
+ print "Please specify a backup directory [$backupdir]: ";
+ 
+ $answer = <STDIN>;
+ chomp $answer;
+ 
+ if ($answer) {
+ 	$backupdir=$answer;
+ }
+ 
+ if (! -e $backupdir) {
+ 	my $result=mkdir ($backupdir, oct(770));
+ 	if ($result==0) {
+ 		my @dirs = split(m#/#, $backupdir);
+ 		my $checkdir='';
+ 		foreach (@dirs) {
+ 			$checkdir.="$_/";
+ 			unless (-e "$checkdir") {
+ 				mkdir($checkdir, 0775);
+ 			}
+ 		}
+ 	}
+ }
+ 
+ chmod 0770, $backupdir;
+ 
+ # Backup MySql database
+ #
+ #
+ my $mysql;
+ my $mysqldir;
+ 
+ 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
+ #'
+ 	}
+ } else {
+ print "Doing backup\n";
+ }
+ 
+ my ($sec, $min, $hr, $day, $month, $year) = (localtime(time))[0,1,2,3,4,5];
+ $month++;
+ $year+=1900;
+ my $date= sprintf "%4d-%02d-%02d_%02d:%02d:%02d", $year, $month, $day,$hr,$min,$sec;
+ 
+ open (MD, "$mysqldir/bin/mysqldump --user=$user --password=$pass --host=$hostname $database|");
+ 
+ (open BF, ">$backupdir/Koha.backup_$date") || (die "Error opening up backup file $backupdir/Koha.backup_$date: $!\n");
+ 
+ my $itemcounter=0;
+ my $bibliocounter=0;
+ my $biblioitemcounter=0;
+ my $membercounter=0;
+ 
+ while (<MD>) {
+ 	(/insert into items /i) && ($itemcounter++);
+ 	(/insert into biblioitems /i) && ($biblioitemcounter++);
+ 	(/insert into biblio /i) && ($bibliocounter++);
+ 	(/insert into borrowers /i) && ($membercounter++);
+ 	print BF $_;
+ }
+ 
+ close BF;
+ close MD;
+ 
+ my $filels=`ls -hl $backupdir/Koha.backup_$date`;
+ chomp $filels;
+ printf qq|
+ 
+ Backed up:
+ 
+ %6d biblio entries
+ %6d biblioitems entries
+ %6d items entries
+ %6d borrowers
+ 
+ File Listing
+ ---------------------------------------------------------------------
+ $filels
+ ---------------------------------------------------------------------
+ 
+ Does this look right? ([Y]/N):
+ |, $bibliocounter, $biblioitemcounter, $itemcounter, $membercounter;
+ 
+ $answer = <STDIN>;
+ chomp $answer;
+ 
+ if ($answer=~/^n/i) {
+     print qq|
+ 
+ Aborting.  The database dump is located in:
+ 
+ 	$backupdir/Koha.backup_$date
+ 
+ |;
+     exit;
+ } else {
+ 	print "Great! continuing upgrade... \n";
+ };
+ 
+ 
+ 
+ }
  
  =item finalizeconfigfile
***************
*** 1775,1778 ****
--- 2028,2032 ----
  
  	#MJR: reverted to r1.53.  Please call setetcdir().  Do NOT hardcode this.
+ 	#FIXME: make a dated backup
      open (KC, "<$etcdir/koha.conf");
      while (<KC>) {
***************
*** 1791,1802 ****
      }
  
!     $::intranetdir=$configfile{'intranetdir'};
!     $::opacdir=$configfile{'opacdir'};
!     $::kohaversion=$configfile{'kohaversion'};
!     $::kohalogdir=$configfile{'kohalogdir'};
!     $::database=$configfile{'database'};
!     $::hostname=$configfile{'hostname'};
!     $::user=$configfile{'user'};
!     $::pass=$configfile{'pass'};
  }
  
--- 2045,2057 ----
      }
  
! 	#MJR: Reverted this too. You do not mess with my privates. Please ask for new functions if required.
!     $intranetdir=$configfile{'intranetdir'};
!     $opacdir=$configfile{'opacdir'};
!     $kohaversion=$configfile{'kohaversion'};
!     $kohalogdir=$configfile{'kohalogdir'};
!     $database=$configfile{'database'};
!     $hostname=$configfile{'hostname'};
!     $user=$configfile{'user'};
!     $pass=$configfile{'pass'};
  }
  
***************
*** 1846,1851 ****
  =head1 SEE ALSO
  
! buildrelease.pl,
  installer.pl
  
  =cut
--- 2101,2107 ----
  =head1 SEE ALSO
  
! buildrelease.pl
  installer.pl
+ koha.upgrade
  
  =cut

Index: koha.upgrade
===================================================================
RCS file: /cvsroot/koha/koha/misc/koha.upgrade,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** koha.upgrade	26 Oct 2003 12:21:14 -0000	1.8
--- koha.upgrade	26 Oct 2003 13:21:19 -0000	1.9
***************
*** 10,22 ****
  # SET  THE  etcdir  ENVIRONMENT  VAR  INSTEAD #
  ###############################################
! my $etcdir = $ENV{etcdir}||'/etc';
! system("mkdir -p $etcdir");
! 
! Install::setetcdir $etcdir;
  
  my $input;
  loadconfigfile();
  
- 
  ($::kohaversion) || ($::kohaversion='unknown version');
  $::newversion=`cat koha.version`;
--- 10,18 ----
  # SET  THE  etcdir  ENVIRONMENT  VAR  INSTEAD #
  ###############################################
! Install::setetcdir($ENV{etcdir}||'/etc');
  
  my $input;
  loadconfigfile();
  
  ($::kohaversion) || ($::kohaversion='unknown version');
  $::newversion=`cat koha.version`;
***************
*** 26,51 ****
  }
  
! print qq|
! 
! ================
! = Koha Upgrade =
! ================
! 
! You are attempting to upgrade from Koha $::kohaversion to $::newversion.
! 
! We recommend that you do a complete backup of all your files before upgrading.
! This upgrade script will make a backup copy of your files for you.
! 
! Would you like to proceed?  (Y/[N]):
! |;
! 
! my $answer = <STDIN>;
! chomp $answer;
  
  unless ($answer =~/y/i) {
! 	print qq|
! 
! Aborting.  Please re-run koha.upgrade when you are ready to upgrade Koha.
! |;
  	exit;
  } else {
--- 22,30 ----
  }
  
! #FIXME: need kohaversion number
! showmessage(getmessage('WelcomeToUpgrader',[$::kohaversion,$::newversion]),'yn');
  
  unless ($answer =~/y/i) {
! 	showmessage(getmessage('AbortingInstall'),'PressEnter');
  	exit;
  } else {
***************
*** 54,514 ****
  
  checkperlmodules();
! 
! my $backupdir=($ENV{prefix}||'/usr/local/koha').'/backups';
! print "Please specify a backup directory [$backupdir]: ";
! 
! $answer = <STDIN>;
! chomp $answer;
! 
! if ($answer) {
! 	$backupdir=$answer;
! }
! 
! if (! -e $backupdir) {
! 	my $result=mkdir ($backupdir, oct(770));
! 	if ($result==0) {
! 		my @dirs = split(m#/#, $backupdir);
! 		my $checkdir='';
! 		foreach (@dirs) {
! 			$checkdir.="$_/";
! 			unless (-e "$checkdir") {
! 				mkdir($checkdir, 0775);
! 			}
! 		}
! 	}
! }
! 
! chmod 0770, $backupdir;
! 
! # Backup MySql database
  #
! #
! my $mysql;
! my $mysqldir;
! 
! 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
! #'
! 	}
! } else {
! print "Doing backup\n";
! }
! 
! my ($sec, $min, $hr, $day, $month, $year) = (localtime(time))[0,1,2,3,4,5];
! $month++;
! $year+=1900;
! my $date= sprintf "%4d-%02d-%02d_%02d:%02d:%02d", $year, $month, $day,$hr,$min,$sec;
! 
! open (MD, "$mysqldir/bin/mysqldump --user=$::user --password=$::pass --host=$::hostname $::database|");
! 
! (open BF, ">$backupdir/Koha.backup_$date") || (die "Error opening up backup file $backupdir/Koha.backup_$date: $!\n");
! 
! my $itemcounter=0;
! my $bibliocounter=0;
! my $biblioitemcounter=0;
! my $membercounter=0;
! 
! while (<MD>) {
! 	(/insert into items /i) && ($itemcounter++);
! 	(/insert into biblioitems /i) && ($biblioitemcounter++);
! 	(/insert into biblio /i) && ($bibliocounter++);
! 	(/insert into borrowers /i) && ($membercounter++);
! 	print BF $_;
! }
! 
! close BF;
! close MD;
! 
! my $filels=`ls -hl $backupdir/Koha.backup_$date`;
! chomp $filels;
! printf qq|
! 
! Backed up:
! 
! %6d biblio entries
! %6d biblioitems entries
! %6d items entries
! %6d borrowers
! 
! File Listing
! ---------------------------------------------------------------------
! $filels
! ---------------------------------------------------------------------
! 
! Does this look right? ([Y]/N):
! |, $bibliocounter, $biblioitemcounter, $itemcounter, $membercounter;
! 
! $answer = <STDIN>;
! chomp $answer;
! 
! if ($answer=~/^n/i) {
!     print qq|
! 
! Aborting.  The database dump is located in:
! 
! 	$backupdir/Koha.backup_$date
! 
! |;
!     exit;
! } else {
! 	print "Great! continuing upgrade... \n";
! };
! 
! 
! 
! if ($::opacdir && $::intranetdir) {
!     print qq|
! 
! I believe that your old files are located in:
! 
!   OPAC:      $::opacdir
!   LIBRARIAN: $::intranetdir
! 
! 
! Does this look right?  ([Y]/N):
! |;
!     $answer = <STDIN>;
!     chomp $answer;
! 
!     if ($answer =~/n/i) {
! 	$::intranetdir='';
! 	$::opacdir='';
!     } else {
! 	print "Great! continuing upgrade... \n";
!     }
! }
! 
! 
! if (!$::opacdir || !$::intranetdir) {
!     $::intranetdir='';
!     $::opacdir='';
!     while (!$::intranetdir) {
! 	print "Please specify the location of your LIBRARIAN files: ";
! 
! 	$answer = <STDIN>;
! 	chomp $answer;
! 
! 	if ($answer) {
! 	    $::intranetdir=$answer;
! 	}
! 	if (! -e "$::intranetdir/htdocs") {
! 	    print "\nCouldn't find the htdocs directory here.  That doesn't look right.\nPlease enter another location.\n\n";
! 	    $::intranetdir='';
! 	}
!     }
!     while (!$::opacdir) {
! 	print "Please specify the location of your OPAC files: ";  
! 
! 	$answer = <STDIN>;
! 	chomp $answer;
! 
! 	if ($answer) {
! 	    $::opacdir=$answer;
! 	}
! 	if (! -e "$::opacdir/htdocs") {
! 	    print "\nCouldn't find the htdocs directory here.  That doesn't look right.\nPlease enter another location.\n\n";
! 	    $::opacdir='';
! 	}
!     }
! }
! 
! 
! 
! print "\n\nBacking up old Koha scripts...\n";
! print     "===============================\n\n";
! 
! mkdir "$backupdir/kohafiles-$date", 0770;
! mkdir "$backupdir/kohafiles-$date/intranet", 0770;
! mkdir "$backupdir/kohafiles-$date/opac", 0770;
! 
! my $result=system("cp -R $::intranetdir/* $backupdir/kohafiles-$date/intranet/");
! if ($result) {
!     print "Error encounted when copying $::intranetdir to $backupdir/kohafiles-$date/intranet/\n";
!     exit;
! } else {
!     system("rm -rf $::intranetdir/*");
! }
! $result=system("cp -R $::opacdir/* $backupdir/kohafiles-$date/opac/");
! if ($result) {
!     print "Error encounted when copying $::opacdir to $backupdir/kohafiles-$date/opac/\n";
!     exit;
! } else {
!     system("rm -rf $::opacdir/*");
! }
! 
!    print "Creating $::intranetdir/htdocs...\n";
!    mkdir ("$::intranetdir/htdocs", oct(750));
!    print "Creating $::intranetdir/cgi-bin...\n";
!    mkdir ("$::intranetdir/cgi-bin", oct(750));
!    print "Creating $::intranetdir/modules...\n";
!    mkdir ("$::intranetdir/modules", oct(750));
!    print "Creating $::intranetdir/scripts...\n";
!    mkdir ("$::intranetdir/scripts", oct(750));
!    chmod (oct(770), "$::opacdir");
!    print "Creating $::opacdir/htdocs...\n";
!    mkdir ("$::opacdir/htdocs", oct(750));
!    print "Creating $::opacdir/cgi-bin...\n";
!    mkdir ("$::opacdir/cgi-bin", oct(750));
! 
! 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/conf/commonhttpd.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 ($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
! 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';
!     }
! }
! 
! 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";
! 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/");
! print "Copying opac-cgi files to $::opacdir/cgi-bin...\n";
! system("cp -R opac-cgi/* $::opacdir/cgi-bin/");
! system("touch $::opacdir/cgi-bin/opac");
! 
! system("chown -R root:$httpduser $::opacdir");
! system("chown -R root:$httpduser $::intranetdir");
! 
! 
! # Copy custom templates and reports back in
! 
! opendir D, "$backupdir/kohafiles-$date/intranet/htdocs/";
! my @dirlist=readdir D;
! foreach (@dirlist) {
!     (next) if (/^\./);
!     (next) if ($_ eq 'default');
!     (next) if ($_ eq 'doc');
!     (next) if ($_=~/^koha-/);
!     (next) if (-e "$::intranetdir/htdocs/$_");
!     print "Restoring custom intranet templates $_...\n";
!     system("cp -a $backupdir/kohafiles-$date/intranet/htdocs/$_ $::intranetdir/htdocs/");
! }
! 
! opendir D, "$backupdir/kohafiles-$date/opac/htdocs/";
! @dirlist=readdir D;
! foreach (@dirlist) {
!     (next) if (/^\./);
!     (next) if ($_ eq 'default');
!     (next) if ($_ eq 'doc');
!     (next) if ($_=~/^koha-/);
!     (next) if (-e "$::opacdir/htdocs/$_");
!     print "Restoring custom opac template $_...\n";
!     system("cp -a $backupdir/kohafiles-$date/opac/htdocs/$_ $::opacdir/htdocs/");
! }
! 
! 
! 
! 
! 
! unless ($::kohalogdir && -e $::kohalogdir) {
!     $::kohalogdir='/var/log/koha';
!     print "\n\nDirectory for logging by Z39.50 daemon [$::kohalogdir]: ";
!     chomp($input = <STDIN>);
!     if ($input) {
! 	$::kohalogdir=$input;
!     }
! }
! 
! unless (-e "$::kohalogdir") {
!     my $result = mkdir 0770, "$::kohalogdir";
!     if ($result==0) {
!         my @dirs = split(m#/#, $::kohalogdir);
! 	my $checkdir='';
! 	foreach (@dirs) {
! 	    $checkdir.="$_/";
! 	    unless (-e "$checkdir") {
! 		mkdir($checkdir, 0775);
! 	    }
! 	}
!     }
! }
! 
! 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: $!";
! 
! 
! 
! my $kccontents='';open (KC, "/etc/koha.conf");
! my $kc;
! while (<KC>) {
!     if (/^\s*includes\s*=/) {
! 	$kccontents.="includes=$::intranetdir/htdocs/includes\n";
! 	$kc->{'includes'}=1;
!     } elsif (/^\s*httpduser\s*=/) {
! 	$kccontents.="httpduser=$httpduser\n";
! 	$kc->{'httpduser'}=1;
!     } elsif (/^\s*kohaversion\s*=/) {
! 	$kccontents.="kohaversion=$::newversion\n";
! 	$kc->{'kohaversion'}=1;
!     } elsif (/^\s*kohalogdir\s*=/) {
! 	$kccontents.="kohalogdir=$::kohalogdir\n";
! 	$kc->{'kohalogdir'}=1;
!     } elsif (/^\s*intranetdir\s*=/) {
! 	$kccontents.="intranetdir=$::intranetdir\n";
! 	$kc->{'intranetdir'}=1;
!     } elsif (/^\s*opacdir\s*=/) {
! 	$kccontents.="opacdir=$::opacdir\n";
! 	$kc->{'opacdir'}=1;
!     } else {
! 	$kccontents.="$_";
!     }
! }
! 
! unless (defined($kc->{'kohaversion'})) {
!     $kccontents.="kohaversion=$::newversion\n";
! }
! unless (defined($kc->{'includes'})) {
!     $kccontents.="includes=$::intranetdir/htdocs/includes\n";
! }
! unless (defined($kc->{'httpduser'})) {
!     $kccontents.="httpduser=$httpduser\n";
! }
! unless (defined($kc->{'intranetdir'})) {
!     $kccontents.="intranetdir=$::intranetdir\n";
! }
! unless (defined($kc->{'opacdir'})) {
!     $kccontents.="opacdir=$::opacdir\n";
! }
! unless (defined($kc->{'kohalogdir'})) {
!     $kccontents.="kohalogdir=$::kohalogdir\n";
! }
! 
! 
! system("mv /etc/koha.conf /etc/koha.conf.backup");
! 
! open (KC, ">/etc/koha.conf") || warn "Couldn't open /etc/koha.conf for writing.";
! print KC $kccontents;
! close KC;
! 
! 
! print qq|
! 
! Upgrading Database
! ==================
! |;
! system ("perl -I $::intranetdir/modules scripts/updater/updatedatabase");
! 
! 
! print qq|
! 
! ==================
! = Authentication =
! ==================
! 
! This release of Koha has a new authentication module.  If you are not already
! using basic authentication on your intranet, you will be required to log in to
! access some of the features of the intranet.  You can log in using the userid
! and password from the koha.conf configuration file at any time.  Use the
! "Members" module to add passwords for other accounts and set their permissions.
! |;
! print "Press the <ENTER> key to continue: ";
! <STDIN>;
! 
! 
! 
! print qq|
! 
! ==========================
! = Koha Upgrade Completed =
! ==========================
! The Koha Upgrade is finished.
! If you are upgrading from a version of Koha
! prior to 1.2.1, it is likely that you will have to modify your Apache
! configuration to point it to the new files.
! 
! In your INTRANET VirtualHost section you should have:
!   DocumentRoot $::intranetdir/htdocs
!   ScriptAlias /cgi-bin/koha/ $::intranetdir/cgi-bin/
!   SetEnv PERL5LIB $::intranetdir/modules
! 
! In the OPAC VirtualHost section you should have:
!   DocumentRoot $::opacdir/htdocs
!   ScriptAlias /cgi-bin/koha/ $::opacdir/cgi-bin/
!   SetEnv PERL5LIB $::intranetdir/modules
! 
! You may also need to uncomment a "LoadModules env_module ... " line and restart
! Apache.
! If you're upgrading from 1.2.x version of Koha note that the MARC DB is NOT populated.
! To populate it :
! * launch Koha
! * Go to Parameters >> Marc structure option and Koha-MARC links option.
! * Modify default MARC structure to fit your needs.
! * open a console
! * type:
! cd /path/to/koha/misc
! export PERL5LIB=/path/to/koha
! ./koha2marc.pl
! the old DB is "copied" in the new MARC one.
! Koha 2.0.0 is ready :-)
! 
! Please report any problems you encounter through http://bugs.koha.org/
! |;
  
  
  my $reply=showmessage('Would you like to complete a survey about your library?', 'yn', 'y');
--- 33,69 ----
  
  checkperlmodules();
! backupkoha();
! getapacheinfo();
! installfiles();
! 
! #FIXME: Copy custom templates and reports back in, or warn
! 
! #opendir D, "$backupdir/kohafiles-$date/intranet/htdocs/";
! #my @dirlist=readdir D;
! #foreach (@dirlist) {
! #    (next) if (/^\./);
! #    (next) if ($_ eq 'default');
! #    (next) if ($_ eq 'doc');
! #    (next) if ($_=~/^koha-/);
! #    (next) if (-e "$::intranetdir/htdocs/$_");
! #    print "Restoring custom intranet templates $_...\n";
! #    system("cp -a $backupdir/kohafiles-$date/intranet/htdocs/$_ $::intranetdir/htdocs/");
! #}
  #
! #opendir D, "$backupdir/kohafiles-$date/opac/htdocs/";
! #@dirlist=readdir D;
! #foreach (@dirlist) {
! #    (next) if (/^\./);
! #    (next) if ($_ eq 'default');
! #    (next) if ($_ eq 'doc');
! #    (next) if ($_=~/^koha-/);
! #    (next) if (-e "$::opacdir/htdocs/$_");
! #    print "Restoring custom opac template $_...\n";
! #    system("cp -a $backupdir/kohafiles-$date/opac/htdocs/$_ $::opacdir/htdocs/");
! #}
! updatedatabase();
! finalizeconfigfile();
  
+ showmessage(getmessage('UpgradeCompleted'),'PressEnter');
  
  my $reply=showmessage('Would you like to complete a survey about your library?', 'yn', 'y');





More information about the Koha-cvs mailing list