1 #!/usr/bin/perl -w # please develop with -w
8 use strict; # please develop with the strict pragma
10 use vars qw( $input );
12 Install::setlanguage 'en';
14 my $domainname = `hostname`; # Note: must not have any arguments (portability)
15 if ($domainname =~ /^[^\s\.]+\.([-a-z0-9\.]+)$/) {
19 if (open(INPUT, "</etc/resolv.conf")) {
21 $domainname = $1 if /^domain\s+([-a-z0-9\.]+)\s*$/i;
22 last if defined $domainname;
26 elsif (open(INPUT, "</etc/hostname")) {
27 $domainname = <INPUT>;
30 Install::setdomainname $domainname;
32 ###############################################
33 # SET THE etcdir ENVIRONMENT VAR INSTEAD #
34 ###############################################
35 my $etcdir = $ENV{etcdir}||'/etc';
36 system("mkdir -p $etcdir");
38 my ($auto_install_file,$auto_install);
40 'i:s' => \$auto_install_file,
42 $auto_install = read_autoinstall_file($auto_install_file) if $auto_install_file;
44 Install::setetcdir $etcdir;
46 unless (-d 'intranet-html') {
48 You seem to be installing from CVS. Please run the "buildrelease" script
49 and install from the resulting release tarball.
54 my $kohaversion=`cat koha.version`;
56 Install::setkohaversion $kohaversion;
59 if ($kohaversion =~ /RC/) {
60 releasecandidatewarning();
63 checkabortedinstall();
65 if (-e "$etcdir/koha.conf") {
66 my $installedversion=`grep kohaversion= "$etcdir/koha.conf"`;
67 chomp $installedversion;
68 $installedversion=~m/kohaversion=(.*)/;
70 my $installedversionmsg;
71 if ($installedversion) {
72 $installedversionmsg=getmessage('KohaVersionInstalled', [$installedversion]);
74 $installedversionmsg=getmessage('KohaUnknownVersionInstalled');
77 my $message=getmessage('KohaAlreadyInstalled', [$etcdir, $kohaversion, $installedversionmsg]);
78 showmessage($message, 'none');
82 my $continuingmsg=getmessage('continuing');
84 my $message=getmessage('WelcomeToKohaInstaller');
85 my $answer=showmessage($message, 'yn');
87 if ($answer eq "Y" || $answer eq "y") {
91 This installer currently does not support a completely automated
94 Please be sure to read the documentation, or visit the Koha website
95 at http://www.koha.org for more information.
100 # Check for missing Perl Modules
101 checkperlmodules($auto_install);
103 # Ask for installation directories
104 getapacheinfo($auto_install);
106 getinstallationdirectories($auto_install);
108 getdatabaseinfo($auto_install);
110 getapachevhostinfo($auto_install);
112 updateapacheconf($auto_install);
114 # basicauthentication();
116 installfiles(1,$auto_install);
120 databasesetup($auto_install);
122 updatedatabase($auto_install);
124 populatedatabase($auto_install);
128 finalizeconfigfile();
130 restartapache($auto_install);
132 showmessage(getmessage('AuthenticationWarning', [$etcdir]), 'PressEnter') unless ($auto_install->{NoPressEnter});
134 showmessage(getmessage('Completed', [ Install::getservername(), Install::getintranetport(), Install::getservername(), Install::getopacport()]), 'PressEnter');
136 if (-f "kohareporter") {
137 my $reply=showmessage('Would you like to complete a survey about your library?', 'yn', 'y');
139 system("perl kohareporter");