From f38f71eab9ad43e9c9f84bc9d1cc0b59e9f29c2c Mon Sep 17 00:00:00 2001 From: tonnesen Date: Wed, 3 Jul 2002 17:00:53 +0000 Subject: [PATCH] Modifies /etc/koha.conf, adding any missing entries. --- koha.upgrade | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 60 insertions(+), 1 deletion(-) diff --git a/koha.upgrade b/koha.upgrade index 2912dd5b0f..44649dbda1 100644 --- a/koha.upgrade +++ b/koha.upgrade @@ -279,7 +279,23 @@ foreach my $httpdconf (qw(/usr/local/apache/conf/httpd.conf close(HTTPDCONF); } } -$httpduser ||= 'Undetermined'; + +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 = ); + + if ($input) { + $httpduser = $input; + } else { + $httpduser='Undetermined'; + } +} print "\n\nINSTALLING KOHA...\n"; print "\n\n==================\n"; @@ -300,6 +316,49 @@ system("chown -R root.$httpduser $opacdir"); system("chown -R root.$httpduser $intranetdir"); + +open (KC, "/etc/koha.conf"); +my $kccontents=''; +my $kc; +while () { + if (/^\s*includes\s*=/) { + $kccontents.="includes=$intranetdir/htdocs/includes\n"; + $kc->{'includes'}=1; + } elsif (/^\s*kohaversion\s*=/) { + $kccontents.="kohaversion=$newversion\n"; + $kc->{'kohaversion'}=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->{'intranetdir'})) { + $kccontents.="intranetdir=$intranetdir\n"; +} +unless (defined($kc->{'opacdir'})) { + $kccontents.="opacdir=$opacdir\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 -- 2.39.5