lh_chroot_hostname changes my hostname back and forth
On Thu, Aug 02, 2007 at 09:11:20AM +0200, Daniel Baumann wrote:
> Justin Pryzby wrote:
> > First, why is it necessary to set the hostname
>
> otherwise some stupid maintainerscripts of packages do fail, e.g. ssmtp
> in etch.
I couldn't confirm this problem. I copied ssmtp/stable deb to
chroot_local-packages/ (since the image is for unstable) and started
lh_build (after calling lh_config with configuration in the
environment). I did: "hostname -F /etc/hostname" (from the
host/building system) after dh_build started and set the hostname to
localhost. ssmtp maintscripts all seem to have run okay.
> > Second, why isn't it clear why the hostname shouldn't be changed back?
>
> it is clear, and it is also set back as you quoted:
I was talking about the preceding comment:
# Set hostname (somehow this seems to be really needed :/)
> > if [ -f /etc/hostname ]
> > then
> > hostname -F /etc/hostname
> > fi
Perhaps this comment should be associated with the first hostname -F
call ("install") and not the 2nd ("remove")?
> I know that it's shitty, to have the hostname changed while live-helper
> is running. Do you have a better idea to work arround those stupid
> maintainerscripts?
The only thing that occurs to me is to export LD_PRELOAD some
/usr/lib/live-helper/hostname.so to override uname() to access
chroot/etc/hostname instead of querying the kernel. Since it's
exported, then it should apply to subprocesses of dpkg; in particular
the shell that runs the maintscripts.
Justin
Reply to: