lh_chroot_hostname changes my hostname back and forth
- Subject: lh_chroot_hostname changes my hostname back and forth
- From: jpryzby+ckwpdl at quoininc.com (Justin Pryzby)
- Date: Wed, 1 Aug 2007 12:18:32 -0400
- Message-id: <20070801161828.GA9841@quoininc.com>
I'm really confused by this. First, why is it necessary to set the
hostname (within the chroot, I guess with the unfortunate but
[perhaps?] unavoidable consequence that it affects outside the chroot
Second, why isn't it clear why the hostname shouldn't be changed back?
Otherwise everyone's machine gets renamed localhost.localdomain.
if [ -f chroot/etc/hostname ]
# Save hostname file
mv chroot/etc/hostname chroot/etc/hostname.orig
# Create hostname file
echo "localhost.localdomain" > chroot/etc/hostname
# Set hostname
Chroot "hostname -F /etc/hostname"
# Set hostname (somehow this seems to be really needed :/)
if [ -f /etc/hostname ]
hostname -F /etc/hostname