Moving install and upgrade scripts from rel-1-2 branch. This needs testing!
[koha_fer] / misc / Install.pm
1 package Install; #assumes Install.pm
2
3
4 # Copyright 2000-2002 Katipo Communications
5 #
6 # This file is part of Koha.
7 #
8 # Koha is free software; you can redistribute it and/or modify it under the
9 # terms of the GNU General Public License as published by the Free Software
10 # Foundation; either version 2 of the License, or (at your option) any later
11 # version.
12 #
13 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
14 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15 # A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
16 #
17 # You should have received a copy of the GNU General Public License along with
18 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
19 # Suite 330, Boston, MA  02111-1307 USA
20
21 use strict;
22 require Exporter;
23
24 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
25
26 # set the version for version checking
27 $VERSION = 0.01;
28
29 @ISA = qw(Exporter);
30 @EXPORT = qw(   &checkperlmodules
31                 &getmessage
32                 &showmessage
33                 &releasecandidatewarning
34                 &getinstallationdirectories
35                 &getdatabaseinfo
36                 &getapacheinfo
37                 &getapachevhostinfo
38                 &updateapacheconf
39                 &basicauthentication
40                 &installfiles
41                 &databasesetup
42                 &updatedatabase
43                 &populatedatabase
44                 &restartapache
45                 &loadconfigfile
46                 );
47
48
49 my $messages;
50 $messages->{'continuing'}->{en}="Great!  Continuing setup.\n\n";
51 $messages->{'WelcomeToKohaInstaller'}->{en}=qq|
52 =================================
53 = Welcome to the Koha Installer =
54 =================================
55
56 Welcome to the Koha install script!  This script will prompt you for some
57 basic information about your desired setup, then install Koha according to
58 your specifications.  To accept the default value for any question, simply hit
59 Enter at the prompt.
60
61 Please be sure to read the documentation, or visit the Koha website at 
62 http://www.koha.org for more information.
63
64 Are you ready to begin the installation? (Y/[N]): |;
65 $messages->{'ReleaseCandidateWarning'}->{en}=qq|
66 =====================
67 = RELEASE CANDIDATE =
68 =====================
69
70 WARNING WARNING WARNING WARNING WARNING
71
72 You are about to install Koha version %s.  This version of Koha is a
73 release candidate.  It is not intended to be installed on production systems.
74 It is being released so that users can test it before we release a final
75 version.
76
77 Are you sure you want to install Koha %s? (Y/[N]): |;
78 $messages->{'WatchForReleaseAnnouncements'}->{en}=qq|
79
80 Watch for announcements of Koha releases on the Koha mailing list or the Koha
81 web site (http://www.koha.org/).
82
83 |;
84
85 $messages->{'NETZ3950Missing'}->{en}=qq|
86
87 The Net::Z3950 module is missing.  This module is necessary if you want to use
88 Koha's Z39.50 client to download bibliographic records from other libraries.
89 To install this module, you will need the yaz client installed from
90 http://www.indexdata.dk/yaz/ and then you can install the perl module with the
91 command:
92
93 perl -MCPAN -e 'install Net::Z3950'
94
95 Press the <ENTER> key to continue: |;
96
97 $messages->{'CheckingPerlModules'}->{en}=qq|
98
99 ==================
100 = PERL & MODULES =
101 ==================
102
103 Checking perl modules ...
104 |;
105
106 $messages->{'PerlVersionFailure'}->{en}="Sorry, you need at least Perl %s\n";
107
108 $messages->{'MissingPerlModules'}->{en}=qq|
109
110 ========================
111 = MISSING PERL MODULES =
112 ========================
113
114 You are missing some Perl modules which are required by Koha.
115 Once these modules have been installed, rerun this installer.
116 They can be installed by running (as root) the following:
117
118 %s
119 |;
120
121 $messages->{'AllPerlModulesInstalled'}->{en}=qq|
122
123 ==============================
124 = ALL PERL MODULES INSTALLED =
125 ==============================
126
127 All mandatory perl modules are installed.
128
129 Press <ENTER> to continue: |;
130 $messages->{'KohaVersionInstalled'}->{en}="You currently have Koha %s on your system.";
131 $messages->{'KohaUnknownVersionInstalled'}->{en}="I am not able to determine what version of Koha is installed now.";
132 $messages->{'KohaAlreadyInstalled'}->{en}=qq|
133 ==========================
134 = Koha already installed =
135 ==========================
136
137 It looks like Koha is already installed on your system (/etc/koha.conf exists
138 already).  If you would like to upgrade your system to %s, please use
139 the koha.upgrade script in this directory.
140
141 %s
142
143 |;
144 $messages->{'GetOpacDir'}->{en}=qq|
145 ==================
146 = OPAC DIRECTORY =
147 ==================
148
149 Please supply the directory you want Koha to store its OPAC files in.  This
150 directory will be auto-created for you if it doesn't exist.
151
152 OPAC Directory [%s]: |;
153
154 $messages->{'GetIntranetDir'}->{en}=qq|
155 =================================
156 = INTRANET/LIBRARIANS DIRECTORY =
157 =================================
158
159 Please supply the directory you want Koha to store its Intranet/Librarians
160 files in.  This directory will be auto-created for you if it doesn't exist.
161
162 Intranet Directory [%s]: |;
163
164 $messages->{'GetKohaLogDir'}->{en}=qq|
165 ======================
166 = KOHA LOG DIRECTORY =
167 ======================
168
169 Specify a log directory where any Koha daemons can create log files.
170
171 Koha Log Directory [%s]: |;
172
173 $messages->{'AuthenticationWarning'}->{en}=qq|
174 ==================
175 = Authentication =
176 ==================
177
178 This release of Koha has a new authentication module.  If you are not already
179 using basic authentication on your intranet, you will be required to log in to
180 access some of the features of the intranet.  You can log in using the userid
181 and password from the /etc/koha.conf configuration file at any time.  Use the
182 "Members" module to add passwords for other accounts and set their permissions.
183
184 Press the <ENTER> key to continue: |;
185
186 $messages->{'Completed'}->{en}=qq|
187 ==============================
188 = KOHA INSTALLATION COMPLETE =
189 ==============================
190
191 Congratulations ... your Koha installation is complete!
192
193 You will be able to connect to your Librarian interface at:
194
195    http://%s\:%s/
196
197 and the OPAC interface at :
198
199    http://%s\:%s/
200
201
202 Be sure to read the INSTALL, and Hints files. 
203
204 For more information visit http://www.koha.org
205
206 Press <ENTER> to exit the installer: |;
207
208 sub releasecandidatewarning {
209     my $message=getmessage('ReleaseCandidateWarning', [$::newversion, $::newversion]);
210     my $answer=showmessage($message, 'yn', 'n');
211
212     if ($answer =~ /y/i) {
213         print getmessage('continuing');
214     } else {
215         my $message=getmessage('WatchForReleaseAnnouncements');
216         print $message;
217         exit;
218     };
219 }
220
221
222 #
223 # Test for Perl and Modules
224 #
225 #
226 sub checkperlmodules {
227     my $message = getmessage('CheckingPerlModules');
228     showmessage($message, 'none');
229     
230     unless (eval "require 5.006_000") {
231         die getmessage('PerlVersionFailure', ['5.6.0']);
232     }
233
234     my @missing = ();
235     unless (eval {require DBI})               { push @missing,"DBI" };
236     unless (eval {require Date::Manip})       { push @missing,"Date::Manip" };
237     unless (eval {require DBD::mysql})        { push @missing,"DBD::mysql" };
238     unless (eval {require HTML::Template})          { push @missing,"HTML::Template" };
239     unless (eval {require Set::Scalar})       { push @missing,"Set::Scalar" };
240     unless (eval {require Digest::MD5})       { push @missing,"Digest::MD5" };
241     unless (eval {require MARC::Record})       { push @missing,"MARC::Record" };
242     unless (eval {require Net::Z3950})        { 
243         my $message = getmessage('NETZ3950Missing');
244         showmessage($message, 'PressEnter', '', 1);
245         if ($#missing>=0) {
246             push @missing, "Net::Z3950";
247         }
248     }
249
250 #
251 # Print out a list of any missing modules
252 #
253
254     if (@missing > 0) {
255         my $missing='';
256         foreach my $module (@missing) {
257             $missing.="   perl -MCPAN -e 'install \"$module\"'\n";
258         }
259         my $message=getmessage('MissingPerlModules', [$missing]);
260         showmessage($message, 'none');
261         exit;
262     } else {
263         showmessage(getmessage('AllPerlModulesInstalled'), 'PressEnter', '', 1);
264     }
265
266
267     unless (-x "/usr/bin/perl") {
268         my $realperl=`which perl`;
269         chomp $realperl;
270         $realperl = showmessage(getmessage('NoUsrBinPerl'), 'none');
271         until (-x $realperl) {
272             $realperl=showmessage(getmessage('AskLocationOfPerlExecutable', $realperl), 'free', $realperl, 1);
273         }
274         my $response=showmessage(getmessage('ConfirmPerlExecutableSymlink', $realperl), 'yn', 'y', 1);
275         unless ($response eq 'n') {
276             system("ln -s $realperl /usr/bin/perl");
277         }
278     }
279
280
281 }
282
283 $messages->{'NoUsrBinPerl'}->{en}=qq|
284
285 ========================================
286 = Perl is not located in /usr/bin/perl =
287 ========================================
288
289 The Koha perl scripts expect to find the perl executable in the /usr/bin
290 directory.  It is not there on your system.
291
292 |;
293
294 $messages->{'AskLocationOfPerlExecutable'}->{en}=qq|Location of Perl Executable: [%s]: |;
295 $messages->{'ConfirmPerlExecutableSymlink'}->{en}=qq|
296 The Koha scripts will _not_ work without a symlink from %s to /usr/bin/perl
297
298 May I create this symlink? ([Y]/N): 
299 : |;
300
301 sub getmessage {
302     my $messagename=shift;
303     my $variables=shift;
304     my $message=$messages->{$messagename}->{$::language} || $messages->{$messagename}->{en} || "Error: No message named $messagename in Install.pm\n";
305     if (defined($variables)) {
306         $message=sprintf $message, @$variables;
307     }
308     return $message;
309 }
310
311
312 sub showmessage {
313     my $message=shift;
314     my $responsetype=shift;
315     my $defaultresponse=shift;
316     my $noclear=shift;
317     ($noclear) || (system('clear'));
318     if ($responsetype =~ /^yn$/) {
319         $responsetype='restrictchar yn';
320     }
321     print $message;
322     SWITCH: {
323         if ($responsetype =~/^restrictchar (.*)/i) {
324             my $response='\0';
325             my $options=$1;
326             until ($options=~/$response/) {
327                 ($defaultresponse) || ($defaultresponse=substr($options,0,1));
328                 $response=<STDIN>;
329                 chomp $response;
330                 (length($response)) || ($response=$defaultresponse);
331                 unless ($options=~/$response/) {
332                     ($noclear) || (system('clear'));
333                     print "Invalid Response.  Choose from [$options].\n\n";
334                     print $message;
335                 }
336             }
337             return $response;
338         }
339         if ($responsetype =~/^free$/i) {
340             (defined($defaultresponse)) || ($defaultresponse='');
341             my $response=<STDIN>;
342             chomp $response;
343             ($response) || ($response=$defaultresponse);
344             return $response;
345         }
346         if ($responsetype =~/^numerical$/i) {
347             (defined($defaultresponse)) || ($defaultresponse='');
348             my $response='';
349             until ($response=~/^\d+$/) {
350                 $response=<STDIN>;
351                 chomp $response;
352                 ($response) || ($response=$defaultresponse);
353                 unless ($response=~/^\d+$/) {
354                     ($noclear) || (system('clear'));
355                     print "Invalid Response ($response).  Response must be a number.\n\n";
356                     print $message;
357                 }
358             }
359             return $response;
360         }
361         if ($responsetype =~/^email$/i) {
362             (defined($defaultresponse)) || ($defaultresponse='');
363             my $response='';
364             until ($response=~/.*\@.*\..*/) {
365                 $response=<STDIN>;
366                 chomp $response;
367                 ($response) || ($response=$defaultresponse);
368                 unless ($response=~/.*\@.*\..*/) {
369                     ($noclear) || (system('clear'));
370                     print "Invalid Response ($response).  Response must be a valid email address.\n\n";
371                     print $message;
372                 }
373             }
374             return $response;
375         }
376         if ($responsetype =~/^PressEnter$/i) {
377             <STDIN>;
378             return;
379         }
380         if ($responsetype =~/^none$/i) {
381             return;
382         }
383     }
384 }
385
386 sub getinstallationdirectories {
387     $::opacdir = '/usr/local/koha/opac';
388     $::intranetdir = '/usr/local/koha/intranet';
389     my $getdirinfo=1;
390     while ($getdirinfo) {
391         # Loop until opac directory and koha directory are different
392         my $message=getmessage('GetOpacDir', [$::opacdir]);
393         $::opacdir=showmessage($message, 'free', $::opacdir);
394
395         $message=getmessage('GetIntranetDir', [$::intranetdir]);
396         $::intranetdir=showmessage($message, 'free', $::intranetdir);
397
398         if ($::intranetdir eq $::opacdir) {
399             print qq|
400
401 You must specify different directories for the OPAC and INTRANET files!
402  :: $::intranetdir :: $::opacdir ::
403 |;
404 <STDIN>
405         } else {
406             $getdirinfo=0;
407         }
408     }
409     $::kohalogdir='/var/log/koha';
410     my $message=getmessage('GetKohaLogDir', [$::kohalogdir]);
411     $::kohalogdir=showmessage($message, 'free', $::kohalogdir);
412
413
414     unless ( -d $::intranetdir ) {
415        my $result=mkdir ($::intranetdir, oct(770));
416        if ($result==0) {
417            my @dirs = split(m#/#, $::intranetdir);
418             my $checkdir='';
419             foreach (@dirs) {
420                 $checkdir.="$_/";
421                 unless (-e "$checkdir") {
422                     mkdir($checkdir, 0775);
423                 }
424             }
425        }
426        chown (oct(0), (getgrnam($::httpduser))[2], "$::intranetdir");
427        chmod (oct(770), "$::intranetdir");
428     }
429     unless ( -d "$::intranetdir/htdocs" ) {
430        mkdir ("$::intranetdir/htdocs", oct(750));
431     }
432     unless ( -d "$::intranetdir/cgi-bin" ) {
433        mkdir ("$::intranetdir/cgi-bin", oct(750));
434     }
435     unless ( -d "$::intranetdir/modules" ) {
436        mkdir ("$::intranetdir/modules", oct(750));
437     }
438     unless ( -d "$::intranetdir/scripts" ) {
439        mkdir ("$::intranetdir/scripts", oct(750));
440     }
441     unless ( -d $::opacdir ) {
442        my $result=mkdir ($::opacdir, oct(770));
443        if ($result==0) {
444            my @dirs = split(m#/#, $::opacdir);
445             my $checkdir='';
446             foreach (@dirs) {
447                 $checkdir.="$_/";
448                 unless (-e "$checkdir") {
449                     mkdir($checkdir, 0775);
450                 }
451             }
452        }
453        chown (oct(0), (getgrnam($::httpduser))[2], "$::opacdir");
454        chmod (oct(770), "$::opacdir");
455     }
456     unless ( -d "$::opacdir/htdocs" ) {
457        mkdir ("$::opacdir/htdocs", oct(750));
458     }
459     unless ( -d "$::opacdir/cgi-bin" ) {
460        mkdir ("$::opacdir/cgi-bin", oct(750));
461     }
462
463
464     unless ( -d $::kohalogdir ) {
465        my $result=mkdir ($::kohalogdir, oct(770));
466        if ($result==0) {
467            my @dirs = split(m#/#, $::kohalogdir);
468             my $checkdir='';
469             foreach (@dirs) {
470                 $checkdir.="$_/";
471                 unless (-e "$checkdir") {
472                     mkdir($checkdir, 0775);
473                 }
474             }
475        }
476
477        chown (oct(0), (getgrnam($::httpduser))[2,3], "$::kohalogdir");
478        chmod (oct(770), "$::kohalogdir");
479     }
480 }
481
482
483
484 $messages->{'DatabaseName'}->{en}=qq|
485 ==========================
486 = Name of MySQL database =
487 ==========================
488
489 Please provide the name of the mysql database for your koha installation.
490
491 Database name [%s]: |;
492
493 $messages->{'DatabaseHost'}->{en}=qq|
494 =================
495 = Database Host =
496 =================
497
498 Please provide the hostname for mysql.  Unless the database is located on
499 another machine this will be "localhost".
500
501 Database host [%s]: |;
502
503 $messages->{'DatabaseUser'}->{en}=qq|
504 =================
505 = Database User =
506 =================
507
508 Please provide the name of the user, who will have full administrative rights
509 to the %s database, when authenticating from %s.
510
511 Database user [%s]: |;
512
513 $messages->{'DatabasePassword'}->{en}=qq|
514 =====================
515 = Database Password =
516 =====================
517
518 Please provide a good password for the user %s.
519
520 Database Password: |;
521
522 $messages->{'BlankPassword'}->{en}=qq|
523 ==================
524 = BLANK PASSWORD =
525 ==================
526
527 You must not use a blank password for your MySQL user!
528
529 Press <ENTER> to try again: 
530 |;
531
532 sub getdatabaseinfo {
533
534     $::dbname = 'Koha';
535     $::hostname = 'localhost';
536     $::user = 'kohaadmin';
537     $::pass = '';
538
539 #Get the database name
540
541     my $message=getmessage('DatabaseName', [$::dbname]);
542     $::dbname=showmessage($message, 'free', $::dbname);
543
544 #Get the hostname for the database
545     
546     $message=getmessage('DatabaseHost', [$::hostname]);
547     $::hostname=showmessage($message, 'free', $::hostname);
548
549 #Get the username for the database
550
551     $message=getmessage('DatabaseUser', [$::dbname, $::hostname, $::user]);
552     $::user=showmessage($message, 'free', $::user);
553
554 #Get the password for the database user
555
556     while ($::pass eq '') {
557         my $message=getmessage('DatabasePassword', [$::user]);
558         $::pass=showmessage($message, 'free', $::pass);
559         if ($::pass eq '') {
560             my $message=getmessage('BlankPassword');
561             showmessage($message,'PressEnter');
562         }
563     }
564 }
565
566
567
568 $messages->{'FoundMultipleApacheConfFiles'}->{en}=qq|
569 ================================
570 = MULTIPLE APACHE CONFIG FILES =
571 ================================
572
573 I found more than one possible Apache configuration file:
574
575 %s
576
577 Choose the correct file [1]: |;
578
579 $messages->{'NoApacheConfFiles'}->{en}=qq|
580 ===============================
581 = NO APACHE CONFIG FILE FOUND =
582 ===============================
583
584 I was not able to find your Apache configuration file.
585
586 The file is usually called httpd.conf or apache.conf.
587
588 Please specify the location of your config file: |;
589
590 $messages->{'NotAFile'}->{en}=qq|
591 =======================
592 = FILE DOES NOT EXIST =
593 =======================
594
595 The file %s does not exist.
596
597 Please press <ENTER> to continue: |;
598
599 $messages->{'EnterApacheUser'}->{en}=qq|
600 ====================
601 = NEED APACHE USER =
602 ====================
603
604 I was not able to determine the user that Apache is running as.  This
605 information is necessary in order to set the access privileges correctly on
606 /etc/koha.conf.  This user should be set in one of the Apache configuration
607 files using the "User" directive.
608
609 Enter the Apache userid: |;
610
611 $messages->{'InvalidUserid'}->{en}=qq|
612 ==================
613 = INVALID USERID =
614 ==================
615
616 The userid %s is not a valid userid on this system.
617
618 Press <ENTER> to continue: |;
619
620 sub getapacheinfo {
621     my @confpossibilities;
622
623     foreach my $httpdconf (qw(/usr/local/apache/conf/httpd.conf
624                           /usr/local/etc/apache/httpd.conf
625                           /usr/local/etc/apache/apache.conf
626                           /var/www/conf/httpd.conf
627                           /etc/apache/conf/httpd.conf
628                           /etc/apache/conf/apache.conf
629                           /etc/apache-ssl/conf/apache.conf
630                           /etc/apache-ssl/httpd.conf
631                           /etc/httpd/conf/httpd.conf
632                           /etc/httpd/httpd.conf)) {
633         if ( -f $httpdconf ) {
634             push @confpossibilities, $httpdconf;
635         }
636     }
637
638     if ($#confpossibilities==-1) {
639         my $message=getmessage('NoApacheConfFiles');
640         my $choice='';
641         until (-f $choice) {
642             $choice=showmessage($message, "free", 1);
643             if (-f $choice) {
644                 $::realhttpdconf=$choice;
645             } else {
646                 showmessage(getmessage('NotAFile', [$choice]),'PressEnter', '', 1);
647             }
648         }
649     } elsif ($#confpossibilities>0) {
650         my $conffiles='';
651         my $counter=1;
652         my $options='';
653         foreach (@confpossibilities) {
654             $conffiles.="   $counter: $_\n";
655             $options.="$counter";
656             $counter++;
657         }
658         my $message=getmessage('FoundMultipleApacheConfFiles', [$conffiles]);
659         my $choice=showmessage($message, "restrictchar $options", 1);
660         $::realhttpdconf=$confpossibilities[$choice-1];
661     } else {
662         $::realhttpdconf=$confpossibilities[0];
663     }
664     unless (open (HTTPDCONF, $::realhttpdconf)) {
665         warn "Insufficient privileges to open $::realhttpdconf for reading.\n";
666         sleep 4;
667     }
668
669     while (<HTTPDCONF>) {
670         if (/^\s*User\s+"?([-\w]+)"?\s*$/) {
671             $::httpduser = $1;
672         }
673     }
674     close(HTTPDCONF);
675
676
677
678
679     unless ($::httpduser) {
680         my $message=getmessage('EnterApacheUser');
681         until (length($::httpduser) && getpwnam($::httpduser)) {
682             $::httpduser=showmessage($message, "free", '');
683             if (length($::httpduser)>0) {
684                 unless (getpwnam($::httpduser)) {
685                     my $message=getmessage('InvalidUserid', [$::httpduser]);
686                     showmessage($message,'PressEnter');
687                 }
688             } else {
689             }
690         }
691         print "AU: $::httpduser\n";
692     }
693 }
694
695
696 $messages->{'ApacheConfigIntroduction'}->{en}=qq|
697 ========================
698 = APACHE CONFIGURATION =
699 ========================
700
701 Koha needs to setup your Apache configuration file for the
702 OPAC and LIBRARIAN virtual hosts.  By default this installer
703 will do this by using one ip address and two different ports
704 for the virtual hosts.  There are other ways to set this up,
705 and the installer will leave comments in httpd.conf detailing
706 what these other options are.
707
708
709 Press <ENTER> to continue: |;
710
711 $messages->{'GetVirtualHostEmail'}->{en}=qq|
712 =============================
713 = WEB SERVER E-MAIL CONTACT =
714 =============================
715
716 Enter the e-mail address to be used as a contact for the virtual hosts (this
717 address is displayed if any errors are encountered).
718
719 E-mail contact [%s]: |;
720
721 $messages->{'GetServerName'}->{en}=qq|
722 ======================================
723 = WEB SERVER HOST NAME OR IP ADDRESS =
724 ======================================
725
726 Please enter the domain name or ip address of your computer.
727
728 Host name or IP Address [%s]: |;
729
730 $messages->{'GetOpacPort'}->{en}=qq|
731 ==========================
732 = OPAC VIRTUAL HOST PORT =
733 ==========================
734
735 Please enter the port for your OPAC interface.  This defaults to port 80, but
736 if you are already serving web content from this server, you should change it
737 to a different port (8000 might be a good choice).
738
739 Enter the OPAC Port [%s]: |;
740
741 $messages->{'GetIntranetPort'}->{en}=qq|
742 ==============================
743 = INTRANET VIRTUAL HOST PORT =
744 ==============================
745
746 Please enter the port for your Intranet interface.  This must be different from
747 the OPAC port (%s).
748
749 Enter the Intranet Port [%s]: |;
750
751
752 sub getapachevhostinfo {
753
754     $::svr_admin = "webmaster\@$::domainname";
755     $::servername=`hostname -f`;
756     chomp $::servername;
757     $::opacport=80;
758     $::intranetport=8080;
759
760     showmessage(getmessage('ApacheConfigIntroduction'), 'PressEnter');
761
762     $::svr_admin=showmessage(getmessage('GetVirtualHostEmail', [$::svr_admin]), 'email', $::svr_admin);
763     $::servername=showmessage(getmessage('GetServerName', [$::servername]), 'free', $::servername);
764
765
766     $::opacport=showmessage(getmessage('GetOpacPort', [$::opacport]), 'numerical', $::opacport);
767     $::intranetport=showmessage(getmessage('GetIntranetPort', [$::opacport, $::intranetport]), 'numerical', $::intranetport);
768
769 }
770
771 $messages->{'StartUpdateApache'}->{en}=qq|
772 =================================
773 = UPDATING APACHE CONFIGURATION =
774 =================================
775
776 Checking for modules that need to be loaded...
777 |;
778
779 $messages->{'LoadingApacheModuleModEnv'}->{en}="Loading SetEnv Apache module.\n";
780
781 $messages->{'LoadingApacheModuleModInc'}->{en}="Loading Includes Apache module.\n";
782
783 $messages->{'ApacheConfigBackupFailed'}->{en}=qq|
784 ======================================
785 = APACHE CONFIGURATION BACKUP FAILED =
786 ======================================
787
788 An error occurred while trying to make a backup copy of %s.
789
790   %s
791
792 No changes will be made to the apache configuration file at this time.
793
794 Press <ENTER> to continue: |;
795
796
797 $messages->{'ApacheAlreadyConfigured'}->{en}=qq|
798 =============================
799 = APACHE ALREADY CONFIGURED =
800 =============================
801
802 %s appears to already have an entry for Koha
803 Virtual Hosts.  You may need to edit %s
804 f anything has changed since it was last set up.  This
805 script will not attempt to modify an existing Koha apache
806 configuration.
807
808 Press <ENTER> to continue: |;
809
810 sub updateapacheconf {
811     my $logfiledir=`grep ^ErrorLog $::realhttpdconf`;
812     chomp $logfiledir;
813
814     if ($logfiledir) {
815         $logfiledir=~m#ErrorLog (.*)/[^/]*$#;
816         $logfiledir=$1;
817     }
818
819     unless ($logfiledir) {
820         $logfiledir='logs';
821     }
822
823     showmessage(getmessage('StartUpdateApache'), 'none');
824
825     my $httpdconf;
826     my $envmodule=0;
827     my $includesmodule=0;
828     open HC, $::realhttpdconf;
829     while (<HC>) {
830         if (/^\s*#\s*LoadModule env_module /) {
831             s/^\s*#\s*//;
832             showmessage(getmessage('LoadingApacheModuleModEnv'));
833             $envmodule=1;
834         }
835         if (/^\s*#\s*LoadModule includes_module /) {
836             s/^\s*#\s*//;
837             showmessage(getmessage('LoadingApacheModuleModInc'));
838         }
839         if (/\s*LoadModule includes_module / ) {
840             $includesmodule=1;
841         }
842         $httpdconf.=$_;
843     }
844
845     my $backupfailed=0;
846     $backupfailed=`cp -f $::realhttpdconf $::realhttpdconf\.prekoha`;
847     if ($backupfailed) {
848         showmessage(getmessage('ApacheConfigBackupFailed', [$::realhttpdconf,$backupfailed ]), 'PressEnter');
849         return;
850     }
851
852     if ($envmodule || $includesmodule) {
853         open HC, ">$::realhttpdconf";
854         print HC $httpdconf;
855         close HC;
856     }
857
858
859     
860     if (`grep 'VirtualHost $::servername' $::realhttpdconf`) {
861         showmessage(getmessage('ApacheAlreadyConfigured', [$::realhttpdconf, $::realhttpdconf]), 'PressEnter');
862         return;
863     } else {
864         my $includesdirectives='';
865         if ($includesmodule) {
866             $includesdirectives.="Options +Includes\n";
867             $includesdirectives.="   AddHandler server-parsed .html\n";
868         }
869         open(SITE,">>$::realhttpdconf") or warn "Insufficient priveleges to open $::realhttpdconf for writing.\n";
870         my $opaclisten = '';
871         if ($::opacport != 80) {
872             $opaclisten="Listen $::opacport";
873         }
874         my $intranetlisten = '';
875         if ($::intranetport != 80) {
876             $intranetlisten="Listen $::intranetport";
877         }
878         print SITE <<EOP
879
880 # Ports to listen to for Koha
881 $opaclisten
882 $intranetlisten
883
884 # NameVirtualHost is used by one of the optional configurations detailed below
885
886 #NameVirtualHost 11.22.33.44
887
888 # KOHA's OPAC Configuration
889 <VirtualHost $::servername\:$::opacport>
890    ServerAdmin $::svr_admin
891    DocumentRoot $::opacdir/htdocs
892    ServerName $::servername
893    ScriptAlias /cgi-bin/koha/ $::opacdir/cgi-bin/
894    ErrorLog $logfiledir/opac-error_log
895    TransferLog $logfiledir/opac-access_log
896    SetEnv PERL5LIB "$::intranetdir/modules"
897    $includesdirectives
898 </VirtualHost>
899
900 # KOHA's INTRANET Configuration
901 <VirtualHost $::servername\:$::intranetport>
902    ServerAdmin $::svr_admin
903    DocumentRoot $::intranetdir/htdocs
904    ServerName $::servername
905    ScriptAlias /cgi-bin/koha/ "$::intranetdir/cgi-bin/"
906    ErrorLog $logfiledir/koha-error_log
907    TransferLog $logfiledir/koha-access_log
908    SetEnv PERL5LIB "$::intranetdir/modules"
909    $includesdirectives
910 </VirtualHost>
911
912 # If you want to use name based Virtual Hosting:
913 #   1. remove the two Listen lines
914 #   2. replace $::servername\:$::opacport wih your.opac.domain.name
915 #   3. replace ServerName $::servername wih ServerName your.opac.domain.name
916 #   4. replace $::servername\:$::intranetport wih your intranet domain name
917 #   5. replace ServerName $::servername wih ServerName your.intranet.domain.name
918 #
919 # If you want to use NameVirtualHost'ing (using two names on one ip address):
920 #   1.  Follow steps 1-5 above
921 #   2.  Uncomment the NameVirtualHost line and set the correct ip address
922
923 EOP
924
925
926     }
927 }
928
929 $messages->{'IntranetAuthenticationQuestion'}->{en}=qq|
930 ===========================
931 = INTRANET AUTHENTICATION =
932 ===========================
933
934 I can set it up so that the Intranet/Librarian site is password protected using
935 Apache's Basic Authorization.
936
937 Would you like to do this ([Y]/N): |;
938
939 $messages->{'BasicAuthUsername'}->{en}="Please enter a userid for intranet access [%s]: ";
940 $messages->{'BasicAuthPassword'}->{en}="Please enter a password for %s: ";
941 $messages->{'BasicAuthPasswordWasBlank'}->{en}="\nYou cannot use a blank password!\n\n";
942
943 sub basicauthentication {
944     my $message=getmessage('IntranetAuthenticationQuestion');
945     my $answer=showmessage($message, 'yn', 'y');
946
947     my $apacheauthusername='librarian';
948     my $apacheauthpassword='';
949     if ($answer=~/^y/i) {
950         ($apacheauthusername) = showmessage(getmessage('BasicAuthUsername', [ $apacheauthusername]), 'free', $apacheauthusername, 1);
951         $apacheauthusername=~s/[^a-zA-Z0-9]//g;
952         while (! $apacheauthpassword) {
953             ($apacheauthpassword) = showmessage(getmessage('BasicAuthPassword', [ $apacheauthusername]), 'free', 1);
954             if (!$apacheauthpassword) {
955                 ($apacheauthpassword) = showmessage(getmessage('BasicAuthPasswordWasBlank'), 'none', '', 1);
956             }
957         }
958         open AUTH, ">/etc/kohaintranet.pass";
959         my $chars='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
960         my $salt=substr($chars, int(rand(length($chars))),1);
961         $salt.=substr($chars, int(rand(length($chars))),1);
962         print AUTH $apacheauthusername.":".crypt($apacheauthpassword, $salt)."\n";
963         close AUTH;
964         open(SITE,">>$::realhttpdconf") or warn "Insufficient priveleges to open $::realhttpdconf for writing.\n";
965         print SITE <<EOP
966
967 <Directory $::intranetdir>
968     AuthUserFile /etc/kohaintranet.pass
969     AuthType Basic
970     AuthName "Koha Intranet (for librarians only)"
971     Require  valid-user
972 </Directory>
973 EOP
974     }
975     close(SITE);
976 }
977
978 $messages->{'InstallFiles'}->{en}=qq|
979 ====================
980 = INSTALLING FILES =
981 ====================
982
983 Copying files to installation directories:
984
985 |;
986
987
988 $messages->{'CopyingFiles'}->{en}="Copying %s to %s.\n";
989
990
991
992 sub installfiles {
993
994
995     showmessage(getmessage('InstallFiles'),'none');
996     print getmessage('CopyingFiles', ['intranet-html', "$::intranetdir/htdocs" ]);
997     system("cp -R intranet-html/* $::intranetdir/htdocs/");
998     print getmessage('CopyingFiles', ['intranet-cgi', "$::intranetdir/cgi-bin" ]);
999     system("cp -R intranet-cgi/* $::intranetdir/cgi-bin/");
1000     print getmessage('CopyingFiles', ['stand-alone scripts', "$::intranetdir/scripts" ]);
1001     system("cp -R scripts/* $::intranetdir/scripts/");
1002     print getmessage('CopyingFiles', ['perl modules', "$::intranetdir/modules" ]);
1003     system("cp -R modules/* $::intranetdir/modules/");
1004     print getmessage('CopyingFiles', ['opac-html', "$::opacdir/htdocs" ]);
1005     system("cp -R opac-html/* $::opacdir/htdocs/");
1006     print getmessage('CopyingFiles', ['opac-cgi', "$::opacdir/cgi-bin" ]);
1007     system("cp -R opac-cgi/* $::opacdir/cgi-bin/");
1008     system("touch $::opacdir/cgi-bin/opac");
1009
1010     system("chown -R root.$::httpduser $::opacdir");
1011     system("chown -R root.$::httpduser $::intranetdir");
1012
1013     # Create /etc/koha.conf
1014
1015     my $old_umask = umask(027); # make sure koha.conf is never world-readable
1016     open(SITES,">$::etcdir/koha.conf.tmp") or warn "Couldn't create file at $::etcdir. Must have write capability.\n";
1017     print SITES qq|
1018 database=$::dbname
1019 hostname=$::hostname
1020 user=$::user
1021 pass=$::pass
1022 includes=$::intranetdir/htdocs/includes
1023 intranetdir=$::intranetdir
1024 opacdir=$::opacdir
1025 kohalogdir=$::kohalogdir
1026 kohaversion=$::kohaversion
1027 httpduser=$::httpduser
1028 |;
1029     close(SITES);
1030     umask($old_umask);
1031
1032     chown((getpwnam($::httpduser)) [2,3], "$::etcdir/koha.conf.tmp") or warn "can't chown koha.conf: $!";
1033     chmod 0440, "$::etcdir/koha.conf.tmp";
1034
1035     chmod 0750, "$::intranetdir/scripts/z3950daemon/z3950-daemon-launch.sh";
1036     chmod 0750, "$::intranetdir/scripts/z3950daemon/z3950-daemon-shell.sh";
1037     chmod 0750, "$::intranetdir/scripts/z3950daemon/processz3950queue";
1038     chown(0, (getpwnam($::httpduser)) [3], "$::intranetdir/scripts/z3950daemon/z3950-daemon-shell.sh") or warn "can't chown $::intranetdir/scripts/z3950daemon/z3950-daemon-shell.sh: $!";
1039     chown(0, (getpwnam($::httpduser)) [3], "$::intranetdir/scripts/z3950daemon/processz3950queue") or warn "can't chown $::intranetdir/scripts/z3950daemon/processz3950queue: $!";
1040
1041 }
1042
1043 $messages->{'MysqlRootPassword'}->{en}=qq|
1044 ============================
1045 = MYSQL ROOT USER PASSWORD =
1046 ============================
1047
1048 To allow us to create the koha database please supply your
1049 mysql server's root user password:
1050
1051 Enter MySql root user password: |;
1052
1053 $messages->{'InvalidMysqlRootPassword'}->{en}="Invalid Password.  Please try again.";
1054
1055 $messages->{'CreatingDatabase'}->{en}=qq|
1056 =====================
1057 = CREATING DATABASE =
1058 =====================
1059
1060 Creating the MySql database for Koha...
1061
1062 |;
1063
1064 $messages->{'CreatingDatabaseError'}->{en}=qq|
1065 ===========================
1066 = ERROR CREATING DATABASE =
1067 ===========================
1068
1069 Couldn't connect to the MySQL server for the reason given above.
1070 This is a serious problem, the database will not get installed.\a
1071
1072 Press <ENTER> to continue: |;
1073
1074 $messages->{'SampleData'}->{en}=qq|
1075 ===============
1076 = SAMPLE DATA =
1077 ===============
1078
1079 If you are installing Koha for evaluation purposes,  I have a batch of sample
1080 data that you can install now.
1081
1082 If you are installing Koha with the intention of populating it with your own
1083 data, you probably don't want this sample data installed.
1084
1085 Would you like to install the sample data? Y/[N]: |;
1086
1087 $messages->{'SampleDataInstalled'}->{en}=qq|
1088 =========================
1089 = SAMPLE DATA INSTALLED =
1090 =========================
1091
1092 Sample data has been installed.  For some suggestions on testing Koha, please
1093 read the file doc/HOWTO-Testing.  If you find any bugs, please submit them at
1094 http://bugs.koha.org/.  If you need help with testing Koha, you can post a
1095 question through the koha-devel mailing list, or you can check for a developer
1096 online at +irc.katipo.co.nz:6667 channel #koha.
1097
1098 You can find instructions for subscribing to the Koha mailing lists at:
1099
1100     http://www.koha.org
1101
1102
1103 Press <ENTER> to continue: |;
1104
1105 $messages->{'AddBranchPrinter'}->{en}=qq|
1106 ==========================
1107 = Add Branch and Printer =
1108 ==========================
1109
1110 Would you like to install an initial branch and printer? [Y]/N: |;
1111
1112 $messages->{'BranchName'}->{en}="Branch Name [%s]: ";
1113 $messages->{'BranchCode'}->{en}="Branch Code (4 letters or numbers) [%s]: ";
1114 $messages->{'PrinterQueue'}->{en}="Printer Queue [%s]: ";
1115 $messages->{'PrinterName'}->{en}="Printer Name [%s]: ";
1116 $messages->{'BlankMysqlPassword'}->{en}=qq|
1117 ========================
1118 = Blank MySql Password =
1119 ========================
1120
1121 Do not leave your MySql root password blank unless you know exactly what you
1122 are doing.  To change your MySql root password use the mysqladmin command:
1123
1124 mysqladmin password NEWPASSWORDHERE
1125
1126 Press <ENTER> to continue: 
1127 |;
1128
1129 sub databasesetup {
1130     $::mysqluser = 'root';
1131     $::mysqlpass = '';
1132
1133     foreach my $mysql (qw(/usr/local/mysql
1134                           /opt/mysql
1135                           /usr
1136                           )) {
1137        if ( -d $mysql  && -f "$mysql/bin/mysqladmin") {
1138             $::mysqldir=$mysql;
1139        }
1140     }
1141     if (!$::mysqldir){
1142         print "I don't see mysql in the usual places.\n";
1143         for (;;) {
1144             print "Where have you installed mysql? ";
1145             chomp($::mysqldir = <STDIN>);
1146             last if -f "$::mysqldir/bin/mysqladmin";
1147         print <<EOP;
1148
1149 I can't find it there either. If you compiled mysql yourself,
1150 please give the value of --prefix when you ran configure.
1151
1152 The file mysqladmin should be in bin/mysqladmin under the directory that you
1153 provide here.
1154
1155 EOP
1156         }
1157     }
1158
1159
1160     my $needpassword=1;
1161     while ($needpassword) {
1162         $::mysqlpass=showmessage(getmessage('MysqlRootPassword'), 'free');
1163         $::mysqlpass_quoted = $::mysqlpass;
1164         $::mysqlpass_quoted =~ s/"/\\"/g;
1165         $::mysqlpass_quoted="-p\"$::mysqlpass_quoted\"";
1166         $::mysqlpass eq '' and $::mysqlpass_quoted='';
1167         my $result=system("$::mysqldir/bin/mysqladmin -u$::mysqluser $::mysqlpass_quoted proc > /dev/null 2>&1");
1168         if ($result) {
1169             print getmessage('InvalidMysqlRootPassword');
1170         } else {
1171             if ($::mysqlpass eq '') {
1172                 showmessage(getmessage('BlankMysqlPassword'), 'PressEnter');
1173             }
1174             $needpassword=0;
1175         }
1176     }
1177
1178     showmessage(getmessage('CreatingDatabase'),'none');
1179
1180     my $result=system("$::mysqldir/bin/mysqladmin", "-u$::mysqluser", "-p$::mysqlpass", "create", "$::dbname");
1181     if ($result) {
1182         showmessage(getmessage('CreatingDatabaseError'),'PressEnter', '', 1);
1183     } else {
1184         # Populate the Koha database
1185         system("$::mysqldir/bin/mysql -u$::mysqluser $::mysqlpass_quoted $::dbname < koha.mysql");
1186         # Set up permissions
1187         system("$::mysqldir/bin/mysql -u$::mysqluser $::mysqlpass_quoted mysql -e \"insert into user (Host,User,Password) values ('$::hostname','$::user',password('$::pass'))\"\;");
1188         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')\"");
1189         system("$::mysqldir/bin/mysqladmin -u$::mysqluser $::mysqlpass_quoted reload");
1190
1191
1192
1193
1194
1195     }
1196
1197 }
1198
1199 $messages->{'UpdateMarcTables'}->{en}=qq|
1200 =========================================
1201 = UPDATING MARC FIELD DEFINITION TABLES =
1202 =========================================
1203
1204 You can import marc parameters for :
1205
1206   1 MARC21
1207   2 UNIMARC
1208   3 none
1209
1210 Please choose which parameter you want to install. Note if you choose 3,
1211 nothing will be added, and it can be a BIG job to manually create those tables
1212
1213 Choose MARC definition [1]: |;
1214
1215
1216 sub updatedatabase {
1217     my $result=system ("perl -I $::intranetdir/modules scripts/updater/updatedatabase");
1218     if ($result) {
1219         print "Problem updating database...\n";
1220         exit;
1221     }
1222
1223     my $response=showmessage(getmessage('UpdateMarcTables'), 'restrictchar 123', '1');
1224
1225     if ($response == 1) {
1226         system("cat script/misc/marc_datas/marc21_en/structure_def.sql | $mysqldir/bin/mysql -u$mysqluser -p$mysqlpass $dbname");
1227     }
1228     if ($response == 2) {
1229         system("cat scripts/misc/marc_datas/unimarc_fr/structure_def.sql | $mysqldir/bin/mysql -u$mysqluser -p$mysqlpass $dbname");
1230         system("cat scripts/misc/lang-datas/fr/stopwords.sql | $mysqldir/bin/mysql -u$mysqluser -p$mysqlpass $dbname");
1231     }
1232
1233     system ("perl -I $kohadir/modules scripts/marc/updatedb2marc.pl");
1234
1235     
1236     print "\n\nFinished updating database. Press <ENTER> to continue...";
1237     <STDIN>;
1238 }
1239
1240 sub populatedatabase {
1241     my $response=showmessage(getmessage('SampleData'), 'yn', 'n');
1242     if ($response =~/^y/i) {
1243         system("gunzip sampledata-1.2.gz");
1244         system("cat sampledata-1.2 | $::mysqldir/bin/mysql -u$::mysqluser $::mysqlpass_quoted $::dbname");
1245         system("gzip -9 sampledata-1.2");
1246         system("$::mysqldir/bin/mysql -u$::mysqluser $::mysqlpass_quoted $::dbname -e \"insert into branches (branchcode,branchname,issuing) values ('MAIN', 'Main Library', 1)\"");
1247         system("$::mysqldir/bin/mysql -u$::mysqluser $::mysqlpass_quoted $::dbname -e \"insert into branchrelations (branchcode,categorycode) values ('MAIN', 'IS')\"");
1248         system("$::mysqldir/bin/mysql -u$::mysqluser $::mysqlpass_quoted $::dbname -e \"insert into branchrelations (branchcode,categorycode) values ('MAIN', 'CU')\"");
1249         system("$::mysqldir/bin/mysql -u$::mysqluser $::mysqlpass_quoted $::dbname -e \"insert into printers (printername,printqueue,printtype) values ('Circulation Desk Printer', 'lp', 'hp')\"");
1250         showmessage(getmessage('SampleDataInstalled'), 'PressEnter','',1);
1251     } else {
1252         my $input;
1253         my $response=showmessage(getmessage('AddBranchPrinter'), 'yn', 'y');
1254
1255         unless ($response =~/^n/i) {
1256             my $branch='Main Library';
1257             $branch=showmessage(getmessage('BranchName', [$branch]), 'free', $branch, 1);
1258             $branch=~s/[^A-Za-z0-9\s]//g;
1259
1260             my $branchcode=$branch;
1261             $branchcode=~s/[^A-Za-z0-9]//g;
1262             $branchcode=uc($branchcode);
1263             $branchcode=substr($branchcode,0,4);
1264             $branchcode=showmessage(getmessage('BranchCode', [$branchcode]), 'free', $branchcode, 1);
1265             $branchcode=~s/[^A-Za-z0-9]//g;
1266             $branchcode=uc($branchcode);
1267             $branchcode=substr($branchcode,0,4);
1268             $branchcode or $branchcode='DEF';
1269
1270             system("$::mysqldir/bin/mysql -u$::mysqluser $::mysqlpass_quoted $::dbname -e \"insert into branches (branchcode,branchname,issuing) values ('$branchcode', '$branch', 1)\"");
1271             system("$::mysqldir/bin/mysql -u$::mysqluser $::mysqlpass_quoted $::dbname -e \"insert into branchrelations (branchcode,categorycode) values ('MAIN', 'IS')\"");
1272             system("$::mysqldir/bin/mysql -u$::mysqluser $::mysqlpass_quoted $::dbname -e \"insert into branchrelations (branchcode,categorycode) values ('MAIN', 'CU')\"");
1273
1274             my $printername='Library Printer';
1275             $printername=showmessage(getmessage('PrinterName', [$printername]), 'free', $printername, 1);
1276             $printername=~s/[^A-Za-z0-9\s]//g;
1277
1278             my $printerqueue='lp';
1279             $printerqueue=showmessage(getmessage('PrinterQueue', [$printerqueue]), 'free', $printerqueue, 1);
1280             $printerqueue=~s/[^A-Za-z0-9]//g;
1281             system("$::mysqldir/bin/mysql -u$::mysqluser $::mysqlpass_quoted $::dbname -e \"insert into printers (printername,printqueue,printtype) values ('$printername', '$printerqueue', '')\"");
1282
1283         }
1284     }
1285 }
1286
1287 $messages->{'RestartApache'}->{en}=qq|
1288 ==================
1289 = RESTART APACHE =
1290 ==================
1291
1292 Apache needs to be restarted to load the new configuration for Koha.
1293
1294 Would you like to restart Apache now?  [Y]/N: |;
1295
1296 sub restartapache {
1297
1298     my $response=showmessage(getmessage('RestartApache'), 'yn', 'y');
1299
1300
1301
1302     unless ($response=~/^n/i) {
1303         # Need to support other init structures here?
1304         if (-e "/etc/rc.d/init.d/httpd") {
1305             system('/etc/rc.d/init.d/httpd restart');
1306         } elsif (-e "/etc/init.d/apache") {
1307             system('/etc//init.d/apache restart');
1308         } elsif (-e "/etc/init.d/apache-ssl") {
1309             system('/etc/init.d/apache-ssl restart');
1310         }
1311     }
1312
1313 }
1314
1315
1316 sub loadconfigfile {
1317     my %configfile;
1318
1319     open (KC, "/etc/koha.conf");
1320     while (<KC>) {
1321      chomp;
1322      (next) if (/^\s*#/);
1323      if (/(.*)\s*=\s*(.*)/) {
1324        my $variable=$1;
1325        my $value=$2;
1326        # Clean up white space at beginning and end
1327        $variable=~s/^\s*//g;
1328        $variable=~s/\s*$//g;
1329        $value=~s/^\s*//g;
1330        $value=~s/\s*$//g;
1331        $configfile{$variable}=$value;
1332      }
1333     }
1334
1335     $::intranetdir=$configfile{'intranetdir'};
1336     $::opacdir=$configfile{'opacdir'};
1337     $::kohaversion=$configfile{'kohaversion'};
1338     $::kohalogdir=$configfile{'kohalogdir'};
1339     $::database=$configfile{'database'};
1340     $::hostname=$configfile{'hostname'};
1341     $::user=$configfile{'user'};
1342     $::pass=$configfile{'pass'};
1343 }
1344
1345 END { }       # module clean-up code here (global destructor)
1346
1347 1;