[image]Update arch-build-opennebula-image.sh for Task#9418

This commit is contained in:
kjg 2021-09-28 10:36:52 +02:00
parent cf2f84de79
commit 11415886bb

View file

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
# This script generates Debian images for OpenNebula. # This script generates arch linux images for OpenNebula.
# #
# Test image locally (without network) with: # Test image locally (without network) with:
# qemu-system-x86_64 -enable-kvm -m 1G -drive file=$IMAGE,format=qcow2 # qemu-system-x86_64 -enable-kvm -m 1G -drive file=$IMAGE,format=qcow2
@ -13,7 +13,7 @@ IMAGE_PATH=arch-$(date --iso-8601).img.qcow2
IMAGE_SIZE=10G IMAGE_SIZE=10G
NBD_DEVICE=/dev/nbd0 NBD_DEVICE=/dev/nbd0
ONE_CONTEXT_VERSION=5.12.0.2 ONE_CONTEXT_VERSION=6.0.0
ONE_CONTEXT_SOURCE_ARCHIVE="https://github.com/OpenNebula/addon-context-linux/archive/v$ONE_CONTEXT_VERSION.tar.gz" ONE_CONTEXT_SOURCE_ARCHIVE="https://github.com/OpenNebula/addon-context-linux/archive/v$ONE_CONTEXT_VERSION.tar.gz"
cleanup() { cleanup() {
@ -108,37 +108,44 @@ Server = http://mirror.puzzle.ch/archlinux/\$repo/os/\$arch
Server = https://mirror.puzzle.ch/archlinux/\$repo/os/\$arch Server = https://mirror.puzzle.ch/archlinux/\$repo/os/\$arch
Server = https://mirror.ungleich.ch/mirror/packages/archlinux/\$repo/os/\$arch Server = https://mirror.ungleich.ch/mirror/packages/archlinux/\$repo/os/\$arch
EOF EOF
run_root pacman --sync --refresh --upgrade run_root pacman -Syu
#run_root pacman --sync --refresh --upgrade
# 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.
run_root pacman --sync curl tar run_root pacman -Sy curl tar rsync --noconfirm
run_root curl -L "$ONE_CONTEXT_SOURCE_ARCHIVE" -o one-context.tar.gz run_root curl -L "$ONE_CONTEXT_SOURCE_ARCHIVE" -o one-context.tar.gz
run_root tar xf one-context.tar.gz run_root tar xf one-context.tar.gz
run_root cp -rT addon-context-linux-${ONE_CONTEXT_VERSION}/src/ / run_root rsync -avrh addon-context-linux-${ONE_CONTEXT_VERSION}/src/* /
#run_root cp -rT addon-context-linux-${ONE_CONTEXT_VERSION}/src/ /
run_root rm -r addon-context-linux-${ONE_CONTEXT_VERSION} run_root rm -r addon-context-linux-${ONE_CONTEXT_VERSION}
run_root systemctl enable one-context.service run_root cp -r /usr/lib/systemd/system/one-context.service##arch.one /usr/lib/systemd/system/one-context.service
#run_root systemctl enable one-context.service
# Initalize base services. # Initalize base services.
run_root systemd-machine-id-setup run_root systemd-machine-id-setup
run_root ln -sf /usr/share/zoneinfo/UTC /etc/localtime run_root ln -sf /usr/share/zoneinfo/UTC /etc/localtime
run_root systemctl enable systemd-timesyncd.service run_root systemctl enable systemd-timesyncd.service
#run_root pacman -Q linux
# Install kernel and generate initramfs. # Install kernel and generate initramfs.
run_root pacman --sync linux mkinitcpio run_root pacman -Sy linux
run_rot mkinitcpio -P run_root rsync -avrh /usr/lib/modules/ /lib/modules
#run_root pacman -Sy linux
run_root pacman -Sy mkinitcpio
#run_root pacman -S linux
run_root mkinitcpio -P
# Install and configure bootloader. # Install and configure bootloader.
run_root pacman --sync grub run_root pacman -Sy grub --noconfirm
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
# Install en configure SSH daemon. # Install en configure SSH daemon.
run_root pacman --sync openssh-server run_root pacman -Sy openssh --noconfirm
# Install haveged due to lack of entropy in ONE environment. # Install haveged due to lack of entropy in ONE environment.
run_root pacman --sync haveged run_root pacman -Sy haveged
run_root systemctl enable haveged.service run_root systemctl enable haveged.service
# Generate fstab file. # Generate fstab file.
@ -155,4 +162,4 @@ run_root touch /etc/machine-id
rm -f /var/lib/systemd/random-seed rm -f /var/lib/systemd/random-seed
# Make sure everything is written to disk before exiting. # Make sure everything is written to disk before exiting.
sync sync