Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Domainname not set, Why? Should it be?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Duplicate Threads
View previous topic :: View next topic  
Author Message
Mongoose5
n00b
n00b


Joined: 29 Jan 2003
Posts: 71

PostPosted: Tue May 06, 2003 2:53 pm    Post subject: Domainname not set, Why? Should it be? Reply with quote

Just out of curiousity, but why is the domainname not set like the hostname is? For example the /etc/hostname file contains the hostname + domainname ( mybox.mydomain ), but yet this file is only used for setting the hostname. ( ie /etc/init.d/hostname ) There is no domainname. But the gentoo /etc/issue file clearly wants to use the domainname when I log in. Unless I manaully set the domainname I get mybox.(none).

Should there be either a set domainname startup script? or maybe modify the hostname script to include domain name. some line to the effect of

Code:
mydomain="$(awk '{ sub(/[^\.]*./, ""); print }' /etc/hostname)"


could be added.

Here is my current /etc/init.d/hostname for setting the domainname too:

Code:
#!/sbin/runscript
# Copyright 1999-2003 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# $Header: /home/cvsroot/gentoo-src/rc-scripts/init.d/hostname,v 1.15 2003/04/27 18:39:59 azarah Exp $
                                                                                                                                                             
# This only set what /bin/hostname returns.  If you need to setup NIS, meaning
# what /bin/domainname returns, please see:
#
#   http://www.linux-nis.org/nis-howto/HOWTO/
#
# To have a proper FQDN, you need to setup /etc/hosts and /etc/resolv.conf
# properly (domain entry in /etc/resolv.conf, and FQDN in /etc/hosts).
                                                                                                                                                             
                                                                                                                                                             
depend() {
        need checkroot
}
                                                                                                                                                             
checkconfig() {
        if [ ! -f /etc/hostname ] || [ -z "$(< /etc/hostname)" ]
        then
                eerror "You need to set /etc/hostname to a valid hostname"
                return 1
        fi
}
                                                                                                                                                             
start() {
        local myhost="localhost"
        local mydomain="localdomain"
        local retval=0
                                                                                                                                                             
        if checkconfig
        then
                myhost="$(awk '{ sub(/\..*/, ""); print }' /etc/hostname)"
                mydomain="$(awk '{ sub(/[^\.]*./, ""); print }' /etc/hostname)"
        fi
                                                                                                                                                             
        ebegin "Setting hostname to ${myhost}"
        /bin/hostname "${myhost}"
        retval=$?
        eend ${retval} "Failed to set the hostname"
                                                                                                                                                             
        if [ "${retval}" -eq 0 ]
        then
                # setup $HOSTNAME
                echo "HOSTNAME=\"${myhost}\"" >/etc/env.d/01hostname
        fi
                                                                                                                                                             
        if [ "${retval}" -ne 0 ]
        then
                return ${retval}
        fi
                                                                                                                                                             
        ebegin "Setting domainname to ${mydomain}"
        /bin/domainname "${mydomain}"
        retval=$?
        eend ${retval} "Failed to set the domainname"
       
        if [ "${retval}" -eq 0 ]
        then
                # setup $DOMAINNAME
                echo "DOMAINNAME=\"${mydomain}\"" >/etc/env.d/02domainname
        fi
                                                                                                                                                             
                                                                                                                                                             
        return ${retval}
}
                                                                                                                                                                                                                                                                                                                           
# vim:ts=4
Back to top
View user's profile Send private message
pjp
Administrator
Administrator


Joined: 16 Apr 2002
Posts: 20067

PostPosted: Tue May 06, 2003 2:57 pm    Post subject: Reply with quote

Interesting. I've not had any problems with issue (or anything else) looking for a domainname other than /etc/hostname.


Moved from Portage & Programming.
_________________
Quis separabit? Quo animo?
Back to top
View user's profile Send private message
Genone
Retired Dev
Retired Dev


Joined: 14 Mar 2003
Posts: 9538
Location: beyond the rim

PostPosted: Tue May 06, 2003 6:05 pm    Post subject: Reply with quote

Maybe this thread is interesting to you.
Back to top
View user's profile Send private message
Mongoose5
n00b
n00b


Joined: 29 Jan 2003
Posts: 71

PostPosted: Tue May 06, 2003 6:09 pm    Post subject: Reply with quote

I saw that after I had posted this, but I still feel that the domainname should be addressed. Especially if files ( like /etc/issue ) are going to use the domainname to populate dynamically the login screen. I was actually suprised by that thread that less was done other say how to set the domainname.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Duplicate Threads All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum