[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: How to get the hostname in stage2 ?
- From: David Cantrell <dcantrell redhat com>
- To: Discussion of Development and Customization of the Red Hat Linux Installer <anaconda-devel-list redhat com>
- Subject: Re: How to get the hostname in stage2 ?
- Date: Wed, 21 Jan 2009 07:50:36 -1000
Jesse Keating wrote:
> On Wed, 2009-01-21 at 13:35 +0200, Alexander Todorov wrote:
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA512
>>
>> Hello,
>> in a %post I need the hostname of the machine being installed. hostname and
>> python's os.uname() report localhost.localdomain while anaconda displays the
>> hostname that comes from the DHCP server in the GUI. How do I get the value
>> which comes from DHCP? Is it stored somewhere or my only possibility is to parse
>> /etc/sysconfig/network ?
>>
>
> Are you calling your post code from within the chroot, or outside of the
> chroot? Inside the chroot at post-install time I don't believe the
> hostname or resolver has been setup, but outside the chroot it has.
sethostname() is called from loader if you do a network boot method and
we have to set up networking in loader. If you bring up networking only
for package installation, we don't specifically call sethostname(). I
needed to do a sethostname() call in loader to preserve one particular
install case that I can't remember right now. What would be nice is to
have NetworkManager setting the hostname for us if it can.
In %post, you can read the system config files to pick out the hostname.
--
David Cantrell <dcantrell redhat com>
Red Hat / Honolulu, HI
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]