Ubuntu image: use configurable APT mirror, fix -y flag for rdnssd,

output name
This commit is contained in:
fnux 2020-01-22 17:24:47 +01:00
parent 88d5cd424f
commit 6ce12bbdda

View file

@ -11,9 +11,10 @@ set -x
# XXX: Handle command-line arguments?
RELEASE=eoan # 19.10
ARCH=amd64
IMAGE_PATH=ubuntu-$RELEASE-$(date --iso-8601).img.qcow2
IMAGE_PATH=ubuntu-uncloud-$RELEASE-$(date --iso-8601).img.qcow2
IMAGE_SIZE=10G
NBD_DEVICE=/dev/nbd0
APT_MIRROR=http://archive.ubuntu.com/ubuntu/
cleanup() {
# The order here is important.
@ -73,7 +74,7 @@ mount "${NBD_DEVICE}p1" /mnt/boot
debootstrap \
--arch=$ARCH $RELEASE \
/mnt http://archive.ubuntu.com/ubuntu/
/mnt "$APT_MIRROR"
mount --bind /dev /mnt/dev
mount --bind /dev/pts /mnt/dev/pts
@ -94,15 +95,15 @@ EOF
# Configure package sources and update package index.
cat >/mnt/etc/apt/sources.list <<EOF
deb http://archive.ubuntu.com/ubuntu/ $RELEASE main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ $RELEASE-security main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ $RELEASE-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ $RELEASE-backports main restricted universe multiverse
deb $APT_MIRROR $RELEASE main restricted universe multiverse
deb $APT_MIRROR $RELEASE-security main restricted universe multiverse
deb $APT_MIRROR $RELEASE-updates main restricted universe multiverse
deb $APT_MIRROR $RELEASE-backports main restricted universe multiverse
EOF
run_root apt-get update
# Install RDNSSD for DNS discovery from router advertisement. The service is enabled by default.
run_root apt-get install rdnssd
run_root apt-get install -y rdnssd
# Initialize base services.
run_root systemd-machine-id-setup