[ubuntu] update to 24.04 LTS, update context, minor changes
This commit is contained in:
parent
435164e1c9
commit
56a37d608e
1 changed files with 6 additions and 9 deletions
|
@ -9,14 +9,13 @@ set -e
|
||||||
set -x
|
set -x
|
||||||
|
|
||||||
# XXX: Handle command-line arguments?
|
# XXX: Handle command-line arguments?
|
||||||
RELEASE=focal # 20.04
|
RELEASE=noble # 24.04 LTS
|
||||||
ARCH=amd64
|
ARCH=amd64
|
||||||
IMAGE_PATH=ubuntu-$RELEASE-$(date --iso-8601).img.qcow2
|
IMAGE_PATH=ubuntu-$RELEASE-$(date --iso-8601).img.qcow2
|
||||||
IMAGE_SIZE=10G
|
IMAGE_SIZE=10G
|
||||||
NBD_DEVICE=/dev/nbd0
|
NBD_DEVICE=/dev/nbd2
|
||||||
|
|
||||||
# TODO: find the package definition and built ourself, publish in some RPM repository.
|
ONE_CONTEXT_DEB_URL="https://github.com/OpenNebula/one-apps/releases/download/v6.8.1/one-context_6.8.1-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"
|
|
||||||
ONE_CONTEXT_DEB_PATH=/root/one-context.deb
|
ONE_CONTEXT_DEB_PATH=/root/one-context.deb
|
||||||
|
|
||||||
cleanup() {
|
cleanup() {
|
||||||
|
@ -70,7 +69,6 @@ mkfs.ext4 "${NBD_DEVICE}p1"
|
||||||
mkfs.ext4 "${NBD_DEVICE}p2"
|
mkfs.ext4 "${NBD_DEVICE}p2"
|
||||||
|
|
||||||
# Mount partitions, install base OS.
|
# Mount partitions, install base OS.
|
||||||
|
|
||||||
mount "${NBD_DEVICE}p2" /mnt
|
mount "${NBD_DEVICE}p2" /mnt
|
||||||
mkdir /mnt/boot
|
mkdir /mnt/boot
|
||||||
mount "${NBD_DEVICE}p1" /mnt/boot
|
mount "${NBD_DEVICE}p1" /mnt/boot
|
||||||
|
@ -89,9 +87,6 @@ mount --bind /sys /mnt/sys
|
||||||
# Guest networking is to be handled by the one-context package.
|
# Guest networking is to be handled by the one-context package.
|
||||||
# See https://github.com/OpenNebula/addon-context-linux for details.
|
# See https://github.com/OpenNebula/addon-context-linux for details.
|
||||||
|
|
||||||
# Required to resolve package mirror in chroot.
|
|
||||||
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 localhost localhost.localdomain localhost4 localhost4.localdomain4
|
||||||
|
@ -123,10 +118,11 @@ run_root ln -sf /usr/share/zoneinfo/UTC /etc/localtime
|
||||||
run_root systemctl enable systemd-timesyncd.service
|
run_root systemctl enable systemd-timesyncd.service
|
||||||
|
|
||||||
# Install kernel and bootloader. Do not autoconfigure grub.
|
# Install kernel and bootloader. Do not autoconfigure grub.
|
||||||
run_root echo "grub-pc grub-pc/install_devices_empty boolean true" | debconf-set-selections
|
run_root "echo 'grub-pc grub-pc/install_devices_empty boolean true' | debconf-set-selections"
|
||||||
run_root DEBIAN_FRONTEND=noninteractive apt-get -y install locales linux-base linux-image-generic grub-pc
|
run_root DEBIAN_FRONTEND=noninteractive apt-get -y install locales linux-base linux-image-generic grub-pc
|
||||||
|
|
||||||
# Configure grub.
|
# Configure grub.
|
||||||
|
echo "GRUB_DISABLE_OS_PROBER=true" >> /mnt/etc/default/grub
|
||||||
run_root grub-install --target=i386-pc "${NBD_DEVICE}"
|
run_root grub-install --target=i386-pc "${NBD_DEVICE}"
|
||||||
run_root grub-mkconfig -o /boot/grub/grub.cfg
|
run_root grub-mkconfig -o /boot/grub/grub.cfg
|
||||||
|
|
||||||
|
@ -145,6 +141,7 @@ EOF
|
||||||
run_root rm -f /etc/machine-id
|
run_root rm -f /etc/machine-id
|
||||||
run_root touch /etc/machine-id
|
run_root touch /etc/machine-id
|
||||||
rm -f /var/lib/systemd/random-seed
|
rm -f /var/lib/systemd/random-seed
|
||||||
|
echo "ubuntu" > /mnt/etc/hostname
|
||||||
|
|
||||||
# Remove temporary files and reclaim freed disk space.
|
# Remove temporary files and reclaim freed disk space.
|
||||||
run_root apt-get clean
|
run_root apt-get clean
|
||||||
|
|
Loading…
Reference in a new issue