Accepting request 1247691 from Virtualization:Appliances:Images:openSUSE-Tumbleweed

OBS-URL: https://build.opensuse.org/request/show/1247691
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/kiwi-templates-Minimal?expand=0&rev=27
This commit is contained in:
Dominique Leuenberger 2025-02-21 20:35:47 +00:00 committed by Git OBS Bridge
commit 749a3ff437
4 changed files with 73 additions and 62 deletions

@ -28,7 +28,6 @@
format="qcow2"
firmware="uefi"
efipartsize="33"
kernelcmdline="rw security=selinux selinux=1 quiet systemd.show_status=1 console=ttyS0,115200 console=tty0"
bootpartition="false"
bootkernel="custom"
devicepersistency="by-uuid"
@ -132,7 +131,6 @@
format="qcow2"
firmware="uefi"
efipartsize="33"
kernelcmdline="rw security=selinux selinux=1 quiet systemd.show_status=1 console=ttyS0,115200 console=tty0"
bootpartition="false"
bootkernel="custom"
devicepersistency="by-uuid"
@ -165,7 +163,6 @@
format="vmdk"
firmware="uefi"
efipartsize="33"
kernelcmdline="rw security=selinux selinux=1 quiet systemd.show_status=1 console=ttyS0,115200 console=tty0"
bootpartition="false"
bootkernel="custom"
devicepersistency="by-uuid"
@ -202,7 +199,6 @@
format="qcow2"
firmware="uefi"
efipartsize="33"
kernelcmdline="rw security=selinux selinux=1 quiet systemd.show_status=1 console=ttyS0,115200 console=tty0 net.ifnames=0"
bootpartition="false"
bootkernel="custom"
devicepersistency="by-uuid"
@ -224,7 +220,6 @@
format="vhdx"
firmware="uefi"
efipartsize="33"
kernelcmdline="rw security=selinux selinux=1 quiet systemd.show_status=1 rootdelay=300 console=ttyS0,115200 console=tty0 earlyprintk=ttyS0,115200"
bootpartition="false"
bootkernel="custom"
devicepersistency="by-uuid"
@ -258,7 +253,6 @@
format="vhdx"
firmware="uefi"
efipartsize="33"
kernelcmdline="rw security=selinux selinux=1 quiet systemd.show_status=1 rootdelay=300 console=ttyS0,115200 console=tty0 earlyprintk=ttyS0,115200"
bootpartition="false"
bootkernel="custom"
devicepersistency="by-uuid"
@ -292,7 +286,6 @@
filesystem="btrfs"
fsmountoptions="noatime,compress=lzo"
firmware="efi"
kernelcmdline="rw security=selinux selinux=1 quiet systemd.show_status=1 console=ttyS0,115200 console=tty"
bootpartition="false"
devicepersistency="by-uuid"
btrfs_quota_groups="true"

@ -1,5 +1,5 @@
#!/bin/bash
# Copyright (c) 2021 SUSE LLC
# Copyright (c) 2025 SUSE LLC
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -76,7 +76,7 @@ systemctl mask systemd-firstboot.service
systemctl enable jeos-firstboot.service
# Enable firewalld if installed except on VMware
if [ -x /usr/sbin/firewalld ] && [ "$kiwi_profiles" != "VMware" ]; then
if [ -x /usr/sbin/firewalld ] && [ "$kiwi_profiles" != "VMware" ]; then
systemctl enable firewalld.service
fi
@ -88,7 +88,7 @@ fi
#======================================
# Add repos from control.xml
#--------------------------------------
if grep -q opensuse /usr/lib/os-release; then
if rpm -q live-add-yast-repos; then
add-yast-repos
zypper --non-interactive rm -u live-add-yast-repos
fi
@ -96,18 +96,18 @@ fi
#=====================================
# Configure snapper
#-------------------------------------
if [ "${kiwi_btrfs_root_is_snapshot-false}" = 'true' ]; then
echo "creating initial snapper config ..."
# we can't call snapper here as the .snapshots subvolume
# already exists and snapper create-config doesn't like
# that.
cp /etc/snapper/config-templates/default /etc/snapper/configs/root \
|| cp /usr/share/snapper/config-templates/default /etc/snapper/configs/root
# Change configuration to match SLES12-SP1 values
sed -i -e '/^TIMELINE_CREATE=/s/yes/no/' /etc/snapper/configs/root
sed -i -e '/^NUMBER_LIMIT=/s/50/10/' /etc/snapper/configs/root
if [ -x /usr/bin/snapper ]; then
echo "creating initial snapper config ..."
# we can't call snapper here as the .snapshots subvolume
# already exists and snapper create-config doesn't like
# that.
cp /etc/snapper/config-templates/default /etc/snapper/configs/root \
|| cp /usr/share/snapper/config-templates/default /etc/snapper/configs/root
# Change configuration to match SLES12-SP1 values
sed -i -e '/^TIMELINE_CREATE=/s/yes/no/' /etc/snapper/configs/root
sed -i -e '/^NUMBER_LIMIT=/s/50/10/' /etc/snapper/configs/root
baseUpdateSysConfig /etc/sysconfig/snapper SNAPPER_CONFIGS root
baseUpdateSysConfig /etc/sysconfig/snapper SNAPPER_CONFIGS root
fi
#=====================================
@ -117,14 +117,36 @@ if [ -f /etc/chrony.conf ]; then
systemctl enable chronyd
fi
#======================================
# Add default kernel boot options
#--------------------------------------
cmdline=('rw' 'quiet' 'systemd.show_status=1' 'console=ttyS0,115200' 'console=tty0')
case "${kiwi_profiles}" in
*Cloud*) cmdline+=('net.ifnames=0') ;;
*HyperV*) cmdline+=('earlyprintk=ttyS0,115200' 'rootdelay=300') ;;
esac
# Configure SELinux if installed
# Note: Because of https://github.com/OSInside/kiwi/issues/2709, the root filesystem
# isn't fully labelled, but the first system snapshot is created after autorelabel
# so this is never visible.
if [[ -e /etc/selinux/config ]]; then
sed -i -e 's|^SELINUX=.*|SELINUX=enforcing|g' \
-e 's|^SELINUXTYPE=.*|SELINUXTYPE=targeted|g' \
"/etc/selinux/config"
cmdline+=('security=selinux' 'selinux=1')
sed -i -e 's|^SELINUX=.*|SELINUX=enforcing|g' \
-e 's|^SELINUXTYPE=.*|SELINUXTYPE=targeted|g' \
"/etc/selinux/config"
fi
if rpm -q sdbootutil; then
mkdir -p /etc/kernel
echo "${cmdline[*]}" > /etc/kernel/cmdline
elif [ -e /etc/default/grub ]; then
sed -i "s#^GRUB_CMDLINE_LINUX_DEFAULT=.*\$#GRUB_CMDLINE_LINUX_DEFAULT=\"${cmdline[*]}\"#" /etc/default/grub
else
echo "Unknown bootloader"
exit 1
fi
#======================================
@ -140,19 +162,9 @@ sed -i 's/.*rpm.install.excludedocs.*/rpm.install.excludedocs = yes/g' /etc/zypp
#======================================
# Configure FDE/BLS specifics
#--------------------------------------
# [[ "$kiwi_profiles" == *"kvm-and-xen-"* ]]
if rpm -q sdbootutil; then
for d in /usr/lib/modules/*; do
test -d "$d" || continue
depmod -a "${d##*/}"
done
ENTRY_TOKEN=$(. /usr/lib/os-release; echo $ID)
mkdir -p /etc/kernel
echo "$ENTRY_TOKEN" > /etc/kernel/entry-token
# FIXME: kiwi needs /boot/efi to exist before syncing the disk image
mkdir -p /boot/efi
echo "rw security=selinux selinux=1 quiet systemd.show_status=1 console=ttyS0,115200 console=tty0" > /etc/kernel/cmdline
# FIXME: kiwi needs /boot/efi to exist before syncing the disk image
mkdir -p /boot/efi
[ -e /var/lib/YaST2/reconfig_system ] && systemctl enable sdbootutil-enroll.service
fi

