4 Summary: Deployment image for ironic python agent
6 License: %{_platform_licence}
7 Source0: %{name}-%{version}.tar.gz
8 Vendor: %{_platform_vendor}
10 BuildRequires: qemu-img-ev which sudo PyYAML e2fsprogs genisoimage wget kernel python2-ironic-python-agent python-ironic-lib python-devel xz python-pip gdisk dosfstools util-linux
12 BuildRequires: syslinux
15 %define dib_selinuxfile elements/rpm-distro/cleanup.d/99-selinux-fixfiles-restore
16 %define dib_epel elements/epel/pre-install.d/05-rpm-epel-release
18 %define centos_cloudimg https://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud-1801-01.qcow2
19 %define centos_mirror http://mirror.centos.org/centos/7
21 %define centos_cloudimg https://cloud.centos.org/altarch/7/images/aarch64/CentOS-7-aarch64-GenericCloud-1708.qcow2.xz
22 %define centos_cloudimg_xz 1
23 %define centos_mirror http://mirror.centos.org/altarch/7
24 %define dib_block_device_efi 1
26 %define centos_efibootimg %{centos_mirror}/os/%{_arch}/images/efiboot.img
27 %define centos_efidir %{centos_mirror}/os/%{_arch}/EFI
30 Deployment image for ironic python agent image
36 sudo pip install diskimage-builder==2.26.1
37 sudo rm -rf %{python2_sitelib}/diskimage_builder/%{dib_selinuxfile} %{_datarootdir}ยง/diskimage-builder/%{dib_selinuxfile} %{python2_sitelib}/diskimage_builder/elements/epel/pre-install.d/05-rpm-epel-release
38 cp /etc/yum.conf work/local.repo
39 wget --progress=dot:giga %{centos_cloudimg} -O CentOS.qcow2%{?centos_cloudimg_xz:.xz}
40 %if 0%{?centos_cloudimg_xz:1}
44 wget --progress=dot:giga %{centos_efibootimg} -O efiboot.img
45 cut_dirs=$(echo $url | sed -re 's|.*://[^/]+/(.+)|\1|' -e 's|/$||' | grep -o / | wc -l)
46 wget -N -r --no-host-directories --no-verbose --cut-dirs=${cut_dirs} --reject index.html* --no-parent $url
48 ELEMENTS_PATH="${PWD}/work/dib-ipa-element/" \
49 DIB_LOCAL_IMAGE="file://${PWD}/CentOS.qcow2" \
50 DIB_YUM_REPO_CONF="work/local.repo" \
51 DIB_LOCAL_REPO="/usr/localrepo/" \
52 break=after-error /usr/bin/disk-image-create --install-type package localrepo centos7 virtmedia-netconf ironic-agent %{?dib_block_device_efi:block-device-efi}
54 if [[ $? == 0 ]]; then
55 work/iso-image-create -o ./ironic-deploy.iso -i ./image.initramfs -k ./image.vmlinuz -e ./efiboot.img -E ./EFI
57 echo "Failed to run disk-image-create"
61 mkdir -p %{buildroot}/opt/images/
62 rsync -av ironic-deploy.iso %{buildroot}/opt/images/
65 %defattr(0755,root,root)