koha.upgrade wasn't rewriting the variables in the z3950 daemon scripts.

Modified installer.pl to store the $kohalogdir variable in /etc/koha.conf
This commit is contained in:
tonnesen 2002-07-09 19:39:23 +00:00
parent 5d8f1fce5f
commit 46bb67bb60
3 changed files with 109 additions and 29 deletions

View File

@ -280,7 +280,7 @@ system("find $rootdir -name CVS -exec rm -rf \\{\\} \\; 2>/dev/null");
system("find $rootdir -name *~ -exec rm -rf \\{\\} \\; 2>/dev/null");
system("find $rootdir -name .#* -exec rm -rf \\{\\} \\; 2>/dev/null");
if (-e "/root/docs") {
if (-e "/root/docs/manual") {
print "Copying docs folder from /root/docs...";
system("cp -r /root/docs/* $rootdir/docs/");
} else {

View File

@ -327,6 +327,7 @@ pass=$pass
includes=$kohadir/htdocs/includes
intranetdir=$kohadir
opacdir=$opacdir
kohalogdir=$kohalogdir
kohaversion=$kohaversion
httpduser=$httpduser
EOP
@ -584,6 +585,33 @@ EOP
print "Successfully updated Apache Configuration file.\n";
}
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
#
@ -815,32 +843,6 @@ Press <ENTER> to continue...
}
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: $!";

View File

@ -3,12 +3,16 @@
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>) {
chomp;
@ -28,6 +32,7 @@ while (<KC>) {
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'};
@ -117,7 +122,7 @@ my $date= sprintf "%4d-%02d-%02d_%02d:%02d:%02d", $year, $month, $day,$hr,$min,$
open (MD, "$mysqldir/bin/mysqldump --user=$user --password=$pass --host=$hostname $database|");
open BF, ">$backupdir/Koha.backup_$date";
(open BF, ">$backupdir/Koha.backup_$date") || (die "Error opening up backup file $backupdir/Koha.backup_$date: $!\n");
my $itemcounter=0;
my $bibliocounter=0;
@ -296,7 +301,6 @@ information is necessary in order to set the access privileges correctly on
files using the "User" directive.
|;
print "What is your Apache user? ";
my $input;
chomp($input = <STDIN>);
if ($input) {
@ -324,6 +328,74 @@ 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 (<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");
@ -339,6 +411,9 @@ while (<KC>) {
} 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;
@ -365,6 +440,9 @@ unless (defined($kc->{'intranetdir'})) {
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");