View previous topic :: View next topic |
Author |
Message |
Mongoose5 n00b
Joined: 29 Jan 2003 Posts: 71
|
Posted: Tue May 06, 2003 2:53 pm Post subject: Domainname not set, Why? Should it be? |
|
|
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 |
|
|
pjp Administrator
Joined: 16 Apr 2002 Posts: 20067
|
Posted: Tue May 06, 2003 2:57 pm Post subject: |
|
|
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 |
|
|
Genone Retired Dev
Joined: 14 Mar 2003 Posts: 9538 Location: beyond the rim
|
Posted: Tue May 06, 2003 6:05 pm Post subject: |
|
|
Maybe this thread is interesting to you. |
|
Back to top |
|
|
Mongoose5 n00b
Joined: 29 Jan 2003 Posts: 71
|
Posted: Tue May 06, 2003 6:09 pm Post subject: |
|
|
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 |
|
|
|