View previous topic :: View next topic |
Author |
Message |
teh minkeh n00b

Joined: 19 Apr 2005 Posts: 42
|
Posted: Thu May 12, 2005 10:30 pm Post subject: did something miraculously retarded [solved] |
|
|
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 |
|
 |
Jake Veteran

Joined: 31 Jul 2003 Posts: 1132
|
Posted: Thu May 12, 2005 10:40 pm Post subject: |
|
|
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 |
|
 |
teh minkeh n00b

Joined: 19 Apr 2005 Posts: 42
|
Posted: Thu May 12, 2005 11:07 pm Post subject: |
|
|
that doesnt seem to be working... as syslog-ng and anacron are still crying about hostname missing... |
|
Back to top |
|
 |
codergeek42 Bodhisattva

Joined: 05 Apr 2004 Posts: 5142 Location: Anaheim, CA (USA)
|
Posted: Thu May 12, 2005 11:14 pm Post subject: |
|
|
Try adding 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 |
|
 |
teh minkeh n00b

Joined: 19 Apr 2005 Posts: 42
|
Posted: Fri May 13, 2005 2:29 am Post subject: |
|
|
didn't work.... is there a package i can emerge that will rebuild hostname? |
|
Back to top |
|
 |
codergeek42 Bodhisattva

Joined: 05 Apr 2004 Posts: 5142 Location: Anaheim, CA (USA)
|
Posted: Fri May 13, 2005 2:35 am Post subject: |
|
|
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 |
|
 |
teh minkeh n00b

Joined: 19 Apr 2005 Posts: 42
|
Posted: Fri May 13, 2005 2:55 am Post subject: |
|
|
i had to delete the replacement hostname init script i had made and then emerge that package... thank you for the help  |
|
Back to top |
|
 |
|