|
Lines 21-30
Link Here
|
| 21 |
|
21 |
|
| 22 |
use strict; # please develop with the strict pragma |
22 |
use strict; # please develop with the strict pragma |
| 23 |
|
23 |
|
| 24 |
if ($<) { |
|
|
| 25 |
print "\n\nYou must run koha.upgrade as root.\n\n"; |
| 26 |
exit; |
| 27 |
} |
| 28 |
unless ($< == 0) { |
24 |
unless ($< == 0) { |
| 29 |
print "You must be root to run this script.\n"; |
25 |
print "You must be root to run this script.\n"; |
| 30 |
exit 1; |
26 |
exit 1; |
|
Lines 353-358
Link Here
|
| 353 |
|
349 |
|
| 354 |
I was not able to find your apache configuration file. It is usually |
350 |
I was not able to find your apache configuration file. It is usually |
| 355 |
called httpd.conf or apache.conf. |
351 |
called httpd.conf or apache.conf. |
|
|
352 |
|
| 353 |
If you are not using apache, you can specify a non-existing file, like |
| 354 |
/tmp/httpd.conf, so that you can manually reconfigure your web server |
| 355 |
afterwards. |
| 356 |
|; |
356 |
|; |
| 357 |
print "Where is your Apache configuratin file? "; |
357 |
print "Where is your Apache configuratin file? "; |
| 358 |
chomp($input = <STDIN>); |
358 |
chomp($input = <STDIN>); |
|
Lines 651-657
Link Here
|
| 651 |
} |
651 |
} |
| 652 |
|
652 |
|
| 653 |
unless (-e "$kohalogdir") { |
653 |
unless (-e "$kohalogdir") { |
| 654 |
my $result = mkdir 0770, "$kohalogdir"; |
654 |
my $result = mkdir "$kohalogdir", 0770; |
| 655 |
if ($result==0) { |
655 |
if ($result==0) { |
| 656 |
my @dirs = split(m#/#, $kohalogdir); |
656 |
my @dirs = split(m#/#, $kohalogdir); |
| 657 |
my $checkdir=''; |
657 |
my $checkdir=''; |
|
Lines 736-753
Link Here
|
| 736 |
|
736 |
|
| 737 |
print "\n\nINSTALLING KOHA...\n"; |
737 |
print "\n\nINSTALLING KOHA...\n"; |
| 738 |
print "\n\n==================\n"; |
738 |
print "\n\n==================\n"; |
|
|
739 |
|
| 740 |
# Figure out whether this is a normal release or CVS |
| 741 |
my @intranet_cgis = qw( acqui acqui.simple admin circ maint marc sec ); |
| 742 |
my @scripts = qw( misc telnet tkperl translator updater z3950daemon ); |
| 743 |
my @modules = qw( C4 ); |
| 744 |
my @z3950daemon_files = qw( processz3950queue z3950-daemon-launch.sh z3950-daemon-shell.sh); |
| 745 |
my $intranet_html_dir = -d 'intranet-html'? 'intranet-html': '../koha-html/intranet-html'; |
| 746 |
my $opac_html_dir = -d 'opac-html'? 'opac-html': '../koha-html/opac-html'; |
| 747 |
my $opac_cgi_dir = -d 'opac-cgi'? 'opac-cgi': 'html-template'; |
| 748 |
|
| 749 |
if (!-d $intranet_html_dir && ! -d $opac_html_dir) { |
| 750 |
die qq| |
| 751 |
You seem to be installing from CVS, and I don't know where the "koha-html" module is checked out. Sorry. |
| 752 |
|; |
| 753 |
} |
| 739 |
print "Copying internet-html files to $kohadir/htdocs...\n"; |
754 |
print "Copying internet-html files to $kohadir/htdocs...\n"; |
| 740 |
system("cp -R intranet-html/* $kohadir/htdocs/"); |
755 |
system("cp -R $intranet_html_dir/* $kohadir/htdocs/"); |
| 741 |
print "Copying intranet-cgi files to $kohadir/cgi-bin...\n"; |
756 |
print "Copying intranet-cgi files to $kohadir/cgi-bin...\n"; |
| 742 |
system("cp -R intranet-cgi/* $kohadir/cgi-bin/"); |
757 |
if (-d 'intranet-cgi') { |
|
|
758 |
system("cp -R intranet_cgi/* $kohadir/cgi-bin/"); |
| 759 |
} else { # probably CVS |
| 760 |
system("cp -R *.pl @intranet_cgis $kohadir/cgi-bin/"); |
| 761 |
} |
| 743 |
print "Copying script files to $kohadir/scripts...\n"; |
762 |
print "Copying script files to $kohadir/scripts...\n"; |
| 744 |
system("cp -R scripts/* $kohadir/scripts/"); |
763 |
if (-d 'scripts') { |
|
|
764 |
system("cp -R scripts/* $kohadir/scripts/"); |
| 765 |
} else { # probably CVS |
| 766 |
system("cp -R @scripts $kohadir/scripts/"); |
| 767 |
# |
| 768 |
# FIXME: z3950 stuff seems to be misplaced in CVS; temp. workaround below |
| 769 |
# |
| 770 |
if (!-d "z3950daemon" && -f "acqui.simple/processz3950queue") { |
| 771 |
my $z3950daemondir = "$kohadir/scripts/z3950daemon"; |
| 772 |
mkdir $z3950daemondir, 0775 || warn "$z3950daemondir: $!\n"; |
| 773 |
system("mv", (map { "$kohadir/cgi-bin/acqui.simple/$_" } @z3950daemon_files), $z3950daemondir); |
| 774 |
} |
| 775 |
} |
| 745 |
print "Copying module files to $kohadir/modules...\n"; |
776 |
print "Copying module files to $kohadir/modules...\n"; |
| 746 |
system("cp -R modules/* $kohadir/modules/"); |
777 |
if (-d 'modules') { |
|
|
778 |
system("cp -R modules/* $kohadir/modules/"); |
| 779 |
} else { # probably CVS |
| 780 |
system("cp -R @modules $kohadir/modules/"); |
| 781 |
} |
| 747 |
print "Copying opac-html files to $opacdir/htdocs...\n"; |
782 |
print "Copying opac-html files to $opacdir/htdocs...\n"; |
| 748 |
system("cp -R opac-html/* $opacdir/htdocs/"); |
783 |
system("cp -R $opac_html_dir/* $opacdir/htdocs/"); |
| 749 |
print "Copying opac-cgi files to $opacdir/cgi-bin...\n"; |
784 |
print "Copying opac-cgi files to $opacdir/cgi-bin...\n"; |
| 750 |
system("cp -R opac-cgi/* $opacdir/cgi-bin/"); |
785 |
system("cp -R $opac_cgi_dir/* $opacdir/cgi-bin/"); |
| 751 |
|
786 |
|
| 752 |
system("chown -R root.$httpduser $opacdir"); |
787 |
system("chown -R root.$httpduser $opacdir"); |
| 753 |
system("chown -R root.$httpduser $kohadir"); |
788 |
system("chown -R root.$httpduser $kohadir"); |
|
Lines 755-762
Link Here
|
| 755 |
|
790 |
|
| 756 |
|
791 |
|
| 757 |
#Create the configuration file |
792 |
#Create the configuration file |
| 758 |
open(SITES,">$etcdir/koha.conf") or warn "Couldn't create file |
793 |
my $old_umask = umask(027); # make sure koha.conf is never world-readable |
| 759 |
at $etcdir. Must have write capability.\n"; |
794 |
open(SITES,">$etcdir/koha.conf.tmp") or warn "Couldn't create file at $etcdir. Must have write capability.\n"; |
| 760 |
print SITES <<EOP |
795 |
print SITES <<EOP |
| 761 |
database=$dbname |
796 |
database=$dbname |
| 762 |
hostname=$hostname |
797 |
hostname=$hostname |
|
Lines 771-782
Link Here
|
| 771 |
EOP |
806 |
EOP |
| 772 |
; |
807 |
; |
| 773 |
close(SITES); |
808 |
close(SITES); |
|
|
809 |
umask($old_umask); |
| 774 |
|
810 |
|
| 775 |
# |
811 |
# |
| 776 |
# Set ownership of the koha.conf file for security |
812 |
# Set ownership of the koha.conf file for security |
| 777 |
# |
813 |
# |
| 778 |
chown((getpwnam($httpduser)) [2,3], "$etcdir/koha.conf") or warn "can't chown koha.conf: $!"; |
814 |
chown((getpwnam($httpduser)) [2,3], "$etcdir/koha.conf.tmp") or warn "can't chown koha.conf: $!"; |
| 779 |
chmod 0440, "$etcdir/koha.conf"; |
815 |
chmod 0440, "$etcdir/koha.conf.tmp"; |
| 780 |
|
816 |
|
| 781 |
|
817 |
|
| 782 |
print qq| |
818 |
print qq| |
|
Lines 790-805
Link Here
|
| 790 |
my $mysqlpass = ''; |
826 |
my $mysqlpass = ''; |
| 791 |
|
827 |
|
| 792 |
foreach my $mysql (qw(/usr/local/mysql |
828 |
foreach my $mysql (qw(/usr/local/mysql |
| 793 |
/opt/mysql |
829 |
/opt/mysql |
| 794 |
/usr |
830 |
/usr |
| 795 |
)) { |
831 |
)) { |
| 796 |
if ( -d $mysql ) { |
832 |
if ( -d $mysql && -f "$mysql/bin/mysqladmin" ) { |
| 797 |
$mysqldir=$mysql; |
833 |
$mysqldir=$mysql; |
| 798 |
} |
834 |
} |
| 799 |
} |
835 |
} |
| 800 |
if (!$mysqldir){ |
836 |
if (!defined $mysqldir){ |
| 801 |
$mysqldir='/usr'; |
837 |
print "I don't see mysql in the usual places.\n"; |
|
|
838 |
for (;;) { |
| 839 |
print "Where have you installed mysql (value of --prefix if you compiled it yourself)? "; |
| 840 |
chomp($mysqldir = <STDIN>); |
| 841 |
last if -f "$mysqldir/bin/mysqladmin"; |
| 842 |
print "I can't find it there either.\n"; |
| 843 |
} |
| 802 |
} |
844 |
} |
|
|
845 |
print "Ok, found mysql in $mysqldir\n\n"; |
| 803 |
print qq| |
846 |
print qq| |
| 804 |
To allow us to create the koha database please supply the |
847 |
To allow us to create the koha database please supply the |
| 805 |
mysql\'s root users password |
848 |
mysql\'s root users password |
|
Lines 807-816
Link Here
|
| 807 |
|
850 |
|
| 808 |
my $needpassword=1; |
851 |
my $needpassword=1; |
| 809 |
while ($needpassword) { |
852 |
while ($needpassword) { |
| 810 |
print "Enter mysql\'s root users password: "; |
853 |
print "Enter mysql's root user's password: "; |
| 811 |
chomp($input = <STDIN>); |
854 |
chomp($input = <STDIN>); |
| 812 |
$mysqlpass = $input; |
855 |
$mysqlpass = $input; |
| 813 |
my $result=system("$mysqldir/bin/mysqladmin -u$mysqluser -p$mysqlpass proc > /dev/null 2>&1"); |
856 |
# FIXME: This won't work if $mysqlpass contains a double quote |
|
|
857 |
my $result=system("$mysqldir/bin/mysqladmin -u$mysqluser -p\"$mysqlpass\" proc > /dev/null 2>&1"); |
| 814 |
if ($result) { |
858 |
if ($result) { |
| 815 |
print "\n\nInvalid password for the MySql root user.\n\n"; |
859 |
print "\n\nInvalid password for the MySql root user.\n\n"; |
| 816 |
} else { |
860 |
} else { |
|
Lines 832-843
Link Here
|
| 832 |
<STDIN>; |
876 |
<STDIN>; |
| 833 |
print "\n"; |
877 |
print "\n"; |
| 834 |
} else { |
878 |
} else { |
|
|
879 |
# Populate the Koha database |
| 835 |
system("$mysqldir/bin/mysql -u$mysqluser -p$mysqlpass $dbname < koha.mysql"); |
880 |
system("$mysqldir/bin/mysql -u$mysqluser -p$mysqlpass $dbname < koha.mysql"); |
|
|
881 |
# Set up permissions |
| 836 |
system("$mysqldir/bin/mysql -u$mysqluser -p$mysqlpass mysql -e \"insert into user (Host,User,Password) values ('$hostname','$user',password('$pass'))\"\;"); |
882 |
system("$mysqldir/bin/mysql -u$mysqluser -p$mysqlpass mysql -e \"insert into user (Host,User,Password) values ('$hostname','$user',password('$pass'))\"\;"); |
| 837 |
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')\""); |
883 |
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')\""); |
| 838 |
system("$mysqldir/bin/mysqladmin -u$mysqluser -p$mysqlpass reload"); |
884 |
system("$mysqldir/bin/mysqladmin -u$mysqluser -p$mysqlpass reload"); |
| 839 |
|
885 |
|
| 840 |
system ("perl -I $kohadir/modules scripts/updater/updatedatabase"); |
886 |
my $updaterdir = -d 'scripts'? 'scripts/updater': 'updater'; |
|
|
887 |
system ("perl -I $kohadir/modules $updaterdir/updatedatabase"); |
| 841 |
|
888 |
|
| 842 |
|
889 |
|
| 843 |
print qq| |
890 |
print qq| |
|
Lines 972-977
Link Here
|
| 972 |
chmod 0750, "$kohadir/scripts/z3950daemon/processz3950queue"; |
1019 |
chmod 0750, "$kohadir/scripts/z3950daemon/processz3950queue"; |
| 973 |
chown(0, (getpwnam($httpduser)) [3], "$kohadir/scripts/z3950daemon/z3950-daemon-shell.sh") or warn "can't chown $kohadir/scripts/z3950daemon/z3950-daemon-shell.sh: $!"; |
1020 |
chown(0, (getpwnam($httpduser)) [3], "$kohadir/scripts/z3950daemon/z3950-daemon-shell.sh") or warn "can't chown $kohadir/scripts/z3950daemon/z3950-daemon-shell.sh: $!"; |
| 974 |
chown(0, (getpwnam($httpduser)) [3], "$kohadir/scripts/z3950daemon/processz3950queue") or warn "can't chown $kohadir/scripts/z3950daemon/processz3950queue: $!"; |
1021 |
chown(0, (getpwnam($httpduser)) [3], "$kohadir/scripts/z3950daemon/processz3950queue") or warn "can't chown $kohadir/scripts/z3950daemon/processz3950queue: $!"; |
|
|
1022 |
|
| 1023 |
# At this point we really know the installation is complete |
| 1024 |
rename "$etcdir/koha.conf.tmp", "$etcdir/koha.conf" || warn "Couldn't rename file at $etcdir. Must have write capability.\n"; |
| 975 |
|
1025 |
|
| 976 |
|
1026 |
|
| 977 |
#RESTART APACHE |
1027 |
#RESTART APACHE |