Debian ONE image: set hostname

This commit is contained in:
fnux 2020-05-24 08:26:18 +02:00
parent e0ac893ae6
commit 3f9245d582

View file

@ -14,6 +14,7 @@ ARCH=amd64
IMAGE_PATH=debian-$RELEASE-$(date --iso-8601).img.qcow2 IMAGE_PATH=debian-$RELEASE-$(date --iso-8601).img.qcow2
IMAGE_SIZE=10G IMAGE_SIZE=10G
NBD_DEVICE=/dev/nbd0 NBD_DEVICE=/dev/nbd0
HOSTNAME=debian
# TODO: find the package definition and built ourself, publish in some RPM repository. # TODO: find the package definition and built ourself, publish in some RPM repository.
ONE_CONTEXT_DEB_URL="https://github.com/OpenNebula/addon-context-linux/releases/download/v5.10.0/one-context_5.10.0-1.deb" ONE_CONTEXT_DEB_URL="https://github.com/OpenNebula/addon-context-linux/releases/download/v5.10.0/one-context_5.10.0-1.deb"
@ -94,11 +95,13 @@ cp /etc/resolv.conf /mnt/etc/resolv.conf
# Initialize /etc/hosts. # Initialize /etc/hosts.
cat > /mnt/etc/hosts << EOF cat > /mnt/etc/hosts << EOF
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 127.0.0.1 $HOSTNAME localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 ::1 $HOSTNAME localhost localhost.localdomain localhost6 localhost6.localdomain6
EOF EOF
run_root hostnamectl set-hostname $HOSTNAME
# Configure package sources and update package index. # Configure package sources and update package index.
cat >/mnt/etc/apt/sources.list <<EOF cat >/mnt/etc/apt/sources.list <<EOF
# Stable # Stable