From 888f4203f5a228005a15b70f962b7e7f16de9ad3 Mon Sep 17 00:00:00 2001
From: Joey Hess <joey@kodama.kitenet.net>
Date: Thu, 21 Aug 2008 22:48:07 -0400
Subject: [PATCH] Avoid using hostname -f for portability to eg, OS X, use
 Net::Domain instead, and prompt if it fails.

---
 auto.setup       | 10 ++++++----
 debian/changelog |  2 ++
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/auto.setup b/auto.setup
index 3b8d92365..47d0d868f 100644
--- a/auto.setup
+++ b/auto.setup
@@ -18,7 +18,9 @@ our $rcs=IkiWiki::Setup::Automator::ask(
 	"What revision control system to use?", "git");
 our $admin=IkiWiki::Setup::Automator::ask(
 	"What wiki user (or openid) will be wiki admin?", $ENV{USER});
-our $hostname=`hostname -f`; chomp $hostname;
+use Net::Domain q{hostfqdn};
+our $domain=hostfqdn() || ikiwiki::setup::automator::ask(
+	"What is the domain name of the web server?", "");
 
 IkiWiki::Setup::Automator->import(
 	wikiname => $wikiname,
@@ -28,10 +30,10 @@ IkiWiki::Setup::Automator->import(
 	destdir => "$ENV{HOME}/public_html/$wikiname",
 	repository => "$ENV{HOME}/$wikiname.$rcs",
 	dumpsetup => "$ENV{HOME}/$wikiname.setup",
-	url => "http://$hostname/~$ENV{USER}/$wikiname",
-	cgiurl => "http://$hostname/~$ENV{USER}/$wikiname/ikiwiki.cgi",
+	url => "http://$domain/~$ENV{USER}/$wikiname",
+	cgiurl => "http://$domain/~$ENV{USER}/$wikiname/ikiwiki.cgi",
 	cgi_wrapper => "$ENV{HOME}/public_html/$wikiname/ikiwiki.cgi",
-	adminemail => "$ENV{USER}\@$hostname",
+	adminemail => "$ENV{USER}\@$domain",
 	add_plugins => [qw{goodstuff websetup}],
 	disable_plugins => [qw{}],
 	libdir => "$ENV{HOME}/.ikiwiki",
diff --git a/debian/changelog b/debian/changelog
index e8dfdb7f6..813cf9523 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,8 @@ ikiwiki (2.62) UNRELEASED; urgency=low
 
   * Avoid using cp -a (again). (HenrikBrixAndersen)
   * Add missing PREFIX to a few lines of the Makefile. (Thomas Keller)
+  * Avoid using hostname -f for portability to eg, OS X, use Net::Domain
+    instead, and prompt if it fails.
 
  -- Joey Hess <joeyh@debian.org>  Thu, 21 Aug 2008 16:20:58 -0400
 
-- 
2.39.5