51
disk.sh

@ -1,37 +1,36 @@
#!/bin/bash
set -euxo pipefail
[ -x /usr/bin/sdbootutil ] || exit 0
echo "####### BOOTLOADER INSTALL (disk.sh)"
# [[ "$kiwi_profiles" == *"kvm-and-xen-"* ]]
if rpm -q sdbootutil; then
arch="$(uname -m)"
case "$arch" in
aarch64) arch=aa64 ;;
x86_64) arch=x64 ;;
*) echo "Unknown arch $arch"; exit 1 ;;
esac
if [ -x /usr/bin/sdbootutil ]; then
arch="$(uname -m)"
case "$arch" in
aarch64) arch=aa64 ;;
x86_64) arch=x64 ;;
*) echo "Unknown arch $arch"; exit 1 ;;
esac
echo "install boot loader"
loader_type="grub2-bls"
rpm -q systemd-boot && loader_type="systemd-boot"
if [ -f /etc/sysconfig/bootloader ]; then
sed -i "s/^LOADER_TYPE=.*$/LOADER_TYPE=\"$loader_type\"/g" /etc/sysconfig/bootloader
else
echo "LOADER_TYPE=\"${loader_type}\"" > /etc/sysconfig/bootloader
fi
sdbootutil -v --no-random-seed --arch "$arch" --esp-path /boot/efi --entry-token=auto --no-variables install
echo "install boot loader"
loader_type="grub2-bls"
rpm -q systemd-boot && loader_type="systemd-boot"
if [ -f /etc/sysconfig/bootloader ]; then
sed -i "s/^LOADER_TYPE=.*$/LOADER_TYPE=\"$loader_type\"/g" /etc/sysconfig/bootloader
else
echo "LOADER_TYPE=\"${loader_type}\"" > /etc/sysconfig/bootloader
fi
echo "add kernels"
export hostonly_l=no # for dracut
sdbootutil -v --arch "$arch" --esp-path /boot/efi --entry-token=auto add-all-kernels
# Set a 5s timeout, the "hold a key down" method doesn't work effectively.
echo "timeout 5" >> /boot/efi/loader/loader.conf
sdbootutil -v --no-random-seed --arch "$arch" --esp-path /boot/efi --entry-token=auto --no-variables install
rm -f /boot/mbrid
echo "add kernels"
export hostonly_l=no # for dracut
sdbootutil -v --arch "$arch" --esp-path /boot/efi --entry-token=auto add-all-kernels
# Set a 5s timeout, the "hold a key down" method doesn't work effectively.
echo "timeout 5" >> /boot/efi/loader/loader.conf
find /boot
rm -f /boot/mbrid
find /boot
fi
echo "####### ENDS BOOTLOADER INSTALLER (disk.sh)"
echo "####### END BOOTLOADER INSTALL (disk.sh)"

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Fri Feb 21 10:30:41 UTC 2025 - Fabian Vogt <fvogt@suse.com>
- Clean up config.sh and disk.sh
- Move kernelcmdline from .kiwi to config.sh
- Fix snapper config adjustment (boo#1237466)
-------------------------------------------------------------------
Thu Jan 16 09:37:46 UTC 2025 - Fabian Vogt <fvogt@suse.com>