On Wed, Oct 13, 2010 at 11:37:47AM -0400, Joey Hess wrote:
> Vaclav Ovsik wrote:
> > Hi,
> > some servers can have DNS domain (or its part) in hostname. I have this
> > on servers despite it is not recommended to distinguish servers with the
> > same name, but different domain name in prompt (PS1 redefined with \H).
> > 
> > Instead of composing hostname the FQDN can be retrieved from hostname
> > command:
> > 
> > diff --git a/etckeeper/commit.d/50vcs-commit 
> > b/etckeeper/commit.d/50vcs-commit
> > index 959babb..340f32b 100755
> > --- a/etckeeper/commit.d/50vcs-commit
> > +++ b/etckeeper/commit.d/50vcs-commit
> > @@ -21,11 +21,7 @@ else
> >     logfile=""
> >  fi
> >  
> > -hostname=`hostname`
> > -dnsdomainname=`dnsdomainname 2>/dev/null || true`
> > -if [ -n "$dnsdomainname" ]; then
> > -   hostname="$hostname.$dnsdomainname"
> > -fi
> > +hostname=`hostname -f`
> 
> That's what I used to have, but hostname -f does something horrible on
> Solaris.

Then

diff --git a/etckeeper/commit.d/50vcs-commit b/etckeeper/commit.d/50vcs-commit
index 959babb..c52da87 100755
--- a/etckeeper/commit.d/50vcs-commit
+++ b/etckeeper/commit.d/50vcs-commit
@@ -21,7 +21,7 @@ else
        logfile=""
 fi
 
-hostname=`hostname`
+hostname=`hostname|sed 's/\..*//;'`
 dnsdomainname=`dnsdomainname 2>/dev/null || true`
 if [ -n "$dnsdomainname" ]; then
        hostname="$hostname.$dnsdomainname"

will probably work everywhere.

Best Regards
-- 
Zito



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to