blob: 15846d33f1ecb6ff1f3fc9d7c8ef206a015e608b [file] [log] [blame]
#!/bin/bash
set -ex
URL=https://download.fedoraproject.org/pub/fedora/linux/releases/38/Cloud/x86_64/images/Fedora-Cloud-Base-38-1.6.x86_64.raw.xz
UNCOMPRESSED_ORIGINAL=$(basename -s .xz ${URL})
IMAGE=f38.raw
if [[ ! -f ${UNCOMPRESSED_ORIGINAL} ]]; then
wget ${URL}
unxz $(basename ${URL})
fi
rm -f ${IMAGE}
truncate -s +1G -r ${UNCOMPRESSED_ORIGINAL} ${IMAGE}
virt-resize --expand /dev/sda5 ${UNCOMPRESSED_ORIGINAL} ${IMAGE}
cat > cloud-init-default-user.cfg <<EOF
system_info:
default_user:
name: ci
EOF
virt-customize -a ${IMAGE} \
--update \
--install cloud-init,qemu-guest-agent,cloud-utils-growpart,bash,coreutils,procps-ng,systemd,sudo,dnf,rsync,python3-libselinux,openssh-server,hostname,iproute,jq,cmake,git,gcc-c++,make,ninja-build,tree,flex,bison,pcre-devel,libev-devel,libcmocka-devel,libssh-devel,openssl-devel,systemd-devel,gdb,strace,swig,c-ares-devel,autoconf,automake,libtool,libasan,liblsan,libtsan,libubsan,clang,libcxx-devel,libcxx-static,clang-analyzer,git-clang-format,llvm,doxygen,patch,wget,bzip2,bc,unzip,zip,perl-ExtUtils-MakeMaker,python3-devel,python3-pytest,gcovr,lcov,zstd,expat-devel,clang-tools-extra,spdlog-devel,boost-devel,python3-pybind11,npm,hugo,pcre2-devel,pam-devel,openssl-perl,json-devel,libnl3-devel,libxml2-devel,date-devel,libdate-tz \
--edit '/etc/sysconfig/selinux:s/SELINUX=.*/SELINUX=disabled/' \
--selinux-relabel \
--root-password disabled \
--copy-in $(pwd)/cloud-init-default-user.cfg:/etc/cloud/cloud.cfg.d/ \
--run-command 'dnf debuginfo-install -y glibc libgcc gcc libstdc++' \
--run-command 'systemctl enable cloud-init' \
--run-command 'update-crypto-policies --set DEFAULT:FEDORA32' \
--run-command 'git config --system protocol.file.allow always'