From 97e4627d876b12921cd1246cc93decf5a5565927 Mon Sep 17 00:00:00 2001 From: Matthew Thode Date: Fri, 21 Aug 2020 19:29:21 -0500 Subject: [PATCH] update various gentoo bits Update an rc-update call to only be made if running openrc instead of all gentoo profiles (systemd does not have rc-update). Add python3-pyyaml package mappings. Update serial console to support multiple arches. Update open-iscsi and open-isns keywords (looks like upstream merged some musl fixes). Update the kernel and initramfs file name globs for the gentoo-kernel-bin usage. Change-Id: I259bffed3a3e3f92be2210ead6bdfa383917d457 Signed-off-by: Matthew Thode --- .../cloud-init/post-install.d/20-enable-cloud-init | 2 +- diskimage_builder/elements/dracut-regenerate/pkg-map | 3 ++- .../elements/enable-serial-console/install.d/20-stty | 12 ++++++++++++ .../elements/gentoo/pre-install.d/02-gentoo-02-flags | 6 ++++-- diskimage_builder/elements/svc-map/pkg-map | 12 ++++++++---- diskimage_builder/lib/img-functions | 4 ++-- 6 files changed, 29 insertions(+), 10 deletions(-) diff --git a/diskimage_builder/elements/cloud-init/post-install.d/20-enable-cloud-init b/diskimage_builder/elements/cloud-init/post-install.d/20-enable-cloud-init index 36be728a..bdf5e208 100755 --- a/diskimage_builder/elements/cloud-init/post-install.d/20-enable-cloud-init +++ b/diskimage_builder/elements/cloud-init/post-install.d/20-enable-cloud-init @@ -7,7 +7,7 @@ set -eu set -o pipefail # gentoo -if [[ "${DISTRO_NAME}" == "gentoo" ]]; then +if [[ "${DIB_INIT_SYSTEM}" == "openrc" ]]; then rc-update add cloud-config default rc-update add cloud-final default rc-update add cloud-init-local boot diff --git a/diskimage_builder/elements/dracut-regenerate/pkg-map b/diskimage_builder/elements/dracut-regenerate/pkg-map index 2249c257..42164d4f 100644 --- a/diskimage_builder/elements/dracut-regenerate/pkg-map +++ b/diskimage_builder/elements/dracut-regenerate/pkg-map @@ -1,7 +1,8 @@ { "family": { "gentoo": { - "PyYAML": "dev-python/pyyaml" + "PyYAML": "dev-python/pyyaml", + "python3-PyYAML": "dev-python/pyyaml" }, "suse": { "PyYAML": "python-PyYAML", diff --git a/diskimage_builder/elements/enable-serial-console/install.d/20-stty b/diskimage_builder/elements/enable-serial-console/install.d/20-stty index 5322dac0..aee7f164 100755 --- a/diskimage_builder/elements/enable-serial-console/install.d/20-stty +++ b/diskimage_builder/elements/enable-serial-console/install.d/20-stty @@ -14,4 +14,16 @@ elif [ "$DIB_INIT_SYSTEM" == "systemd" ]; then install -D -g root -o root -m 0644 ${SCRIPTDIR}/serial-console-udev.rules /etc/udev/rules.d/99-serial-console.rules elif [ "$DIB_INIT_SYSTEM" == "openrc" ]; then sed -r 's/^#(.*ttyS[0,1].*$)/\1/' -i /etc/inittab + echo '# diskimage-builder serial console' >> /etc/inittab + echo -n 's0:12345:respawn:/sbin/agetty -L 115200 ' >> /etc/inittab + if [[ -n "${DIB_BOOTLOADER_SERIAL_CONSOLE}" ]]; then + echo -n "${DIB_BOOTLOADER_SERIAL_CONSOLE}" >> /etc/inittab + elif [[ "powerpc ppc64 ppc64le" =~ ${ARCH} ]]; then + echo -n "hvc0" >> /etc/inittab + elif [[ "arm64" =~ ${ARCH} ]]; then + echo -n "ttyAMA0" >> /etc/inittab + else + echo -n "ttyS0" >> /etc/inittab + fi + echo ' vt100' >> /etc/inittab fi diff --git a/diskimage_builder/elements/gentoo/pre-install.d/02-gentoo-02-flags b/diskimage_builder/elements/gentoo/pre-install.d/02-gentoo-02-flags index fe2a7633..a9ef809f 100755 --- a/diskimage_builder/elements/gentoo/pre-install.d/02-gentoo-02-flags +++ b/diskimage_builder/elements/gentoo/pre-install.d/02-gentoo-02-flags @@ -29,7 +29,9 @@ if [[ 'arm64' == "${ARCH}" ]]; then echo 'sys-kernel/gentoo-kernel-bin ~arm64' > # musl only valid for amd64 for now if [[ "${GENTOO_PROFILE}" == *"musl"* ]]; then echo "dev-vcs/git -gpg" >> /etc/portage/package.use/musl # gpg doesn't build on musl profiles - echo "~sys-block/open-iscsi-2.0.878 ~amd64" >> /etc/portage/package.accept_keywords/musl - echo "=sys-block/open-isns-0.97 ~amd64" >> /etc/portage/package.accept_keywords/musl echo "sys-libs/pam cracklib" >> /etc/portage/package.use/musl + if [[ 'x86_64' == "${ARCH}" ]]; then echo "~sys-block/open-iscsi-2.1.1 ~amd64" >> /etc/portage/package.accept_keywords/musl; fi + if [[ 'x86_64' == "${ARCH}" ]]; then echo "~sys-block/open-isns-0.100 ~amd64" >> /etc/portage/package.accept_keywords/musl; fi + if [[ 'arm64' == "${ARCH}" ]]; then echo "~sys-block/open-iscsi-2.1.1 ~arm64" >> /etc/portage/package.accept_keywords/musl; fi + if [[ 'arm64' == "${ARCH}" ]]; then echo "~sys-block/open-isns-0.100 ~arm64" >> /etc/portage/package.accept_keywords/musl; fi fi diff --git a/diskimage_builder/elements/svc-map/pkg-map b/diskimage_builder/elements/svc-map/pkg-map index e5fb5bd1..392f5954 100644 --- a/diskimage_builder/elements/svc-map/pkg-map +++ b/diskimage_builder/elements/svc-map/pkg-map @@ -1,13 +1,17 @@ { "family": { - "redhat": { - "PyYAML": "PyYAML", - "python3-PyYAML": "python3-pyyaml" - }, "debian": { "PyYAML": "python-yaml", "python3-PyYAML": "python3-yaml" }, + "gentoo": { + "PyYAML": "dev-python/pyyaml", + "python3-PyYAML": "dev-python/pyyaml" + }, + "redhat": { + "PyYAML": "PyYAML", + "python3-PyYAML": "python3-pyyaml" + }, "suse": { "PyYAML": "python-PyYAML" } diff --git a/diskimage_builder/lib/img-functions b/diskimage_builder/lib/img-functions index fa75d7c9..1181bd79 100644 --- a/diskimage_builder/lib/img-functions +++ b/diskimage_builder/lib/img-functions @@ -214,8 +214,8 @@ function select_boot_kernel_initrd () { KERNEL=$(basename $(readlink -e $BOOTDIR/vmlinuz)) RAMDISK=$(basename $(readlink -e $BOOTDIR/initrd)) elif [[ -f "${TARGET_ROOT}"/etc/gentoo-release ]]; then - KERNEL="$(basename $(ls -1rv $BOOTDIR/kernel-*-openstack | head -n 1))" - RAMDISK="$(basename $(ls -1rv $BOOTDIR/initramfs-*-openstack | head -n 1))" + KERNEL="$(basename $(ls -1rv $BOOTDIR/vmlinuz-* | head -n 1))" + RAMDISK="$(basename $(ls -1rv $BOOTDIR/initramfs-* | head -n 1))" else echo "ERROR: Unable to detect operating system" exit 1