From 6a6cd90e224f203798b3653db370533f7fe05600 Mon Sep 17 00:00:00 2001 From: tonnesen Date: Fri, 26 Jul 2002 13:46:50 +0000 Subject: [PATCH] added some new modular code to koha.upgrade --- Install.pm | 32 ++++++++++- buildrelease | 1 + koha.upgrade | 147 ++------------------------------------------------- 3 files changed, 36 insertions(+), 144 deletions(-) diff --git a/Install.pm b/Install.pm index 2ca1fd58ef..49802ece7f 100644 --- a/Install.pm +++ b/Install.pm @@ -22,6 +22,7 @@ $VERSION = 0.01; &installfiles &databasesetup &restartapache + &loadconfigfile ); @@ -162,7 +163,7 @@ and password from the /etc/koha.conf configuration file at any time. Use the [NOTE PERMISSIONS ARE NOT COMPLETED AS OF THIS RELEASE. Do not give passwords to any patrons unless you want them to have full access to your intranet.] -print "Press the key to continue: |; +Press the key to continue: |; $messages->{'Completed'}->{en}=qq| ============================== @@ -1168,5 +1169,34 @@ sub restartapache { } +sub loadconfigfile { + my %configfile; + + open (KC, "/etc/koha.conf"); + while () { + chomp; + (next) if (/^\s*#/); + if (/(.*)\s*=\s*(.*)/) { + my $variable=$1; + my $value=$2; + # Clean up white space at beginning and end + $variable=~s/^\s*//g; + $variable=~s/\s*$//g; + $value=~s/^\s*//g; + $value=~s/\s*$//g; + $configfile{$variable}=$value; + } + } + + $::intranetdir=$configfile{'intranetdir'}; + $::opacdir=$configfile{'opacdir'}; + $::kohaversion=$configfile{'kohaversion'}; + $::kohalogdir=$configfile{'kohalogdir'}; + $::database=$configfile{'database'}; + $::hostname=$configfile{'hostname'}; + $::user=$configfile{'user'}; + $::pass=$configfile{'pass'}; +} + END { } # module clean-up code here (global destructor) diff --git a/buildrelease b/buildrelease index 9468eb0ce4..80888a09d5 100644 --- a/buildrelease +++ b/buildrelease @@ -223,6 +223,7 @@ system("mv $rootdir/intranet-cgi/README $rootdir"); system("mv $rootdir/intranet-cgi/TODO $rootdir"); system("mv $rootdir/intranet-cgi/installer.pl $rootdir"); system("mv $rootdir/intranet-cgi/koha.upgrade $rootdir"); +system("mv $rootdir/intranet-cgi/Install.pm $rootdir"); chmod 0770, "$rootdir/installer.pl"; chmod 0770, "$rootdir/koha.upgrade"; system("mv $rootdir/intranet-cgi/koha.conf $rootdir"); diff --git a/koha.upgrade b/koha.upgrade index 668798ffa4..376d4ed3a0 100644 --- a/koha.upgrade +++ b/koha.upgrade @@ -11,67 +11,16 @@ if ($<) { my $input; -my %configfile; -open (KC, "/etc/koha.conf"); -while () { - chomp; - (next) if (/^\s*#/); - if (/(.*)\s*=\s*(.*)/) { - my $variable=$1; - my $value=$2; - # Clean up white space at beginning and end - $variable=~s/^\s*//g; - $variable=~s/\s*$//g; - $value=~s/^\s*//g; - $value=~s/\s*$//g; - $configfile{$variable}=$value; - } -} +loadconfigfile(); -my $intranetdir=$configfile{'intranetdir'}; -my $opacdir=$configfile{'opacdir'}; -my $kohaversion=$configfile{'kohaversion'}; -my $kohalogdir=$configfile{'kohalogdir'}; -my $database=$configfile{'database'}; -my $hostname=$configfile{'hostname'}; -my $user=$configfile{'user'}; -my $pass=$configfile{'pass'}; ($kohaversion) || ($kohaversion='unknown version'); my $newversion=`cat koha.version`; chomp $newversion; -if ($newversion =~ /RC/) { - print qq| -===================== -= RELEASE CANDIDATE = -===================== - -WARNING WARNING WARNING WARNING WARNING - -You are about to install Koha version $newversion. 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 $newversion? (Y/[N]): "; - - my $answer = ; - 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; - }; +if ($::kohaversion =~ /RC/) { + releasecandidatewarning(); } print qq| @@ -103,56 +52,7 @@ Aborting. Please re-run koha.upgrade when you are ready to upgrade Koha. -# -# 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 key to continue: -|; - ; -} - -# -# 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"; -}; +checkperlmodules(); @@ -414,24 +314,6 @@ system("cp -R opac-cgi/* $opacdir/cgi-bin/"); system("chown -R root.$httpduser $opacdir"); system("chown -R root.$httpduser $intranetdir"); -# LAUNCH SCRIPT -print "Modifying Z39.50 daemon launch script...\n"; -my $newfile=''; -open (L, "$intranetdir/scripts/z3950daemon/z3950-daemon-launch.sh"); -while () { - if (/^RunAsUser=/) { - $newfile.="RunAsUser=$httpduser\n"; - } elsif (/^KohaZ3950Dir=/) { - $newfile.="KohaZ3950Dir=$intranetdir/scripts/z3950daemon\n"; - } else { - $newfile.=$_; - } -} -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; unless ($kohalogdir && -e $kohalogdir) { $kohalogdir='/var/log/koha'; @@ -456,27 +338,6 @@ unless (-e "$kohalogdir") { } } -# SHELL SCRIPT -print "Modifying Z39.50 daemon wrapper script...\n"; -$newfile=''; -open (S, "$intranetdir/scripts/z3950daemon/z3950-daemon-shell.sh"); -while () { - if (/^KohaModuleDir=/) { - $newfile.="KohaModuleDir=$intranetdir/modules\n"; - } elsif (/^KohaZ3950Dir=/) { - $newfile.="KohaZ3950Dir=$intranetdir/scripts/z3950daemon\n"; - } elsif (/^LogDir=/) { - $newfile.="LogDir=$kohalogdir\n"; - } else { - $newfile.=$_; - } -} -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"; -- 2.39.5