Fix "(None)" seed hostname on Debian

The cloud-init package on Debian Linux overwrites the system
hostname to "(None)" unless a hostname is specified in one
of the /etc/cloud/cloud.cfg.d/* files. This change applies
a default hostname of "debian" using cloud-init.

Change-Id: I9b411df44cfa05f899e708900f95719c0bcd6267
This commit is contained in:
Jonathan Brownell 2014-02-28 15:43:42 -08:00 committed by Cloud Admin
parent e5afa4d6f9
commit 5af25b5f46

View File

@ -58,6 +58,10 @@ LABEL=cloudimg-rootfs / ext4 errors=remount-ro 0 1
' > ${TARGET_ROOT}/etc/fstab" ' > ${TARGET_ROOT}/etc/fstab"
sudo sh -c "echo 'blacklist pcspkr' > ${TARGET_ROOT}/etc/modprobe.d/blacklist.conf" sudo sh -c "echo 'blacklist pcspkr' > ${TARGET_ROOT}/etc/modprobe.d/blacklist.conf"
sudo sh -c "echo 'debian' > ${TARGET_ROOT}/etc/hostname" sudo sh -c "echo 'debian' > ${TARGET_ROOT}/etc/hostname"
# specify a hostname so that cloud-init does not default to (None)
echo "hostname: debian" > ${TARGET_ROOT}/etc/cloud/cloud.cfg.d/01_hostname.cfg
echo Caching debootstrap result in $DEBOOTSTRAP_TARBALL echo Caching debootstrap result in $DEBOOTSTRAP_TARBALL
sudo tar -C $TARGET_ROOT -zcf $DEBOOTSTRAP_TARBALL . sudo tar -C $TARGET_ROOT -zcf $DEBOOTSTRAP_TARBALL .
fi fi