github.com/containers/libpod@v1.9.4-0.20220419124438-4284fd425507/contrib/cirrus/packer/image-builder-image_base-setup.sh (about) 1 #!/bin/bash 2 3 # This script is called by packer on a vanilla CentOS VM, to setup the image 4 # used for building images FROM base images. It's not intended to be used 5 # outside of this context. 6 7 set -e 8 9 [[ "$1" == "post" ]] || exit 0 # pre stage not needed 10 11 # Load in library (copied by packer, before this script was run) 12 source $GOSRC/$SCRIPT_BASE/lib.sh 13 14 req_env_var TIMESTAMP GOSRC SCRIPT_BASE PACKER_BASE 15 16 install_ooe 17 18 echo "Updating packages" 19 ooe.sh sudo yum -y update 20 21 echo "Configuring repositories" 22 ooe.sh sudo yum -y install centos-release-scl epel-release 23 24 echo "Installing packages" 25 ooe.sh sudo yum -y install \ 26 genisoimage \ 27 golang \ 28 google-cloud-sdk \ 29 libvirt \ 30 libvirt-admin \ 31 libvirt-client \ 32 libvirt-daemon \ 33 make \ 34 python36 \ 35 python36-PyYAML \ 36 qemu-img \ 37 qemu-kvm \ 38 qemu-kvm-tools \ 39 qemu-user \ 40 rsync \ 41 rng-tools \ 42 unzip \ 43 util-linux \ 44 vim 45 46 sudo systemctl enable rngd 47 48 sudo ln -s /usr/libexec/qemu-kvm /usr/bin/ 49 50 sudo tee /etc/modprobe.d/kvm-nested.conf <<EOF 51 options kvm-intel nested=1 52 options kvm-intel enable_shadow_vmcs=1 53 options kvm-intel enable_apicv=1 54 options kvm-intel ept=1 55 EOF 56 57 echo "Installing packer" 58 sudo mkdir -p /root/$(basename $PACKER_BASE) 59 sudo cp $GOSRC/$PACKER_BASE/*packer* /root/$(basename $PACKER_BASE) 60 sudo mkdir -p /root/$(basename $SCRIPT_BASE) 61 sudo cp $GOSRC/$SCRIPT_BASE/*.sh /root/$(basename $SCRIPT_BASE) 62 63 install_scl_git 64 65 echo "Cleaning up" 66 cd / 67 rm -rf $GOSRC 68 69 rh_finalize 70 71 echo "SUCCESS!"