avoid some dumb resolv.conf parsing

This commit is contained in:
sthen 2009-10-10 10:48:49 +00:00
parent 913891b223
commit c3b845152c
2 changed files with 31 additions and 14 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.7 2009/08/07 19:43:36 naddy Exp $
# $OpenBSD: Makefile,v 1.8 2009/10/10 10:48:49 sthen Exp $
COMMENT-main = little brother's database, email address query tools
COMMENT-ldap = LDAP support for little brother's database
@ -7,8 +7,8 @@ VERSION = 0.36
DISTNAME = lbdb_${VERSION}
# bump all subpackages together
PKGNAME-main = lbdb-${VERSION}p3
PKGNAME-ldap = lbdb-ldap-${VERSION}p3
PKGNAME-main = lbdb-${VERSION}p4
PKGNAME-ldap = lbdb-ldap-${VERSION}p4
CATEGORIES = databases mail

View File

@ -1,12 +1,29 @@
$OpenBSD: patch-lbdb_lib_sh_in,v 1.1.1.1 2008/06/15 07:22:57 sthen Exp $
--- lbdb_lib.sh.in.orig Tue Mar 11 22:51:11 2008
+++ lbdb_lib.sh.in Tue Mar 11 22:51:37 2008
@@ -67,7 +67,7 @@ lbdb_hostname()
if test "x$hn" = "x" ; then
hn=`lbdb_hn_sendmail`
if test "x$hn" = "xNONE" ; then
$OpenBSD: patch-lbdb_lib_sh_in,v 1.2 2009/10/10 10:48:49 sthen Exp $
--- lbdb_lib.sh.in.orig Sun Aug 13 10:53:21 2006
+++ lbdb_lib.sh.in Sat Oct 10 03:10:21 2009
@@ -57,24 +57,7 @@ lbdb_hostname()
elif test -f /etc/mailname; then
hn=`cat /etc/mailname`
else
- hn=""
- if test -r /etc/resolv.conf ; then
- hn="`sed -n -e 's/^[ ]*domain[ ]\{1,\}\([^ ]*\)/\1/p' /etc/resolv.conf`"
- if test "x$hn" = "x" ; then
- hn="`sed -n -e 's/^[ ]*search[ ]\{1,\}\([^ ]*\)/\1/p' /etc/resolv.conf`"
- fi
- fi
- if test "x$hn" = "x" ; then
- hn=`lbdb_hn_sendmail`
- if test "x$hn" = "xNONE" ; then
- for i in /etc/HOSTNAME /etc/hostname ; do
+ for i in /etc/myname /etc/HOSTNAME /etc/hostname ; do
if test -f $i ; then
hn="`cat $i`"
break;
- if test -f $i ; then
- hn="`cat $i`"
- break;
- fi
- done
- fi
- fi
+ hn=`hostname`
fi
echo "$hn"
}