about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/PublicInbox/ExtSearchIdx.pm6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/PublicInbox/ExtSearchIdx.pm b/lib/PublicInbox/ExtSearchIdx.pm
index c6fb398b..b82d0546 100644
--- a/lib/PublicInbox/ExtSearchIdx.pm
+++ b/lib/PublicInbox/ExtSearchIdx.pm
@@ -530,8 +530,10 @@ sub host_ident () {
         state $retval = hostname . '-' . do {
                 my $m; # machine-id(5) is systemd
                 if (open(my $fh, '<', '/etc/machine-id')) { $m = <$fh> }
-                # hostid(1) is in GNU coreutils, kern.hostid is FreeBSD
-                chomp($m ||= `hostid` || `sysctl -n kern.hostid`);
+                # (g)hostid(1) is in GNU coreutils, kern.hostid is most BSDs
+                chomp($m ||= `{ sysctl -n kern.hostid ||
+                                hostid || ghostid; } 2>/dev/null`
+                        || "no-machine-id-or-hostid-on-$^O");
                 $m;
         };
 }