Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
did something miraculously retarded [solved]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
teh minkeh
n00b
n00b


Joined: 19 Apr 2005
Posts: 42

PostPosted: Thu May 12, 2005 10:30 pm    Post subject: did something miraculously retarded [solved] Reply with quote

i accidently deleted my hostname init script.... is there any way i can restore it? ps: i am running AMD64

Last edited by teh minkeh on Fri May 13, 2005 2:55 am; edited 1 time in total
Back to top
View user's profile Send private message
Jake
Veteran
Veteran


Joined: 31 Jul 2003
Posts: 1132

PostPosted: Thu May 12, 2005 10:40 pm    Post subject: Reply with quote

Code:
#!/sbin/runscript
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-src/rc-scripts/init.d/hostname,v 1.22.4.1 2005/01/30 21:23:10 vapier Exp $

depend() {
        need checkroot
}

start() {
        local myhost=$(/bin/hostname 2>/dev/null)
        local retval=0

        # If the hostname is already set via the kernel, and /etc/hostname
        # isn't setup, then we shouldn't go reseting the configuration #38172.
        if [[ -z ${myhost} ]] || [[ ${myhost} == "(none)" ]] ; then
                myhost="localhost"
        fi

        if [[ -f /etc/hostname ]] ; then
                ewarn "You should stop using /etc/hostname and use /etc/conf.d/hostname"
                myhost=$(</etc/hostname)
        else
                myhost=${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, ignore errors in case /etc is readonly.
                echo "HOSTNAME=\"${myhost}\"" 2>/dev/null > /etc/env.d/01hostname
        fi

        return ${retval}
}

# vim:ts=4
Back to top
View user's profile Send private message
teh minkeh
n00b
n00b


Joined: 19 Apr 2005
Posts: 42

PostPosted: Thu May 12, 2005 11:07 pm    Post subject: Reply with quote

that doesnt seem to be working... as syslog-ng and anacron are still crying about hostname missing...
Back to top
View user's profile Send private message
codergeek42
Bodhisattva
Bodhisattva


Joined: 05 Apr 2004
Posts: 5142
Location: Anaheim, CA (USA)

PostPosted: Thu May 12, 2005 11:14 pm    Post subject: Reply with quote

Try adding
Code:
provide hostname
to the depend() function of the hostname initscript.
_________________
~~ Peter: Programmer, Mathematician, STEM & Free Software Advocate, Enlightened Agent, Transhumanist, Fedora contributor
Who am I? :: EFF & FSF
Back to top
View user's profile Send private message
teh minkeh
n00b
n00b


Joined: 19 Apr 2005
Posts: 42

PostPosted: Fri May 13, 2005 2:29 am    Post subject: Reply with quote

didn't work.... is there a package i can emerge that will rebuild hostname?
Back to top
View user's profile Send private message
codergeek42
Bodhisattva
Bodhisattva


Joined: 05 Apr 2004
Posts: 5142
Location: Anaheim, CA (USA)

PostPosted: Fri May 13, 2005 2:35 am    Post subject: Reply with quote

teh minkeh wrote:
didn't work.... is there a package i can emerge that will rebuild hostname?
gentoolkit says it's part of baselayout:
Quote:
$ equery belongs /etc/init.d/hostname
[ Searching for file(s) /etc/init.d/hostname in *... ]
sys-apps/baselayout-1.11.11-r3 (/etc/init.d/hostname)

_________________
~~ Peter: Programmer, Mathematician, STEM & Free Software Advocate, Enlightened Agent, Transhumanist, Fedora contributor
Who am I? :: EFF & FSF


Last edited by codergeek42 on Fri May 13, 2005 2:57 am; edited 1 time in total
Back to top
View user's profile Send private message
teh minkeh
n00b
n00b


Joined: 19 Apr 2005
Posts: 42

PostPosted: Fri May 13, 2005 2:55 am    Post subject: Reply with quote

i had to delete the replacement hostname init script i had made and then emerge that package... thank you for the help :D :D :D
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security 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