[Koha-cvs] CVS: koha installer.pl,1.5,1.6 koha.upgrade,1.2,1.3
Steve Tonnesen
tonnesen at users.sourceforge.net
Tue Jul 23 00:33:06 CEST 2002
Update of /cvsroot/koha/koha
In directory usw-pr-cvs1:/tmp/cvs-serv30550
Modified Files:
installer.pl koha.upgrade
Log Message:
Changes from rel-1-2 branch
Index: installer.pl
===================================================================
RCS file: /cvsroot/koha/koha/installer.pl,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** installer.pl 8 Jul 2002 18:34:35 -0000 1.5
--- installer.pl 22 Jul 2002 22:33:03 -0000 1.6
***************
*** 1,5 ****
#!/usr/bin/perl -w # please develop with -w
! use diagnostics;
use strict; # please develop with the strict pragma
--- 1,5 ----
#!/usr/bin/perl -w # please develop with -w
! #use diagnostics;
use strict; # please develop with the strict pragma
***************
*** 16,19 ****
--- 16,52 ----
chomp $kohaversion;
+
+ if ($kohaversion =~ /RC/) {
+ print qq|
+ =====================
+ = RELEASE CANDIDATE =
+ =====================
+
+ WARNING WARNING WARNING WARNING WARNING
+
+ You are about to install Koha version $kohaversion. 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 $kohaversion? (Y/[N]): ";
+
+ my $answer = <STDIN>;
+ 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 (-e "/etc/koha.conf") {
my $installedversion=`grep kohaversion= /etc/koha.conf`;
***************
*** 96,114 ****
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 <ENTER> key to continue:
! #|;
! # <STDIN>;
! #}
#
--- 129,147 ----
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 <ENTER> key to continue:
! |;
! <STDIN>;
! }
#
***************
*** 298,301 ****
--- 331,359 ----
}
}
+ unless ($realhttpdconf) {
+ print qq|
+
+ I was not able to find your apache configuration file. It is usually
+ called httpd.conf or apache.conf.
+ |;
+ print "Where is your Apache configuratin file? ";
+ chomp($input = <STDIN>);
+
+ if ($input) {
+ $realhttpdconf = $input;
+ } else {
+ $realhttpdconf='';
+ }
+ if ( -f $realhttpdconf ) {
+ open (HTTPDCONF, $realhttpdconf) or warn "Insufficient privileges to open $realhttpdconf for reading.\n";
+ while (<HTTPDCONF>) {
+ if (/^\s*User\s+"?([-\w]+)"?\s*$/) {
+ $httpduser = $1;
+ }
+ }
+ close(HTTPDCONF);
+ }
+ }
+
unless ($httpduser) {
print qq|
***************
*** 317,337 ****
- #Create the configuration file
- open(SITES,">$etcdir/koha.conf") or warn "Couldn't create file
- at $etcdir. Must have write capability.\n";
- print SITES <<EOP
- database=$dbname
- hostname=$hostname
- user=$user
- pass=$pass
- includes=$kohadir/htdocs/includes
- intranetdir=$kohadir
- opacdir=$opacdir
- kohaversion=$kohaversion
- httpduser=$httpduser
- EOP
- ;
- close(SITES);
-
#
# Set ownership of the koha.conf file for security
--- 375,378 ----
***************
*** 585,588 ****
--- 626,656 ----
}
+ print qq|
+
+ SETTING UP Z39.50 DAEMON
+ ========================
+ |;
+
+ my $kohalogdir='/var/log/koha';
+ print "Directory 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);
+ }
+ }
+ }
+ }
+
#
# Setup the modules directory
***************
*** 673,676 ****
--- 741,765 ----
system("chown -R root.$httpduser $kohadir");
+
+
+ #Create the configuration file
+ open(SITES,">$etcdir/koha.conf") or warn "Couldn't create file
+ at $etcdir. Must have write capability.\n";
+ print SITES <<EOP
+ database=$dbname
+ hostname=$hostname
+ user=$user
+ pass=$pass
+ includes=$kohadir/htdocs/includes
+ intranetdir=$kohadir
+ opacdir=$opacdir
+ kohalogdir=$kohalogdir
+ kohaversion=$kohaversion
+ httpduser=$httpduser
+ EOP
+ ;
+ close(SITES);
+
+
print qq|
***************
*** 816,845 ****
- print qq|
-
- SETTING UP Z39.50 DAEMON
- ========================
- |;
-
- my $kohalogdir='/var/log/koha';
- print "Directory 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 0770, $kohalogdir;
chown((getpwnam($httpduser)) [2,3], $kohalogdir) or warn "can't chown $kohalogdir: $!";
--- 905,908 ----
Index: koha.upgrade
===================================================================
RCS file: /cvsroot/koha/koha/koha.upgrade,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** koha.upgrade 2 Jul 2002 20:35:17 -0000 1.2
--- koha.upgrade 22 Jul 2002 22:33:03 -0000 1.3
***************
*** 1,5 ****
--- 1,17 ----
#!/usr/bin/perl -w
+ #use diagnostics;
+ use strict; # please develop with the strict pragma
+
+
+ if ($<) {
+ print "\n\nYou must run koha.upgrade as root.\n\n";
+ exit;
+ }
+
+ my $input;
+
my %configfile;
+
open (KC, "/etc/koha.conf");
while (<KC>) {
***************
*** 21,26 ****
my $opacdir=$configfile{'opacdir'};
my $kohaversion=$configfile{'kohaversion'};
my $database=$configfile{'database'};
! my $host=$configfile{'host'};
my $user=$configfile{'user'};
my $pass=$configfile{'pass'};
--- 33,39 ----
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'};
***************
*** 30,33 ****
--- 43,77 ----
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 = <STDIN>;
+ 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;
+ };
+ }
print qq|
***************
*** 58,61 ****
--- 102,158 ----
};
+
+ #
+ # 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 <ENTER> key to continue:
+ |;
+ <STDIN>;
+ }
+
+ #
+ # 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";
+ };
+
+
my $backupdir='/usr/local/koha/backups';
print "Please specify a backup directory [$backupdir]: ";
***************
*** 108,114 ****
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=$host $database|");
! open BF, ">$backupdir/Koha.backup_$date";
my $itemcounter=0;
--- 205,211 ----
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;
***************
*** 280,284 ****
}
}
! $httpduser ||= 'Undetermined';
print "\n\nINSTALLING KOHA...\n";
--- 377,397 ----
}
}
!
! 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
! /etc/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";
***************
*** 299,302 ****
--- 412,538 ----
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 (<L>) {
+ 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';
+ 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);
+ }
+ }
+ }
+ }
+
+ # SHELL SCRIPT
+ print "Modifying Z39.50 daemon wrapper script...\n";
+ $newfile='';
+ open (S, "$intranetdir/scripts/z3950daemon/z3950-daemon-shell.sh");
+ while (<S>) {
+ 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";
+ 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: $!";
+
+
+ open (KC, "/etc/koha.conf");
+ my $kccontents='';
+ 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;
More information about the Koha-cvs
mailing list