Permalink
Browse files

don't try to resolve if WEBSERVER_IP is set and now use WEBSERVER_HOST.

as it crashed the installer when DNS doesn't respond as expected.

it will now use the WEBSERVER_HOST described in the doc but unused in the script.

TODO:

- lot of koha-httpd.conf generation is useless if you plan to use vhosts strategy
- on some recent linux distributions, $(getent hosts `hostname`) will give us
  127.0.0.1. this is to not mess up the MTA when there is no network. Don't
  you think there would be an error message in this case?
- default domain is localdomain .. this is not a good idea but i haven't a better one.
  can a network guru fix that ?

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
  • Loading branch information...
1 parent 6329553 commit 9902f24c13aaab88ed06ecaf8575173cfc15c51f Marc Chantreux committed with Galen Charlton Jan 8, 2009
Showing with 13 additions and 7 deletions.
  1. +13 −7 rewrite-config.PL
View
@@ -60,15 +60,21 @@ also need to override WEBSERVER_IP.
=cut
-$myhost = hostname();
-$mydomain = $myhost;
-$mydomain =~ s/^.*?\.//;
-# This is set here to rescue systems with broken DNS
-if ( !gethostbyname( $myhost || 'localhost' ) ) {
- die 'Could not get the IP address of ' . ( $myhost || 'localhost' ) . ', DNS fault?';
+if ( $myhost = $ENV{WEBSERVER_HOST} || hostname ) {
+ ( $mydomain = $myhost ) =~ s/.*?\.//;
+} else {
+ $myhost = 'localhost';
+ $mydomain = 'localdomain';
}
-$myip = $ENV{'WEBSERVER_IP'} || inet_ntoa( scalar gethostbyname( $myhost||'localhost' ) );
+unless ( $myip = $ENV{WEBSERVER_IP} ) {
+ my $byname = gethostbyname( $myhost )
+ or die "Could not get the IP address of $myhost, DNS fault? ($!)";
+ $myip = inet_ntoa $byname
+ or die "can't inet_ntoa ($!)";
+}
+
+
$prefix = $ENV{'INSTALL_BASE'} || "/usr";
# These are our configuration guesses

0 comments on commit 9902f24

Please sign in to comment.