From fd850475ea000656baa1da23844373d84a04f044 Mon Sep 17 00:00:00 2001 From: Xinliang Liu Date: Wed, 19 Aug 2020 10:14:27 +0000 Subject: [PATCH] Make iscsi-boot element support centos 8 This patch makes iscsi-boot element support not only just DISTRO_NAME centos7 but also centos and centos-minimal. Change-Id: I8db8b01f35b2e572666badd8d2316d24a5e4287a --- diskimage_builder/elements/iscsi-boot/README.rst | 4 ++-- .../elements/iscsi-boot/environment.d/open-iscsi-config | 2 +- .../iscsi-boot/extra-data.d/50-check-dracut-regenerate | 2 +- .../elements/iscsi-boot/finalise.d/51-open-iscsi-config | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/diskimage_builder/elements/iscsi-boot/README.rst b/diskimage_builder/elements/iscsi-boot/README.rst index fa867a05c..d35f30d2a 100644 --- a/diskimage_builder/elements/iscsi-boot/README.rst +++ b/diskimage_builder/elements/iscsi-boot/README.rst @@ -3,7 +3,7 @@ iscsi-boot ========== Handles configuration for the disk to be capable of serving as a remote root filesystem through iSCSI. Currently, this element -can configure Ubuntu/Debian images and CentOS7 images. +can configure Ubuntu/Debian images and CentOS images. It performs the following actions: @@ -13,7 +13,7 @@ For Ubuntu/Debian images: ``ISCSI_AUTO=true`` within it. * Updates the initramfs to apply the changes. -For CentOS7 images: +For CentOS images: * Required ``dracut-regenerate`` element when performs ``disk-image-create``. * Updates ``network`` and ``iscsi`` into ``dracut-regenerate`` during pre-installs. diff --git a/diskimage_builder/elements/iscsi-boot/environment.d/open-iscsi-config b/diskimage_builder/elements/iscsi-boot/environment.d/open-iscsi-config index 3036fd8e7..1bb19d5f4 100644 --- a/diskimage_builder/elements/iscsi-boot/environment.d/open-iscsi-config +++ b/diskimage_builder/elements/iscsi-boot/environment.d/open-iscsi-config @@ -1,4 +1,4 @@ -if [[ $DISTRO_NAME = "centos7" ]]; then +if [[ $DISTRO_NAME =~ "centos" ]]; then DIB_DRACUT_ENABLED_MODULES+=" - name: network diff --git a/diskimage_builder/elements/iscsi-boot/extra-data.d/50-check-dracut-regenerate b/diskimage_builder/elements/iscsi-boot/extra-data.d/50-check-dracut-regenerate index 4b7c76452..1846a7bb5 100755 --- a/diskimage_builder/elements/iscsi-boot/extra-data.d/50-check-dracut-regenerate +++ b/diskimage_builder/elements/iscsi-boot/extra-data.d/50-check-dracut-regenerate @@ -6,7 +6,7 @@ fi set -eu set -o pipefail -if [[ $DISTRO_NAME = "centos7" ]]; then +if [[ $DISTRO_NAME =~ "centos" ]]; then eval declare -A image_elements=($(get_image_element_array)) if [[ ! "${image_elements[@]}" =~ "dracut-regenerate" ]]; then echo "The dracut-regenerate element is required!" diff --git a/diskimage_builder/elements/iscsi-boot/finalise.d/51-open-iscsi-config b/diskimage_builder/elements/iscsi-boot/finalise.d/51-open-iscsi-config index 239dc407a..440f31792 100755 --- a/diskimage_builder/elements/iscsi-boot/finalise.d/51-open-iscsi-config +++ b/diskimage_builder/elements/iscsi-boot/finalise.d/51-open-iscsi-config @@ -7,7 +7,7 @@ fi set -eu set -o pipefail -if [[ $DISTRO_NAME = "centos7" ]]; then +if [[ $DISTRO_NAME =~ "centos" ]]; then sed -i -E 's/(GRUB_CMDLINE_LINUX_DEFAULT=")(.+)(")/\1\2 rd.iscsi.firmware=1"/' /etc/default/grub grub2-mkconfig -o /boot/grub2/grub.cfg fi