From 539d1fa7ca2189aa61a2f5a51b6674f793f3f1f1 Mon Sep 17 00:00:00 2001 From: tipaul Date: Mon, 20 Oct 2003 14:25:36 +0000 Subject: [PATCH] koha.upgrade bugfixes. Should work... --- misc/Install.pm | 18 ++++---- misc/koha.upgrade | 103 +++++++++++++++++++++++++--------------------- 2 files changed, 64 insertions(+), 57 deletions(-) diff --git a/misc/Install.pm b/misc/Install.pm index 02d7d9d714..74420d6efa 100644 --- a/misc/Install.pm +++ b/misc/Install.pm @@ -1771,7 +1771,7 @@ the file is silently ignored. sub loadconfigfile { my %configfile; - open (KC, "<$etcdir/koha.conf"); + open (KC, ") { chomp; (next) if (/^\s*#/); @@ -1787,14 +1787,14 @@ sub loadconfigfile { } } - $intranetdir=$configfile{'intranetdir'}; - $opacdir=$configfile{'opacdir'}; - $kohaversion=$configfile{'kohaversion'}; - $kohalogdir=$configfile{'kohalogdir'}; - $database=$configfile{'database'}; - $hostname=$configfile{'hostname'}; - $user=$configfile{'user'}; - $pass=$configfile{'pass'}; + $::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/misc/koha.upgrade b/misc/koha.upgrade index 7e76d430db..9391debe68 100644 --- a/misc/koha.upgrade +++ b/misc/koha.upgrade @@ -7,22 +7,19 @@ use Install; $::language='en'; if ($<) { - print "\n\nYou must run koha.upgrade as root.\n\n"; - exit; + print "\n\nYou must run koha.upgrade as root.\n\n"; + exit; } my $input; - - loadconfigfile(); - ($::kohaversion) || ($::kohaversion='unknown version'); $::newversion=`cat koha.version`; chomp $::newversion; if ($::newversion =~ /RC/) { - releasecandidatewarning(); + releasecandidatewarning(); } print qq| @@ -36,50 +33,46 @@ 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): +Would you like to proceed? (Y/[N]): |; my $answer = ; chomp $answer; -if ($answer =~/n/i) { - print qq| +unless ($answer =~/y/i) { + print qq| Aborting. Please re-run koha.upgrade when you are ready to upgrade Koha. |; - exit; + exit; } else { - print "Great! continuing upgrade... \n"; + print "Great! continuing upgrade... \n"; }; - - checkperlmodules(); - - my $backupdir='/usr/local/koha/backups'; -print "Please specify a backup directory [$backupdir]: "; +print "Please specify a backup directory [$backupdir]: "; $answer = ; chomp $answer; if ($answer) { - $backupdir=$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); - } + 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; @@ -91,17 +84,33 @@ my $mysql; my $mysqldir; foreach my $mysql (qw(/usr/local/mysql - /opt/mysql - )) { - if ( -d $mysql ) { - $mysqldir=$mysql; - } + /opt/mysql + /usr + )) { + if ( -d $mysql && -f "$mysql/bin/mysqladmin") { + $mysqldir=$mysql; + } } if (!$mysqldir){ - $mysqldir='/usr'; -} + print "I don't see mysql in the usual places.\n"; + for (;;) { + print "Where have you installed mysql? "; + chomp($mysqldir = ); + last if -f "$mysqldir/bin/mysqladmin"; + print <) { - (/insert into items /i) && ($itemcounter++); - (/insert into biblioitems /i) && ($biblioitemcounter++); - (/insert into biblio /i) && ($bibliocounter++); - (/insert into borrowers /i) && ($membercounter++); - print BF $_; + (/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| @@ -193,7 +201,7 @@ if (!$::opacdir || !$::intranetdir) { $::intranetdir=''; $::opacdir=''; while (!$::intranetdir) { - print "Please specify the location of your INTRANET files: "; + print "Please specify the location of your INTRANET files: "; $answer = ; chomp $answer; @@ -271,6 +279,7 @@ foreach my $httpdconf (qw(/usr/local/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; @@ -361,7 +370,7 @@ unless ($::kohalogdir && -e $::kohalogdir) { } unless (-e "$::kohalogdir") { - my $result = mkdir 0770, "$::kohalogdir"; + my $result = mkdir 0770, "$::kohalogdir"; if ($result==0) { my @dirs = split(m#/#, $::kohalogdir); my $checkdir=''; @@ -381,8 +390,8 @@ chown(0, (getpwnam($httpduser)) [3], "$::intranetdir/scripts/z3950daemon/z3950-d chown(0, (getpwnam($httpduser)) [3], "$::intranetdir/scripts/z3950daemon/processz3950queue") or warn "can't chown $::intranetdir/scripts/z3950daemon/processz3950queue: $!"; -open (KC, "/etc/koha.conf"); -my $kccontents=''; + +my $kccontents='';open (KC, "/etc/koha.conf"); my $kc; while () { if (/^\s*includes\s*=/) { @@ -454,9 +463,6 @@ 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 /etc/koha.conf configuration file at any time. Use the "Members" module to add passwords for other accounts and set their permissions. - -[NOTE PERMISSIONS ARE NOT COMPLETED AS OF 1.2.3RC1. Do not give passwords to - any patrons unless you want them to have full access to your intranet.] |; print "Press the key to continue: "; ; @@ -468,7 +474,8 @@ print qq| ========================== = Koha Upgrade Completed = ========================== -The Koha Upgrade is finished. If you are upgrading from a version of Koha +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. -- 2.20.1