[Koha-cvs] CVS: koha/misc Install.pm,1.35,1.36 installer.pl,1.13,1.14
MJ Ray
slef at users.sourceforge.net
Tue May 20 21:50:20 CEST 2003
Update of /cvsroot/koha/koha/misc
In directory sc8-pr-cvs1:/tmp/cvs-serv9622
Modified Files:
Install.pm installer.pl
Log Message:
Initial fix to bug 417: non-root installer
Index: Install.pm
===================================================================
RCS file: /cvsroot/koha/koha/misc/Install.pm,v
retrieving revision 1.35
retrieving revision 1.36
diff -C2 -r1.35 -r1.36
*** Install.pm 14 May 2003 13:33:42 -0000 1.35
--- Install.pm 20 May 2003 19:50:17 -0000 1.36
***************
*** 3,6 ****
--- 3,7 ----
# Copyright 2000-2002 Katipo Communications
+ # my.cnf, etcdir and prefix code Copyright 2003 MJ Ray
#
# This file is part of Koha.
***************
*** 64,67 ****
--- 65,70 ----
&finalizeconfigfile
&loadconfigfile
+ &backupmycnf
+ &restoremycnf
);
***************
*** 77,81 ****
use vars qw( $database $mysqluser );
use vars qw( $mysqlpass ); # normally should not be used
- use vars qw( $mysqlpass_quoted ); # quoted, contains -p as needed
use vars qw( $dbname $hostname $user $pass ); # virtual hosting
--- 80,83 ----
***************
*** 104,107 ****
--- 106,112 ----
}
+ my $mycnf = $ENV{HOME}."/.my.cnf";
+ my $mytmpcnf = `mktemp my.cnf.koha.XXXXXX`;
+
my $messages;
$messages->{'continuing'}->{en}="Great! Continuing setup.\n\n";
***************
*** 109,120 ****
heading('Welcome to the Koha Installer') . qq|
Welcome to the Koha install script! This script will prompt you for some
! basic information about your desired setup, then install Koha according to
! your specifications. To accept the default value for any question, simply hit
! Enter at the prompt.
Please be sure to read the documentation, or visit the Koha website at
http://www.koha.org for more information.
! Are you ready to begin the installation? (Y/[N]): |;
$messages->{'ReleaseCandidateWarning'}->{en} =
heading('RELEASE CANDIDATE') . qq|
--- 114,131 ----
heading('Welcome to the Koha Installer') . qq|
Welcome to the Koha install script! This script will prompt you for some
! basic information about your desired setup, then install Koha for you.
!
! If you want to install the Koha configuration file somewhere other than /etc
! (eg for non-root installation, or multiple Koha versions on one system), you
! should set the etcdir and prefix environment variables. If this is your
! only koha installation on this machine and you are running this as root, the
! default should be OK.
!
! To accept the default value for any question, simply hit Enter at the prompt.
Please be sure to read the documentation, or visit the Koha website at
http://www.koha.org for more information.
! Are you ready to begin the installation? ([Y]/N): |;
$messages->{'ReleaseCandidateWarning'}->{en} =
heading('RELEASE CANDIDATE') . qq|
***************
*** 705,708 ****
--- 716,725 ----
: |;
+ $messages->{'DirFailed'}->{en} = qq|
+ We could not create %s, but continuing anyway...
+
+ |;
+
+
=item getinstallationdirectories
***************
*** 719,724 ****
sub getinstallationdirectories {
! $opacdir = '/usr/local/koha/opac';
! $intranetdir = '/usr/local/koha/intranet';
my $getdirinfo=1;
while ($getdirinfo) {
--- 736,742 ----
sub getinstallationdirectories {
! if (!$ENV{prefix}) { $ENV{prefix} = "/usr/local"; }
! $opacdir = $ENV{prefix}.'/koha/opac';
! $intranetdir = $ENV{prefix}.'/koha/intranet';
my $getdirinfo=1;
while ($getdirinfo) {
***************
*** 741,753 ****
}
}
! $kohalogdir='/var/log/koha';
my $message=getmessage('GetKohaLogDir', [$kohalogdir]);
$kohalogdir=showmessage($message, 'free', $kohalogdir);
! # FIXME: Missing error handling for all mkdir calls here
unless ( -d $intranetdir ) {
! mkdir_parents (dirname($intranetdir), 0775);
! mkdir ($intranetdir, 0770);
chown (oct(0), (getgrnam($httpduser))[2], "$intranetdir");
chmod (oct(770), "$intranetdir");
--- 759,771 ----
}
}
! $kohalogdir=$ENV{prefix}.'/koha/log';
my $message=getmessage('GetKohaLogDir', [$kohalogdir]);
$kohalogdir=showmessage($message, 'free', $kohalogdir);
! # FIXME: Need better error handling for all mkdir calls here
unless ( -d $intranetdir ) {
! mkdir_parents (dirname($intranetdir), 0775) || print getmessage('DirFailed','parents of '.$intranetdir);
! mkdir ($intranetdir, 0770) || print getmessage('DirFailed',$intranetdir);
chown (oct(0), (getgrnam($httpduser))[2], "$intranetdir");
chmod (oct(770), "$intranetdir");
***************
*** 758,763 ****
mkdir_parents ("$intranetdir/scripts", 0750);
unless ( -d $opacdir ) {
! mkdir_parents (dirname($opacdir), 0775);
! mkdir ($opacdir, 0770);
chown (oct(0), (getgrnam($httpduser))[2], "$opacdir");
chmod (oct(770), "$opacdir");
--- 776,781 ----
mkdir_parents ("$intranetdir/scripts", 0750);
unless ( -d $opacdir ) {
! mkdir_parents (dirname($opacdir), 0775) || print getmessage('DirFailed','parents of '.$opacdir);
! mkdir ($opacdir, 0770) || print getmessage('DirFailed',$opacdir);
chown (oct(0), (getgrnam($httpduser))[2], "$opacdir");
chmod (oct(770), "$opacdir");
***************
*** 768,773 ****
unless ( -d $kohalogdir ) {
! mkdir_parents (dirname($kohalogdir), 0775);
! mkdir ($kohalogdir, 0770);
chown (oct(0), (getgrnam($httpduser))[2,3], "$kohalogdir");
chmod (oct(770), "$kohalogdir");
--- 786,791 ----
unless ( -d $kohalogdir ) {
! mkdir_parents (dirname($kohalogdir), 0775) || print getmessage('DirFailed','parents of '.$kohalogdir);
! mkdir ($kohalogdir, 0770) || print getmessage('DirFailed',$kohalogdir);
chown (oct(0), (getgrnam($httpduser))[2,3], "$kohalogdir");
chmod (oct(770), "$kohalogdir");
***************
*** 791,795 ****
$messages->{'DatabaseName'}->{en} = heading('Name of MySQL database') . qq|
! Please provide the name of the mysql database for your koha installation.
Database name [%s]: |;
--- 809,814 ----
$messages->{'DatabaseName'}->{en} = heading('Name of MySQL database') . qq|
! Please provide the name that you wish to give your koha database.
! It must not exist already on the database server.
Database name [%s]: |;
***************
*** 802,806 ****
$messages->{'DatabaseUser'}->{en} = heading('Database User') . qq|
! Please provide the name of the user, who will have full administrative rights
to the %s database, when authenticating from %s.
--- 821,825 ----
$messages->{'DatabaseUser'}->{en} = heading('Database User') . qq|
! Please provide the name of the user who will have full administrative rights
to the %s database, when authenticating from %s.
***************
*** 817,821 ****
$messages->{'BlankPassword'}->{en} = heading('BLANK PASSWORD') . qq|
! You must not use a blank password for your MySQL user!
Press <ENTER> to try again:
--- 836,840 ----
$messages->{'BlankPassword'}->{en} = heading('BLANK PASSWORD') . qq|
! You must not use a blank password for your MySQL user.
Press <ENTER> to try again:
***************
*** 912,915 ****
--- 931,936 ----
/usr/local/etc/apache/apache.conf
/var/www/conf/httpd.conf
+ /etc/apache2/httpd.conf
+ /etc/apache2/apache.conf
/etc/apache/conf/httpd.conf
/etc/apache/conf/apache.conf
***************
*** 1015,1019 ****
$messages->{'GetServerName'}->{en} =
heading('WEB SERVER HOST NAME OR IP ADDRESS') . qq|
! Please enter the domain name or ip address of your computer.
Host name or IP Address [%s]: |;
--- 1036,1041 ----
$messages->{'GetServerName'}->{en} =
heading('WEB SERVER HOST NAME OR IP ADDRESS') . qq|
! Please enter the host name or IP address that you wish to use for koha.
! Normally, this should be a name or IP that belongs to this machine.
Host name or IP Address [%s]: |;
***************
*** 1021,1025 ****
$messages->{'GetOpacPort'}->{en} = heading('OPAC VIRTUAL HOST PORT') . qq|
Please enter the port for your OPAC interface. This defaults to port 80, but
! if you are already serving web content from this server, you should change it
to a different port (8000 might be a good choice).
--- 1043,1047 ----
$messages->{'GetOpacPort'}->{en} = heading('OPAC VIRTUAL HOST PORT') . qq|
Please enter the port for your OPAC interface. This defaults to port 80, but
! if you are already serving web content from this host, you should change it
to a different port (8000 might be a good choice).
***************
*** 1082,1096 ****
|;
! $messages->{'LoadingApacheModuleModEnv'}->{en}="Loading SetEnv Apache module.\n";
!
! $messages->{'LoadingApacheModuleModInc'}->{en}="Loading Includes Apache module.\n";
!
! $messages->{'ApacheConfigBackupFailed'}->{en} =
! heading('APACHE CONFIGURATION BACKUP FAILED') . qq|
! An error occurred while trying to make a backup copy of %s.
!
! %s
!
! No changes will be made to the apache configuration file at this time.
Press <ENTER> to continue: |;
--- 1104,1112 ----
|;
! $messages->{'ApacheConfigMissingModules'}->{en} =
! heading('APACHE CONFIGURATION NEEDS UPDATE') . qq|
! Koha uses the mod_env and mod_include apache features, but the
! installer did not find statements for them in your config. Please
! make sure that they are enabled for your Koha host.
Press <ENTER> to continue: |;
***************
*** 1101,1105 ****
%s appears to already have an entry for Koha
Virtual Hosts. You may need to edit %s
! f anything has changed since it was last set up. This
script will not attempt to modify an existing Koha apache
configuration.
--- 1117,1121 ----
%s appears to already have an entry for Koha
Virtual Hosts. You may need to edit %s
! if anything has changed since it was last set up. This
script will not attempt to modify an existing Koha apache
configuration.
***************
*** 1110,1113 ****
--- 1126,1131 ----
my $logfiledir=`grep ^ErrorLog "$realhttpdconf"`;
chomp $logfiledir;
+
+ my $httpdconf = $etcdir."/httpd.conf";
if ($logfiledir) {
***************
*** 1122,1127 ****
showmessage(getmessage('StartUpdateApache'), 'none');
! my $httpdconf;
my $envmodule=0;
my $includesmodule=0;
--- 1140,1146 ----
showmessage(getmessage('StartUpdateApache'), 'none');
+ # to be polite about it: I don't think this should touch the main httpd.conf
! # QUESTION: Should we warn for includes_module too?
my $envmodule=0;
my $includesmodule=0;
***************
*** 1129,1163 ****
while (<HC>) {
if (/^\s*#\s*LoadModule env_module /) {
! s/^\s*#\s*//;
! showmessage(getmessage('LoadingApacheModuleModEnv'));
$envmodule=1;
}
- if (/^\s*#\s*LoadModule includes_module /) {
- s/^\s*#\s*//;
- showmessage(getmessage('LoadingApacheModuleModInc'));
- }
if (/\s*LoadModule includes_module / ) {
$includesmodule=1;
}
- $httpdconf.=$_;
}
! my $backupfailed=0;
! $backupfailed=`cp -f $realhttpdconf $realhttpdconf\.prekoha`;
! if ($backupfailed) {
! showmessage(getmessage('ApacheConfigBackupFailed', [$realhttpdconf,$backupfailed ]), 'PressEnter');
! return;
! }
!
! if ($envmodule || $includesmodule) {
! open HC, ">$realhttpdconf";
! print HC $httpdconf;
! close HC;
! }
!
!
!
! if (`grep 'VirtualHost $servername' "$realhttpdconf"`) {
! showmessage(getmessage('ApacheAlreadyConfigured', [$realhttpdconf, $realhttpdconf]), 'PressEnter');
return;
} else {
--- 1148,1161 ----
while (<HC>) {
if (/^\s*#\s*LoadModule env_module /) {
! showmessage(getmessage('ApacheConfigMissingModules'));
$envmodule=1;
}
if (/\s*LoadModule includes_module / ) {
$includesmodule=1;
}
}
! if (`grep 'VirtualHost $servername' "$httpdconf"`) {
! showmessage(getmessage('ApacheAlreadyConfigured', [$httpdconf, $httpdconf]), 'PressEnter');
return;
} else {
***************
*** 1167,1171 ****
$includesdirectives.=" AddHandler server-parsed .html\n";
}
! open(SITE,">>$realhttpdconf") or warn "Insufficient priveleges to open $realhttpdconf for writing.\n";
my $opaclisten = '';
if ($opacport != 80) {
--- 1165,1169 ----
$includesdirectives.=" AddHandler server-parsed .html\n";
}
! open(SITE,">$httpdconf") or warn "Insufficient priveleges to open $httpdconf for writing.\n";
my $opaclisten = '';
if ($opacport != 80) {
***************
*** 1379,1388 ****
$messages->{'MysqlRootPassword'}->{en} =
heading('MYSQL ROOT USER PASSWORD') . qq|
! To allow us to create the koha database please supply your
mysql server's root user password:
! Enter MySQL root user password: |; #'
!
! $messages->{'InvalidMysqlRootPassword'}->{en}="Invalid Password. Please try again.";
$messages->{'CreatingDatabase'}->{en} = heading('CREATING DATABASE') . qq|
--- 1377,1384 ----
$messages->{'MysqlRootPassword'}->{en} =
heading('MYSQL ROOT USER PASSWORD') . qq|
! To allow us to create the koha database please enter your
mysql server's root user password:
! Password: |; #'
$messages->{'CreatingDatabase'}->{en} = heading('CREATING DATABASE') . qq|
***************
*** 1429,1440 ****
$messages->{'PrinterQueue'}->{en}="Printer Queue [%s]: ";
$messages->{'PrinterName'}->{en}="Printer Name [%s]: ";
- $messages->{'BlankMysqlPassword'}->{en} = heading('Blank MySQL Password') . qq|
- Do not leave your MySQL root password blank unless you know exactly what you
- are doing. To change your MySQL root password use the mysqladmin command:
-
- mysqladmin password NEWPASSWORDHERE
-
- Press <ENTER> to continue:
- |;
sub databasesetup {
--- 1425,1428 ----
***************
*** 1468,1509 ****
}
}
!
!
! my $needpassword=1;
! while ($needpassword) {
! $mysqlpass=showmessage(getmessage('MysqlRootPassword'), 'free');
! $mysqlpass_quoted = $mysqlpass;
! $mysqlpass_quoted =~ s/"/\\"/g;
! $mysqlpass_quoted="-p\"$mysqlpass_quoted\"";
! $mysqlpass eq '' and $mysqlpass_quoted='';
! my $result=system("$mysqldir/bin/mysqladmin -u$mysqluser $mysqlpass_quoted proc > /dev/null 2>&1");
if ($result) {
! print getmessage('InvalidMysqlRootPassword');
} else {
! if ($mysqlpass eq '') {
! showmessage(getmessage('BlankMysqlPassword'), 'PressEnter');
! }
! $needpassword=0;
}
- }
-
- showmessage(getmessage('CreatingDatabase'),'none');
-
- my $result=system("$mysqldir/bin/mysqladmin", "-u$mysqluser", "-p$mysqlpass", "create", "$dbname");
- if ($result) {
- showmessage(getmessage('CreatingDatabaseError'),'PressEnter', '', 1);
- } else {
- # Create the database structure
- system("$mysqldir/bin/mysql -u$mysqluser $mysqlpass_quoted $dbname < koha.mysql");
- # Set up permissions
- system("$mysqldir/bin/mysql -u$mysqluser $mysqlpass_quoted mysql -e \"insert into user (Host,User,Password) values ('$hostname','$user',password('$pass'))\"\;");
- system("$mysqldir/bin/mysql -u$mysqluser $mysqlpass_quoted 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 $mysqlpass_quoted reload");
-
-
-
-
-
- }
}
--- 1456,1478 ----
}
}
! # we must not put the mysql root password on the command line
! $mysqlpass= showmessage(getmessage('MysqlRootPassword'),'free');
!
! showmessage(getmessage('CreatingDatabase'),'none');
! # set the login up
! setmysqlclipass($mysqlpass);
! # Set up permissions
! print system("$mysqldir/bin/mysql -u$mysqluser mysql -e \"insert into user (Host,User,Password) values ('$hostname','$user',password('$pass'))\"\;");
! system("$mysqldir/bin/mysql -u$mysqluser 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 reload");
! # Change to admin user login
! setmysqlclipass($pass);
! my $result=system("$mysqldir/bin/mysqladmin", "-u$user", "create", "$dbname");
if ($result) {
! showmessage(getmessage('CreatingDatabaseError'),'PressEnter', '', 1);
} else {
! # Create the database structure
! system("$mysqldir/bin/mysql -u$user $dbname < koha.mysql");
}
}
***************
*** 1521,1527 ****
Because updatedatabase calls scripts/updater/updatedatabase to
do the actual update, and that script uses C4::Context,
! $etcdir/koha.conf must exist at this point. We use a symlink to
! do this and to also at the same time faciliate detection of
! ahorted installs. (See checkabortedinstall.)
=cut
--- 1490,1497 ----
Because updatedatabase calls scripts/updater/updatedatabase to
do the actual update, and that script uses C4::Context,
! $etcdir/koha.conf must exist at this point. We use the KOHA_CONF
! environment variable to do this.
!
! FIXME: (See checkabortedinstall as it depends on old symlink way.)
=cut
***************
*** 1535,1539 ****
N none
! Please choose which parameter you want to install. Note if you choose 3,
nothing will be added, and it can be a BIG job to manually create those tables
--- 1505,1509 ----
N none
! Please choose which parameter you want to install. Note if you choose N,
nothing will be added, and it can be a BIG job to manually create those tables
***************
*** 1559,1564 ****
--- 1529,1536 ----
sub updatedatabase {
# At this point, $etcdir/koha.conf must exist, for C4::Context
+ $ENV{"KOHA_CONF"}=$etcdir.'/koha.conf.tmp';
my $result=system ("perl -I $intranetdir/modules scripts/updater/updatedatabase");
if ($result) {
+ restoremycnf();
print "Problem updating database...\n";
exit;
***************
*** 1568,1576 ****
if ($response eq '1') {
! system("cat scripts/misc/marc_datas/marc21_en/structure_def.sql | $mysqldir/bin/mysql -u$mysqluser $mysqlpass_quoted $dbname");
}
if ($response eq '2') {
! system("cat scripts/misc/marc_datas/unimarc_fr/structure_def.sql | $mysqldir/bin/mysql -u$mysqluser $mysqlpass_quoted $dbname");
! system("cat scripts/misc/lang-datas/fr/stopwords.sql | $mysqldir/bin/mysql -u$mysqluser $mysqlpass_quoted $dbname");
}
--- 1540,1548 ----
if ($response eq '1') {
! system("cat scripts/misc/marc_datas/marc21_en/structure_def.sql | $mysqldir/bin/mysql -u$user $dbname");
}
if ($response eq '2') {
! system("cat scripts/misc/marc_datas/unimarc_fr/structure_def.sql | $mysqldir/bin/mysql -u$user $dbname");
! system("cat scripts/misc/lang-datas/fr/stopwords.sql | $mysqldir/bin/mysql -u$user $dbname");
}
***************
*** 1578,1583 ****
--- 1550,1557 ----
if ($result) {
print "Problem updating database to MARC...\n";
+ restoremycnf();
exit;
}
+ delete($ENV{"KOHA_CONF"});
print "\n\nFinished updating of database. Press <ENTER> to continue...";
***************
*** 1598,1601 ****
--- 1572,1579 ----
# my $response=showmessage(getmessage('SampleData'), 'yn', 'n');
# if ($response =~/^y/i) {
+ #
+ # FIXME: These calls are now unsafe and should either be removed
+ # or updated to use -u$user and no mysqlpass_quoted
+ #
# system("gunzip -d < sampledata-1.2.gz | $mysqldir/bin/mysql -u$mysqluser $mysqlpass_quoted $dbname");
# system("$mysqldir/bin/mysql -u$mysqluser $mysqlpass_quoted $dbname -e \"insert into branches (branchcode,branchname,issuing) values ('MAIN', 'Main Library', 1)\"");
***************
*** 1623,1629 ****
$branchcode or $branchcode='DEF';
! system("$mysqldir/bin/mysql -u$mysqluser $mysqlpass_quoted $dbname -e \"insert into branches (branchcode,branchname,issuing) values ('$branchcode', '$branch', 1)\"");
! system("$mysqldir/bin/mysql -u$mysqluser $mysqlpass_quoted $dbname -e \"insert into branchrelations (branchcode,categorycode) values ('MAIN', 'IS')\"");
! system("$mysqldir/bin/mysql -u$mysqluser $mysqlpass_quoted $dbname -e \"insert into branchrelations (branchcode,categorycode) values ('MAIN', 'CU')\"");
my $printername='Library Printer';
--- 1601,1607 ----
$branchcode or $branchcode='DEF';
! system("$mysqldir/bin/mysql -u$user $dbname -e \"insert into branches (branchcode,branchname,issuing) values ('$branchcode', '$branch', 1)\"");
! system("$mysqldir/bin/mysql -u$user $dbname -e \"insert into branchrelations (branchcode,categorycode) values ('MAIN', 'IS')\"");
! system("$mysqldir/bin/mysql -u$user $dbname -e \"insert into branchrelations (branchcode,categorycode) values ('MAIN', 'CU')\"");
my $printername='Library Printer';
***************
*** 1634,1641 ****
$printerqueue=showmessage(getmessage('PrinterQueue', [$printerqueue]), 'free', $printerqueue, 1);
$printerqueue=~s/[^A-Za-z0-9]//g;
! system("$mysqldir/bin/mysql -u$mysqluser $mysqlpass_quoted $dbname -e \"insert into printers (printername,printqueue,printtype) values ('$printername', '$printerqueue', '')\"");
# }
my $language=showmessage(getmessage('Language'), 'free', 'en');
! system("$mysqldir/bin/mysql -u$mysqluser $mysqlpass_quoted $dbname -e \"update systempreferences set value='$language' where variable='opaclanguages'\"");
}
}
--- 1612,1619 ----
$printerqueue=showmessage(getmessage('PrinterQueue', [$printerqueue]), 'free', $printerqueue, 1);
$printerqueue=~s/[^A-Za-z0-9]//g;
! system("$mysqldir/bin/mysql -u$user $dbname -e \"insert into printers (printername,printqueue,printtype) values ('$printername', '$printerqueue', '')\"");
# }
my $language=showmessage(getmessage('Language'), 'free', 'en');
! system("$mysqldir/bin/mysql -u$user $dbname -e \"update systempreferences set value='$language' where variable='opaclanguages'\"");
}
}
***************
*** 1657,1662 ****
$messages->{'RestartApache'}->{en} = heading('RESTART APACHE') . qq|
Apache needs to be restarted to load the new configuration for Koha.
! Would you like to restart Apache now? [Y]/N: |;
sub restartapache {
--- 1635,1641 ----
$messages->{'RestartApache'}->{en} = heading('RESTART APACHE') . qq|
Apache needs to be restarted to load the new configuration for Koha.
+ This requires the root password.
! Would you like to try to restart Apache now? [Y]/N: |;
sub restartapache {
***************
*** 1669,1677 ****
# Need to support other init structures here?
if (-e "/etc/rc.d/init.d/httpd") {
! system('/etc/rc.d/init.d/httpd restart');
} elsif (-e "/etc/init.d/apache") {
! system('/etc//init.d/apache restart');
} elsif (-e "/etc/init.d/apache-ssl") {
! system('/etc/init.d/apache-ssl restart');
}
}
--- 1648,1656 ----
# Need to support other init structures here?
if (-e "/etc/rc.d/init.d/httpd") {
! system('su root -c /etc/rc.d/init.d/httpd restart');
} elsif (-e "/etc/init.d/apache") {
! system('su root -c /etc//init.d/apache restart');
} elsif (-e "/etc/init.d/apache-ssl") {
! system('su root -c /etc/init.d/apache-ssl restart');
}
}
***************
*** 1692,1695 ****
--- 1671,1675 ----
sub finalizeconfigfile {
+ restoremycnf();
rename "$etcdir/koha.conf.tmp", "$etcdir/koha.conf"
|| showmessage(<<EOF, 'PressEnter', undef, 1);
***************
*** 1748,1751 ****
--- 1728,1754 ----
END { } # module clean-up code here (global destructor)
+
+ sub setmysqlclipass {
+ my $pass = shift;
+ open(MYCNF,">$mycnf");
+ chmod(0600,$mycnf);
+ print MYCNF "[client]\npassword=$pass\n";
+ close(MYCNF);
+ }
+
+ sub backupmycnf {
+ if (-e $mycnf) {
+ rename $mycnf,$mytmpcnf;
+ }
+ }
+
+ sub restoremycnf {
+ if (-e $mycnf) {
+ unlink($mycnf);
+ }
+ if (-e $mytmpcnf) {
+ rename $mytmpcnf,$mycnf;
+ }
+ }
=back
Index: installer.pl
===================================================================
RCS file: /cvsroot/koha/koha/misc/installer.pl,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -r1.13 -r1.14
*** installer.pl 25 Jan 2003 18:04:45 -0000 1.13
--- installer.pl 20 May 2003 19:50:17 -0000 1.14
***************
*** 25,36 ****
Install::setdomainname $domainname;
! my $etcdir = '/etc';
! Install::setetcdir $etcdir;
!
! unless ($< == 0) {
! print "You must be root to run this script.\n";
! exit 1;
! }
unless (-d 'intranet-html') {
--- 25,35 ----
Install::setdomainname $domainname;
! ###############################################
! # SET THE etcdir ENVIRONMENT VAR INSTEAD #
! ###############################################
! my $etcdir = $ENV{etcdir}||'/etc';
! system("mkdir -p $etcdir");
+ Install::setetcdir $etcdir;
unless (-d 'intranet-html') {
***************
*** 106,109 ****
--- 105,110 ----
installfiles();
+ backupmycnf();
+
databasesetup();
***************
*** 111,114 ****
--- 112,117 ----
populatedatabase();
+
+ restoremycnf();
finalizeconfigfile();
More information about the Koha-cvs
mailing list