Bugzilla – Attachment 15 Details for
Bug 91
installer.pl does not work with CVS version
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Proposed patch to fix/workaround the reported problems
koha-cvs-patch-20020910a.patch (text/plain), 7.33 KB, created by
Chris Cormack
on 2002-09-10 18:35:00 UTC
(
hide
)
Description:
Proposed patch to fix/workaround the reported problems
Filename:
MIME Type:
Creator:
Chris Cormack
Created:
2002-09-10 18:35:00 UTC
Size:
7.33 KB
patch
obsolete
>? typescript >Index: installer.pl >=================================================================== >RCS file: /cvsroot/koha/koha/installer.pl,v >retrieving revision 1.9 >diff -u -u -r1.9 installer.pl >--- installer.pl 6 Sep 2002 16:43:18 -0000 1.9 >+++ installer.pl 10 Sep 2002 06:27:27 -0000 >@@ -21,10 +21,6 @@ > > use strict; # please develop with the strict pragma > >-if ($<) { >- print "\n\nYou must run koha.upgrade as root.\n\n"; >- exit; >-} > unless ($< == 0) { > print "You must be root to run this script.\n"; > exit 1; >@@ -353,6 +349,10 @@ > > I was not able to find your apache configuration file. It is usually > called httpd.conf or apache.conf. >+ >+If you are not using apache, you can specify a non-existing file, like >+/tmp/httpd.conf, so that you can manually reconfigure your web server >+afterwards. > |; > print "Where is your Apache configuratin file? "; > chomp($input = <STDIN>); >@@ -651,7 +651,7 @@ > } > > unless (-e "$kohalogdir") { >- my $result = mkdir 0770, "$kohalogdir"; >+ my $result = mkdir "$kohalogdir", 0770; > if ($result==0) { > my @dirs = split(m#/#, $kohalogdir); > my $checkdir=''; >@@ -736,18 +736,53 @@ > > print "\n\nINSTALLING KOHA...\n"; > print "\n\n==================\n"; >+ >+# Figure out whether this is a normal release or CVS >+my @intranet_cgis = qw( acqui acqui.simple admin circ maint marc sec ); >+my @scripts = qw( misc telnet tkperl translator updater z3950daemon ); >+my @modules = qw( C4 ); >+my @z3950daemon_files = qw( processz3950queue z3950-daemon-launch.sh z3950-daemon-shell.sh); >+my $intranet_html_dir = -d 'intranet-html'? 'intranet-html': '../koha-html/intranet-html'; >+my $opac_html_dir = -d 'opac-html'? 'opac-html': '../koha-html/opac-html'; >+my $opac_cgi_dir = -d 'opac-cgi'? 'opac-cgi': 'html-template'; >+ >+if (!-d $intranet_html_dir && ! -d $opac_html_dir) { >+ die qq| >+You seem to be installing from CVS, and I don't know where the "koha-html" module is checked out. Sorry. >+|; >+} > print "Copying internet-html files to $kohadir/htdocs...\n"; >-system("cp -R intranet-html/* $kohadir/htdocs/"); >+system("cp -R $intranet_html_dir/* $kohadir/htdocs/"); > print "Copying intranet-cgi files to $kohadir/cgi-bin...\n"; >-system("cp -R intranet-cgi/* $kohadir/cgi-bin/"); >+if (-d 'intranet-cgi') { >+ system("cp -R intranet_cgi/* $kohadir/cgi-bin/"); >+} else { # probably CVS >+ system("cp -R *.pl @intranet_cgis $kohadir/cgi-bin/"); >+} > print "Copying script files to $kohadir/scripts...\n"; >-system("cp -R scripts/* $kohadir/scripts/"); >+if (-d 'scripts') { >+ system("cp -R scripts/* $kohadir/scripts/"); >+} else { # probably CVS >+ system("cp -R @scripts $kohadir/scripts/"); >+ # >+ # FIXME: z3950 stuff seems to be misplaced in CVS; temp. workaround below >+ # >+ if (!-d "z3950daemon" && -f "acqui.simple/processz3950queue") { >+ my $z3950daemondir = "$kohadir/scripts/z3950daemon"; >+ mkdir $z3950daemondir, 0775 || warn "$z3950daemondir: $!\n"; >+ system("mv", (map { "$kohadir/cgi-bin/acqui.simple/$_" } @z3950daemon_files), $z3950daemondir); >+ } >+} > print "Copying module files to $kohadir/modules...\n"; >-system("cp -R modules/* $kohadir/modules/"); >+if (-d 'modules') { >+ system("cp -R modules/* $kohadir/modules/"); >+} else { # probably CVS >+ system("cp -R @modules $kohadir/modules/"); >+} > print "Copying opac-html files to $opacdir/htdocs...\n"; >-system("cp -R opac-html/* $opacdir/htdocs/"); >+system("cp -R $opac_html_dir/* $opacdir/htdocs/"); > print "Copying opac-cgi files to $opacdir/cgi-bin...\n"; >-system("cp -R opac-cgi/* $opacdir/cgi-bin/"); >+system("cp -R $opac_cgi_dir/* $opacdir/cgi-bin/"); > > system("chown -R root.$httpduser $opacdir"); > system("chown -R root.$httpduser $kohadir"); >@@ -755,8 +790,8 @@ > > > #Create the configuration file >-open(SITES,">$etcdir/koha.conf") or warn "Couldn't create file >-at $etcdir. Must have write capability.\n"; >+my $old_umask = umask(027); # make sure koha.conf is never world-readable >+open(SITES,">$etcdir/koha.conf.tmp") or warn "Couldn't create file at $etcdir. Must have write capability.\n"; > print SITES <<EOP > database=$dbname > hostname=$hostname >@@ -771,12 +806,13 @@ > EOP > ; > close(SITES); >+umask($old_umask); > > # > # Set ownership of the koha.conf file for security > # >-chown((getpwnam($httpduser)) [2,3], "$etcdir/koha.conf") or warn "can't chown koha.conf: $!"; >-chmod 0440, "$etcdir/koha.conf"; >+chown((getpwnam($httpduser)) [2,3], "$etcdir/koha.conf.tmp") or warn "can't chown koha.conf: $!"; >+chmod 0440, "$etcdir/koha.conf.tmp"; > > > print qq| >@@ -790,16 +826,23 @@ > my $mysqlpass = ''; > > foreach my $mysql (qw(/usr/local/mysql >- /opt/mysql >+ /opt/mysql > /usr > )) { >- if ( -d $mysql ) { >- $mysqldir=$mysql; >+ if ( -d $mysql && -f "$mysql/bin/mysqladmin" ) { >+ $mysqldir=$mysql; > } > } >-if (!$mysqldir){ >- $mysqldir='/usr'; >+if (!defined $mysqldir){ >+ print "I don't see mysql in the usual places.\n"; >+ for (;;) { >+ print "Where have you installed mysql (value of --prefix if you compiled it yourself)? "; >+ chomp($mysqldir = <STDIN>); >+ last if -f "$mysqldir/bin/mysqladmin"; >+ print "I can't find it there either.\n"; >+ } > } >+print "Ok, found mysql in $mysqldir\n\n"; > print qq| > To allow us to create the koha database please supply the > mysql\'s root users password >@@ -807,10 +850,11 @@ > > my $needpassword=1; > while ($needpassword) { >- print "Enter mysql\'s root users password: "; >+ print "Enter mysql's root user's password: "; > chomp($input = <STDIN>); > $mysqlpass = $input; >- my $result=system("$mysqldir/bin/mysqladmin -u$mysqluser -p$mysqlpass proc > /dev/null 2>&1"); >+ # FIXME: This won't work if $mysqlpass contains a double quote >+ my $result=system("$mysqldir/bin/mysqladmin -u$mysqluser -p\"$mysqlpass\" proc > /dev/null 2>&1"); > if ($result) { > print "\n\nInvalid password for the MySql root user.\n\n"; > } else { >@@ -832,12 +876,15 @@ > <STDIN>; > print "\n"; > } else { >+ # Populate the Koha database > system("$mysqldir/bin/mysql -u$mysqluser -p$mysqlpass $dbname < koha.mysql"); >+ # Set up permissions > system("$mysqldir/bin/mysql -u$mysqluser -p$mysqlpass mysql -e \"insert into user (Host,User,Password) values ('$hostname','$user',password('$pass'))\"\;"); > system("$mysqldir/bin/mysql -u$mysqluser -p$mysqlpass mysql -e \"insert into db (Host,Db,User,Select_priv,Insert_priv,Update_priv,Delete_priv,Create_priv,Drop_priv, index_priv, alter_priv) values ('%','$dbname','$user','Y','Y','Y','Y','Y','Y','Y','Y')\""); > system("$mysqldir/bin/mysqladmin -u$mysqluser -p$mysqlpass reload"); > >- system ("perl -I $kohadir/modules scripts/updater/updatedatabase"); >+ my $updaterdir = -d 'scripts'? 'scripts/updater': 'updater'; >+ system ("perl -I $kohadir/modules $updaterdir/updatedatabase"); > > > print qq| >@@ -972,6 +1019,9 @@ > chmod 0750, "$kohadir/scripts/z3950daemon/processz3950queue"; > chown(0, (getpwnam($httpduser)) [3], "$kohadir/scripts/z3950daemon/z3950-daemon-shell.sh") or warn "can't chown $kohadir/scripts/z3950daemon/z3950-daemon-shell.sh: $!"; > chown(0, (getpwnam($httpduser)) [3], "$kohadir/scripts/z3950daemon/processz3950queue") or warn "can't chown $kohadir/scripts/z3950daemon/processz3950queue: $!"; >+ >+# At this point we really know the installation is complete >+rename "$etcdir/koha.conf.tmp", "$etcdir/koha.conf" || warn "Couldn't rename file at $etcdir. Must have write capability.\n"; > > > #RESTART APACHE
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 91
: 15