update version to 9.24.1

This commit is contained in:
markeryang 2023-07-20 16:17:08 +08:00
parent fc9b3db52e
commit d240c55ad0
12 changed files with 468 additions and 1129 deletions

View File

@ -1,55 +0,0 @@
From 2d6867c20825c2f021e91365fd6ed4b1ad5db813 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marcus=20Sch=C3=A4fer?= <ms@suse.de>
Date: Mon, 16 Nov 2020 16:37:58 +0100
Subject: [PATCH] Added microdnf support in XML schema
The XML schema did not allow to specify microdnf as
supported package manager
---
kiwi/schema/kiwi.rnc | 2 +-
kiwi/schema/kiwi.rng | 1 +
kiwi/xml_parse.py | 1 +
3 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/kiwi/schema/kiwi.rnc b/kiwi/schema/kiwi.rnc
index 2e296fe..03bfffe 100644
--- a/kiwi/schema/kiwi.rnc
+++ b/kiwi/schema/kiwi.rnc
@@ -793,7 +793,7 @@ div {
#
div {
k.packagemanager.content =
- "apt-get" | "zypper" | "yum" | "dnf" | "pacman"
+ "apt-get" | "zypper" | "yum" | "dnf" | "microdnf" | "pacman"
k.packagemanager.attlist = empty
k.packagemanager =
## Name of the Package Manager
diff --git a/kiwi/schema/kiwi.rng b/kiwi/schema/kiwi.rng
index daaca9e..11a83aa 100644
--- a/kiwi/schema/kiwi.rng
+++ b/kiwi/schema/kiwi.rng
@@ -1228,6 +1228,7 @@ the device is looked up in /dev/disk/by-* and /dev/mapper/*</a:documentation>
<value>zypper</value>
<value>yum</value>
<value>dnf</value>
+ <value>microdnf</value>
<value>pacman</value>
</choice>
</define>
diff --git a/kiwi/xml_parse.py b/kiwi/xml_parse.py
index d5677a5..43ccc0d 100644
--- a/kiwi/xml_parse.py
+++ b/kiwi/xml_parse.py
@@ -730,6 +730,7 @@ class k_packagemanager_content(object):
ZYPPER='zypper'
YUM='yum'
DNF='dnf'
+ MICRODNF='microdnf'
PACMAN='pacman'
--
2.33.0

View File

@ -1,163 +0,0 @@
From 863722fb63f4af7256f7a4d879933b79febf386d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marcus=20Sch=C3=A4fer?= <ms@suse.de>
Date: Wed, 19 Aug 2020 09:25:13 +0200
Subject: [PATCH] Added s390 SLE15 integration tests
---
.../sle15/test-image-vmx-oem/appliance.kiwi | 84 +++++++++++++++++++
.../s390/sle15/test-image-vmx-oem/config.sh | 42 ++++++++++
helper/build_status.sh | 1 +
3 files changed, 127 insertions(+)
create mode 100644 build-tests/s390/sle15/test-image-vmx-oem/appliance.kiwi
create mode 100644 build-tests/s390/sle15/test-image-vmx-oem/config.sh
diff --git a/build-tests/s390/sle15/test-image-vmx-oem/appliance.kiwi b/build-tests/s390/sle15/test-image-vmx-oem/appliance.kiwi
new file mode 100644
index 0000000000..cdc859f387
--- /dev/null
+++ b/build-tests/s390/sle15/test-image-vmx-oem/appliance.kiwi
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!-- OBS-Profiles: @BUILD_FLAVOR@ -->
+
+<image schemaversion="7.2" name="SLE15">
+ <description type="system">
+ <author>Marcus Schäfer</author>
+ <contact>ms@suse.com</contact>
+ <specification>Virtual and Physical disk image test</specification>
+ </description>
+ <profiles>
+ <profile name="Virtual" description="Image for use with kvm"/>
+ <profile name="PhysicalBSZ_4096" description="Image for physical 4k storage disk CDL mode"/>
+ </profiles>
+ <preferences>
+ <version>1.15.1</version>
+ <packagemanager>zypper</packagemanager>
+ <locale>en_US</locale>
+ <keytable>us</keytable>
+ <timezone>Europe/Berlin</timezone>
+ <rpm-excludedocs>true</rpm-excludedocs>
+ <rpm-check-signatures>false</rpm-check-signatures>
+ </preferences>
+ <preferences profiles="Virtual">
+ <type image="vmx" filesystem="xfs" kernelcmdline="console=ttyS0 cio_ignore=all,!ipldev,!condev" format="qcow2">
+ <bootloader name="grub2_s390x_emu" console="serial" targettype="FBA"/>
+ </type>
+ </preferences>
+ <preferences profiles="PhysicalBSZ_4096">
+ <type image="oem" filesystem="ext4" initrd_system="dracut" kernelcmdline="console=ttyS0 cio_ignore=all,!ipldev,!condev" target_blocksize="4096">
+ <bootloader name="grub2_s390x_emu" console="serial" targettype="CDL"/>
+ <systemdisk>
+ <volume name="home"/>
+ </systemdisk>
+ <oemconfig>
+ <oem-swap>true</oem-swap>
+ <oem-swapsize>4096</oem-swapsize>
+ </oemconfig>
+ </type>
+ </preferences>
+ <users>
+ <user password="$1$wYJUgpM5$RXMMeASDc035eX.NbYWFl0" home="/root" name="root" groups="root"/>
+ </users>
+ <repository type="rpm-md">
+ <source path="obsrepositories:/"/>
+ </repository>
+ <packages type="image">
+ <package name="patterns-base-minimal_base"/>
+ <package name="kernel-default"/>
+ <package name="iputils"/>
+ <package name="iproute2"/>
+ <package name="vim"/>
+ <package name="s390-tools"/>
+ <package name="grub2-s390x-emu"/>
+ <package name="grub2"/>
+ <package name="lvm2"/>
+ <package name="tar"/>
+ <package name="parted"/>
+ <package name="systemd"/>
+ <package name="dracut"/>
+ <package name="wicked"/>
+ <package name="openssh"/>
+ <package name="rsync"/>
+ <package name="psmisc"/>
+ <package name="sudo"/>
+ <package name="dhcp-client"/>
+ <package name="which"/>
+ <package name="btrfsprogs"/>
+ <package name="kexec-tools"/>
+ <package name="less"/>
+ <package name="patch"/>
+ <package name="util-linux"/>
+ <package name="timezone"/>
+ <package name="dracut-kiwi-oem-repart"/>
+ </packages>
+ <packages type="bootstrap">
+ <package name="udev"/>
+ <package name="filesystem"/>
+ <package name="glibc-locale"/>
+ <package name="cracklib-dict-full"/>
+ <package name="ca-certificates"/>
+ <package name="sles-release"/>
+ </packages>
+</image>
diff --git a/build-tests/s390/sle15/test-image-vmx-oem/config.sh b/build-tests/s390/sle15/test-image-vmx-oem/config.sh
new file mode 100644
index 0000000000..3f41e7cf8e
--- /dev/null
+++ b/build-tests/s390/sle15/test-image-vmx-oem/config.sh
@@ -0,0 +1,42 @@
+#!/bin/bash
+#================
+# FILE : config.sh
+#----------------
+# PROJECT : OpenSuSE KIWI Image System
+# COPYRIGHT : (c) 2006 SUSE LINUX Products GmbH. All rights reserved
+# :
+# AUTHOR : Marcus Schaefer <ms@suse.de>
+# :
+# BELONGS TO : Operating System images
+# :
+# DESCRIPTION : configuration script for SUSE based
+# : operating systems
+# :
+# :
+# STATUS : BETA
+#----------------
+#======================================
+# Functions...
+#--------------------------------------
+test -f /.kconfig && . /.kconfig
+test -f /.profile && . /.profile
+
+#======================================
+# Greeting...
+#--------------------------------------
+echo "Configure image: [$kiwi_iname]..."
+
+#======================================
+# Setup baseproduct link
+#--------------------------------------
+suseSetupProduct
+
+#======================================
+# Activate services
+#--------------------------------------
+suseInsertService sshd
+
+#======================================
+# Setup default target, multi-user
+#--------------------------------------
+baseSetRunlevel 3
diff --git a/helper/build_status.sh b/helper/build_status.sh
index b8fe0ea8da..09af11c964 100755
--- a/helper/build_status.sh
+++ b/helper/build_status.sh
@@ -9,6 +9,7 @@ for project in \
Virtualization:Appliances:Images:Testing_x86:fedora \
Virtualization:Appliances:Images:Testing_x86:ubuntu \
Virtualization:Appliances:Images:Testing_s390:suse \
+ Virtualization:Appliances:Images:Testing_s390:sle15 \
Virtualization:Appliances:Images:Testing_arm:suse \
Virtualization:Appliances:Images:Testing_arm:fedora \
Virtualization:Appliances:Images:Testing_ppc:suse \

View File

@ -1,21 +0,0 @@
From 0d473758bc13a622b9b0aa57c7474fea4de5574d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marcus=20Sch=C3=A4fer?= <ms@suse.de>
Date: Sun, 8 Nov 2020 20:43:35 +0100
Subject: [PATCH] Added universal box to build status helper
---
helper/build_status.sh | 1 +
1 file changed, 1 insertion(+)
diff --git a/helper/build_status.sh b/helper/build_status.sh
index c740700076..177aaf34fa 100755
--- a/helper/build_status.sh
+++ b/helper/build_status.sh
@@ -4,6 +4,7 @@ for project in \
Virtualization:Appliances:SelfContained:fedora \
Virtualization:Appliances:SelfContained:suse \
Virtualization:Appliances:SelfContained:ubuntu \
+ Virtualization:Appliances:SelfContained:universal \
Virtualization:Appliances:Images:Testing_x86:suse \
Virtualization:Appliances:Images:Testing_x86:centos \
Virtualization:Appliances:Images:Testing_x86:fedora \

View File

@ -1,61 +0,0 @@
From 0d006cf1225bd6ca76057ae11e731ff7b4cd0d97 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marcus=20Sch=C3=A4fer?= <ms@suse.de>
Date: Mon, 21 Sep 2020 17:04:08 +0200
Subject: [PATCH] Cosmetic update for build status helper
Show disabled integration test builds with a clear indicator
---
helper/build_status.sh | 28 +++++++++++++++-------------
1 file changed, 15 insertions(+), 13 deletions(-)
diff --git a/helper/build_status.sh b/helper/build_status.sh
index 09af11c..c740700 100755
--- a/helper/build_status.sh
+++ b/helper/build_status.sh
@@ -23,9 +23,11 @@ do
echo -e "$(echo $line |\
sed -e s@^F@'\\033[31mF\\e[0m'@ |\
sed -e s@^U@'\\033[33mU\\e[0m'@ |\
+ sed -e s@^D@'\\033[36mD\\e[0m'@ |\
sed -e s@^\\.@'\\033[32m.\\e[0m'@)"
done < <(osc -A https://api.opensuse.org \
- results -V "${project}" | grep -B100 Legend | grep -v Legend
+ results -V "${project}" | sed -e 's@^ @ D @' |\
+ grep -B100 Legend | grep -v Legend
)
else
for package in $(osc -A https://api.opensuse.org list "${project}");do
@@ -43,18 +45,18 @@ if [ ! "$1" = "refresh" ];then
cat << EOF
Legend:
. succeeded
- disabled
- U unresolvable
- F failed
- B broken
- b blocked
- % building
- f finished
- s scheduled
- L locked
- x excluded
- d dispatching
- S signing
+ D Disabled
+ U unresolvable
+ F failed
+ B broken
+ b blocked
+ % building
+ f finished
+ s scheduled
+ L locked
+ x excluded
+ d dispatching
+ S signing
? buildstatus not available
EOF
fi
--
2.33.0

View File

@ -1,68 +0,0 @@
From 8794d4a7cbf7bb43382e283c9c6f6c77c712d0b8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marcus=20Sch=C3=A4fer?= <ms@suse.de>
Date: Thu, 10 Jun 2021 11:10:56 +0200
Subject: [PATCH] Fixed cleanup of temporary directory
In the custom kiwi initrd build process a temporary directory
holding a copy of the initrd root tree is created. That data
got never cleaned up. This commit uses a TemporaryDirectory
object from the tempfile module to make sure it gets deleted
once the execution scope is done. This Fixes #1837
---
kiwi/boot/image/builtin_kiwi.py | 7 +++----
test/unit/boot/image/builtin_kiwi_test.py | 6 +++++-
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/kiwi/boot/image/builtin_kiwi.py b/kiwi/boot/image/builtin_kiwi.py
index 8ac574a..c404b09 100644
--- a/kiwi/boot/image/builtin_kiwi.py
+++ b/kiwi/boot/image/builtin_kiwi.py
@@ -17,6 +17,7 @@
#
import os
import logging
+from tempfile import TemporaryDirectory
from tempfile import mkdtemp
# project
@@ -142,13 +143,11 @@ class BootImageKiwi(BootImageBase):
kiwi_initrd_basename = basename
else:
kiwi_initrd_basename = self.initrd_base_name
- temp_boot_root_directory = mkdtemp(
+ temp_boot_root = TemporaryDirectory(
prefix='kiwi_boot_root_copy.'
)
+ temp_boot_root_directory = temp_boot_root.name
os.chmod(temp_boot_root_directory, 0o755)
- self.temp_directories.append(
- temp_boot_root_directory
- )
data = DataSync(
self.boot_root_directory + '/',
temp_boot_root_directory
diff --git a/test/unit/boot/image/builtin_kiwi_test.py b/test/unit/boot/image/builtin_kiwi_test.py
index 7a0ff1d..f7d98ec 100644
--- a/test/unit/boot/image/builtin_kiwi_test.py
+++ b/test/unit/boot/image/builtin_kiwi_test.py
@@ -102,12 +102,16 @@ class TestBootImageKiwi:
@patch('kiwi.boot.image.builtin_kiwi.mkdtemp')
@patch('kiwi.boot.image.builtin_kiwi.os.chmod')
def test_create_initrd(
- self, mock_os_chmod, mock_mkdtemp, mock_prepared, mock_sync,
+ self, mock_TemporaryDirectory, mock_os_chmod,
+ mock_mkdtemp, mock_prepared, mock_sync,
mock_wipe, mock_create, mock_compress, mock_cpio
):
data = mock.Mock()
mock_sync.return_value = data
mock_mkdtemp.return_value = 'temp-boot-directory'
+ temporary_directory = Mock()
+ temporary_directory.name = 'temp-boot-directory'
+ mock_TemporaryDirectory.return_value = temporary_directory
mock_prepared.return_value = True
self.boot_image.boot_root_directory = 'boot-root-directory'
mbrid = mock.Mock()
--
1.8.3.1

View File

@ -1,49 +0,0 @@
From 49d09e9667e90562470d58ab369614f2db8c5c0c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marcus=20Sch=C3=A4fer?= <ms@suse.de>
Date: Thu, 13 Aug 2020 11:17:33 +0200
Subject: [PATCH] Include box plugin images to build_status
Also show some colors for failed and unresolvable builds
---
helper/build_status.sh | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/helper/build_status.sh b/helper/build_status.sh
index ef93ee847c..b8fe0ea8da 100755
--- a/helper/build_status.sh
+++ b/helper/build_status.sh
@@ -1,6 +1,9 @@
#!/bin/bash
for project in \
+ Virtualization:Appliances:SelfContained:fedora \
+ Virtualization:Appliances:SelfContained:suse \
+ Virtualization:Appliances:SelfContained:ubuntu \
Virtualization:Appliances:Images:Testing_x86:suse \
Virtualization:Appliances:Images:Testing_x86:centos \
Virtualization:Appliances:Images:Testing_x86:fedora \
@@ -9,13 +12,20 @@ for project in \
Virtualization:Appliances:Images:Testing_arm:suse \
Virtualization:Appliances:Images:Testing_arm:fedora \
Virtualization:Appliances:Images:Testing_ppc:suse \
+ Virtualization:Appliances:Images:Testing_ppc:sle15 \
Virtualization:Appliances:Images:Testing_ppc:fedora \
Virtualization:Appliances:Images:Testing_x86:archlinux
do
echo "${project}"
if [ ! "$1" = "refresh" ];then
- osc -A https://api.opensuse.org \
+ while read -r line;do
+ echo -e "$(echo $line |\
+ sed -e s@^F@'\\033[31mF\\e[0m'@ |\
+ sed -e s@^U@'\\033[33mU\\e[0m'@ |\
+ sed -e s@^\\.@'\\033[32m.\\e[0m'@)"
+ done < <(osc -A https://api.opensuse.org \
results -V "${project}" | grep -B100 Legend | grep -v Legend
+ )
else
for package in $(osc -A https://api.opensuse.org list "${project}");do
if [[ "${package}" =~ ^test- ]];then
~
~
~

View File

@ -1,362 +0,0 @@
From f63a88867f7de17995e02a34ea4939a9fedc26ff Mon Sep 17 00:00:00 2001
From: David Cassany <dcassany@suse.com>
Date: Wed, 3 Mar 2021 13:17:09 +0100
Subject: [PATCH 1/1] Refactor grub2 installation
This commit refactors grub2 installation method to split it in two
parts. Former grub2.install method was meant to run the grub2-install
tool, however, in addition it was also running the secure boot
installation shim-install. The install method in KIWI is skipped for
those architectures and firmware combinations for which bios support
doesn't exist. This was leading to skip the secure boot installation.
The current approach strips the secure boot installation logic from the
grub2.install method, so skipping the install method does not
automatically result in skipping the secure boot installation.
Fixes bsc#1182211
References: bsn#392
Signed-off-by: Chenxi Mao <chenxi.mao@suse.com>
---
kiwi/bootloader/install/base.py | 8 ++
kiwi/bootloader/install/grub2.py | 122 ++++++++++++---------
kiwi/builder/disk.py | 1 +
test/unit/bootloader/install/base_test.py | 4 +
test/unit/bootloader/install/grub2_test.py | 72 ++++--------
5 files changed, 101 insertions(+), 106 deletions(-)
diff --git a/kiwi/bootloader/install/base.py b/kiwi/bootloader/install/base.py
index d70713b..8df04c9 100644
--- a/kiwi/bootloader/install/base.py
+++ b/kiwi/bootloader/install/base.py
@@ -58,3 +58,11 @@ class BootLoaderInstallBase:
Implementation in specialized bootloader install class required
"""
raise NotImplementedError
+
+ def secure_boot_install(self):
+ """
+ Run shim-install in self.device for secure boots
+
+ Implementation in specialized bootloader install class required
+ """
+ raise NotImplementedError
diff --git a/kiwi/bootloader/install/grub2.py b/kiwi/bootloader/install/grub2.py
index 4b1cf09..d57351c 100644
--- a/kiwi/bootloader/install/grub2.py
+++ b/kiwi/bootloader/install/grub2.py
@@ -119,7 +119,7 @@ class BootLoaderInstallGrub2(BootLoaderInstallBase):
return False
return True
- def install(self): # noqa: C901
+ def install(self):
"""
Install bootloader on disk device
"""
@@ -151,55 +151,7 @@ class BootLoaderInstallGrub2(BootLoaderInstallBase):
self.arch
)
- self.root_mount = MountManager(
- device=self.custom_args['root_device']
- )
- self.boot_mount = MountManager(
- device=self.custom_args['boot_device'],
- mountpoint=self.root_mount.mountpoint + '/boot'
- )
- if self.custom_args.get('efi_device'):
- self.efi_mount = MountManager(
- device=self.custom_args['efi_device'],
- mountpoint=self.root_mount.mountpoint + '/boot/efi'
- )
-
- self.root_mount.mount()
-
- if not self.root_mount.device == self.boot_mount.device:
- self.boot_mount.mount()
-
- if self.efi_mount:
- self.efi_mount.mount()
-
- if self.volumes:
- for volume_path in Path.sort_by_hierarchy(
- sorted(self.volumes.keys())
- ):
- volume_mount = MountManager(
- device=self.volumes[volume_path]['volume_device'],
- mountpoint=self.root_mount.mountpoint + '/' + volume_path
- )
- self.volumes_mount.append(volume_mount)
- volume_mount.mount(
- options=[self.volumes[volume_path]['volume_options']]
- )
-
- self.device_mount = MountManager(
- device='/dev',
- mountpoint=self.root_mount.mountpoint + '/dev'
- )
- self.proc_mount = MountManager(
- device='/proc',
- mountpoint=self.root_mount.mountpoint + '/proc'
- )
- self.sysfs_mount = MountManager(
- device='/sys',
- mountpoint=self.root_mount.mountpoint + '/sys'
- )
- self.device_mount.bind_mount()
- self.proc_mount.bind_mount()
- self.sysfs_mount.bind_mount()
+ self._mount_device_and_volumes()
# check if a grub installation could be found in the image system
module_directory = Defaults.get_grub_path(
@@ -237,8 +189,13 @@ class BootLoaderInstallGrub2(BootLoaderInstallBase):
]
)
- if self.firmware and self.firmware.efi_mode() == 'uefi':
- shim_install = self._get_shim_install_tool_name(
+ def secure_boot_install(self):
+ if self.firmware and self.firmware.efi_mode() == 'uefi' and (
+ Defaults.is_x86_arch(self.arch)
+ or 'arm' in self.arch or self.arch == 'aarch64' # noqa: W503
+ ):
+ self._mount_device_and_volumes()
+ shim_install = self._get_shim_install_tool_name(
self.root_mount.mountpoint
)
# if shim-install does _not_ exist the fallback mechanism
@@ -257,12 +214,71 @@ class BootLoaderInstallGrub2(BootLoaderInstallBase):
[
'chroot', self.root_mount.mountpoint,
'shim-install', '--removable',
- self.install_device
+ self.device
]
)
# restore the grub installer noop
self._enable_grub2_install(self.root_mount.mountpoint)
+ def _mount_device_and_volumes(self):
+ if self.root_mount is None:
+ self.root_mount = MountManager(
+ device=self.custom_args['root_device']
+ )
+ self.root_mount.mount()
+
+ if self.boot_mount is None:
+ if 's390' in self.arch:
+ self.boot_mount = MountManager(
+ device=self.custom_args['boot_device'],
+ mountpoint=self.root_mount.mountpoint + '/boot/zipl'
+ )
+ else:
+ self.boot_mount = MountManager(
+ device=self.custom_args['boot_device'],
+ mountpoint=self.root_mount.mountpoint + '/boot'
+ )
+ if not self.root_mount.device == self.boot_mount.device:
+ self.boot_mount.mount()
+
+ if self.efi_mount is None and self.custom_args.get('efi_device'):
+ self.efi_mount = MountManager(
+ device=self.custom_args['efi_device'],
+ mountpoint=self.root_mount.mountpoint + '/boot/efi'
+ )
+ self.efi_mount.mount()
+
+ if self.volumes and not self.volumes_mount:
+ for volume_path in Path.sort_by_hierarchy(
+ sorted(self.volumes.keys())
+ ):
+ volume_mount = MountManager(
+ device=self.volumes[volume_path]['volume_device'],
+ mountpoint=self.root_mount.mountpoint + '/' + volume_path
+ )
+ self.volumes_mount.append(volume_mount)
+ volume_mount.mount(
+ options=[self.volumes[volume_path]['volume_options']]
+ )
+ if self.device_mount is None:
+ self.device_mount = MountManager(
+ device='/dev',
+ mountpoint=self.root_mount.mountpoint + '/dev'
+ )
+ self.device_mount.bind_mount()
+ if self.proc_mount is None:
+ self.proc_mount = MountManager(
+ device='/proc',
+ mountpoint=self.root_mount.mountpoint + '/proc'
+ )
+ self.proc_mount.bind_mount()
+ if self.sysfs_mount is None:
+ self.sysfs_mount = MountManager(
+ device='/sys',
+ mountpoint=self.root_mount.mountpoint + '/sys'
+ )
+ self.sysfs_mount.bind_mount()
+
def _disable_grub2_install(self, root_path):
if os.access(root_path, os.W_OK):
grub2_install = ''.join(
diff --git a/kiwi/builder/disk.py b/kiwi/builder/disk.py
index 4096797..5789871 100644
--- a/kiwi/builder/disk.py
+++ b/kiwi/builder/disk.py
@@ -1099,6 +1099,7 @@ class DiskBuilder:
)
if bootloader.install_required():
bootloader.install()
+ bootloader.secure_boot_install()
self.system_setup.call_edit_boot_install_script(
self.diskname, boot_device.get_device()
diff --git a/test/unit/bootloader/install/base_test.py b/test/unit/bootloader/install/base_test.py
index 12d4f30..059126c 100644
--- a/test/unit/bootloader/install/base_test.py
+++ b/test/unit/bootloader/install/base_test.py
@@ -17,3 +17,7 @@ class TestBootLoaderInstallBase:
def test_install_required(self):
with raises(NotImplementedError):
self.bootloader.install_required()
+
+ def test_secure_boot_install(self):
+ with raises(NotImplementedError):
+ self.bootloader.secure_boot_install()
diff --git a/test/unit/bootloader/install/grub2_test.py b/test/unit/bootloader/install/grub2_test.py
index a7fd6c8..1551039 100644
--- a/test/unit/bootloader/install/grub2_test.py
+++ b/test/unit/bootloader/install/grub2_test.py
@@ -231,6 +231,7 @@ class TestBootLoaderInstallGrub2:
self, mock_glob, mock_grub_path, mock_mount_manager,
mock_command, mock_which, mock_wipe
):
+ mock_which.return_value = None
mock_glob.return_value = ['tmp_root/boot/grub2/grubenv']
mock_grub_path.return_value = \
self.root_mount.mountpoint + '/usr/lib/grub2/i386-pc'
@@ -263,23 +264,16 @@ class TestBootLoaderInstallGrub2:
'/dev/some-device'
])
- @patch('kiwi.bootloader.install.grub2.Path.wipe')
- @patch('kiwi.bootloader.install.grub2.Path.which')
@patch('kiwi.bootloader.install.grub2.Command.run')
@patch('kiwi.bootloader.install.grub2.MountManager')
- @patch('kiwi.bootloader.install.grub2.Defaults.get_grub_path')
- @patch('kiwi.bootloader.install.grub2.glob.glob')
@patch('os.path.exists')
@patch('os.access')
- def test_install_secure_boot(
- self, mock_access, mock_exists, mock_glob, mock_grub_path,
- mock_mount_manager, mock_command, mock_which, mock_wipe
+ def test_secure_boot_install(
+ self, mock_access, mock_exists,
+ mock_mount_manager, mock_command
):
mock_access.return_value = True
mock_exists.return_value = True
- mock_glob.return_value = ['tmp_root/boot/grub2/grubenv']
- mock_grub_path.return_value = \
- self.root_mount.mountpoint + '/usr/lib/grub2/i386-pc'
self.firmware.efi_mode.return_value = 'uefi'
self.boot_mount.device = self.root_mount.device
@@ -288,22 +282,9 @@ class TestBootLoaderInstallGrub2:
mock_mount_manager.side_effect = side_effect
- self.bootloader.install()
+ self.bootloader.secure_boot_install()
- mock_wipe.assert_called_once_with(
- 'tmp_root/boot/grub2/grubenv'
- )
assert mock_command.call_args_list == [
- call([
- 'chroot', 'tmp_root', 'grub2-install', '--skip-fs-probe',
- '--directory', '/usr/lib/grub2/i386-pc',
- '--boot-directory', '/boot',
- '--target', 'i386-pc',
- '--modules', ' '.join(
- Defaults.get_grub_bios_modules(multiboot=True)
- ),
- '/dev/some-device'
- ]),
call([
'cp', '-p', 'tmp_root/usr/sbin/grub2-install',
'tmp_root/usr/sbin/grub2-install.orig'
@@ -320,55 +301,40 @@ class TestBootLoaderInstallGrub2:
'tmp_root/usr/sbin/grub2-install'
])
]
+ self.root_mount.mount.assert_called_once_with()
+ self.volume_mount.mount.assert_called_once_with(
+ options=['subvol=@/boot/grub2']
+ )
self.device_mount.bind_mount.assert_called_once_with()
self.proc_mount.bind_mount.assert_called_once_with()
self.sysfs_mount.bind_mount.assert_called_once_with()
self.efi_mount.mount.assert_called_once_with()
- @patch('kiwi.bootloader.install.grub2.Path.wipe')
@patch('kiwi.bootloader.install.grub2.Path.which')
- @patch('kiwi.bootloader.install.grub2.Command.run')
@patch('kiwi.bootloader.install.grub2.MountManager')
- @patch('kiwi.bootloader.install.grub2.Defaults.get_grub_path')
- @patch('kiwi.bootloader.install.grub2.glob.glob')
- @patch('os.path.exists')
- def test_install_secure_boot_no_shim_install(
- self, mock_exists, mock_glob, mock_grub_path, mock_mount_manager,
- mock_command, mock_which, mock_wipe
+ def test_secure_boot_install_no_shim_install(
+ self, mock_mount_manager, mock_which
):
mock_which.return_value = None
- mock_exists.return_value = True
- mock_glob.return_value = ['tmp_root/boot/grub2/grubenv']
- mock_grub_path.return_value = \
- self.root_mount.mountpoint + '/usr/lib/grub2/i386-pc'
self.firmware.efi_mode.return_value = 'uefi'
- self.boot_mount.device = self.root_mount.device
def side_effect(device, mountpoint=None):
return self.mount_managers.pop()
mock_mount_manager.side_effect = side_effect
- self.bootloader.install()
-
- mock_wipe.assert_called_once_with(
- 'tmp_root/boot/grub2/grubenv'
+ self.bootloader.secure_boot_install()
+ self.root_mount.mount.assert_called_once_with()
+ self.volume_mount.mount.assert_called_once_with(
+ options=['subvol=@/boot/grub2']
)
- assert mock_command.call_args_list == [
- call([
- 'chroot', 'tmp_root', 'grub2-install', '--skip-fs-probe',
- '--directory', '/usr/lib/grub2/i386-pc',
- '--boot-directory', '/boot',
- '--target', 'i386-pc',
- '--modules', ' '.join(
- Defaults.get_grub_bios_modules(multiboot=True)
- ),
- '/dev/some-device'
- ])
- ]
self.device_mount.bind_mount.assert_called_once_with()
self.proc_mount.bind_mount.assert_called_once_with()
self.sysfs_mount.bind_mount.assert_called_once_with()
+ self.efi_mount.mount.assert_called_once_with()
+ mock_which.assert_called_once_with(
+ filename='shim-install', root_dir='tmp_root'
+ )
@patch('kiwi.bootloader.install.grub2.Command.run')
@patch('kiwi.bootloader.install.grub2.MountManager')
--
2.33.0

Binary file not shown.

BIN
kiwi-9.24.1.tar.gz Normal file

Binary file not shown.

View File

@ -1,23 +1,16 @@
%{?python_enable_dependency_generator}
Name: kiwi
Version: 9.21.7
Release: 4
Version: 9.24.1
Release: 1
License: GPLv3+
Summary: Flexible operating system image builder
URL: http://osinside.github.io/kiwi/
Source0: https://files.pythonhosted.org/packages/source/k/%{name}/%{name}-%{version}.tar.gz
Patch0: backport-Added-microdnf-support-in-XML-schema.patch
Patch2: backport-Include-box-plugin-images-to-build_status.patch
Patch3: backport-Added-s390-SLE15-integration-tests.patch
Patch4: backport-Cosmetic-update-for-build-status-helper.patch
Patch5: backport-Added-universal-box-to-build-status-helper.patch
Patch6: openEuler-custom-make.patch
Patch7: openEuler-use-rsync-link.patch
Patch8: backport-Fixed-cleanup-of-temporary-directory.patch
Patch9: backport-Refactor-grub2-installation.patch
Patch0: openEuler-use-rsync-link.patch
Patch1: openEuler-custom-make.patch
BuildRequires: bash-completion dracut fdupes gcc make
BuildRequires: python3-devel python3-setuptools shadow-utils
@ -179,7 +172,7 @@ done
%files cli
%defattr(-,root,root)
%{_bindir}/%{name}*
%{_datadir}/bash-completion/completions/%{name}-ng.sh
%{_datadir}/bash-completion/completions/%{name}-ng
%config(noreplace) %{_sysconfdir}/kiwi.yml
%ifarch %{ix86} x86_64
@ -199,6 +192,9 @@ done
%{_mandir}/man8/%{name}*
%changelog
* Thu Jul 20 2023 yanglongkang <yanglongkang@h-partners.com> - 9.24.1-1
- update version to 9.24.1
* Thu Jan 12 2023 Chenxi Mao <chenxi.mao@suse.com>> - 9.21.7-4
- Type:bugfix
- ID:NA

View File

@ -1,22 +1,20 @@
diff --git a/kiwi/archive/cpio.py b/kiwi/archive/cpio.py
index 27d596c..f147aa1 100644
index 27d596c..042f1cd 100644
--- a/kiwi/archive/cpio.py
+++ b/kiwi/archive/cpio.py
@@ -16,8 +16,13 @@
# along with kiwi. If not, see <http://www.gnu.org/licenses/>
@@ -17,7 +17,11 @@
#
# project
+from kiwi.runtime_config import RuntimeConfig
from kiwi.command import Command
+from kiwi.runtime_config import RuntimeConfig
+import os
+import logging
+
+log = logging.getLogger('kiwi')
class ArchiveCpio:
"""
@@ -27,6 +32,7 @@ class ArchiveCpio:
@@ -27,6 +31,7 @@ class ArchiveCpio:
"""
def __init__(self, filename):
self.filename = filename
@ -24,7 +22,7 @@ index 27d596c..f147aa1 100644
def create(self, source_dir, exclude=None):
"""
@@ -35,6 +41,62 @@ class ArchiveCpio:
@@ -35,6 +40,62 @@ class ArchiveCpio:
:param string source_dir: data source directory
:param list exclude: list of excluded items
"""
@ -88,10 +86,10 @@ index 27d596c..f147aa1 100644
find_command = ['cd', source_dir, '&&', 'find', '.']
cpio_command = [
diff --git a/kiwi/boot/image/builtin_kiwi.py b/kiwi/boot/image/builtin_kiwi.py
index 08c5644..1e8a3b4 100644
index 5b26798..30d30bc 100644
--- a/kiwi/boot/image/builtin_kiwi.py
+++ b/kiwi/boot/image/builtin_kiwi.py
@@ -29,6 +29,7 @@ from kiwi.archive.cpio import ArchiveCpio
@@ -33,6 +33,7 @@ from kiwi.archive.cpio import ArchiveCpio
from kiwi.utils.compress import Compress
from kiwi.path import Path
from kiwi.boot.image.base import BootImageBase
@ -99,44 +97,46 @@ index 08c5644..1e8a3b4 100644
log = logging.getLogger('kiwi')
@@ -79,6 +80,7 @@ class BootImageKiwi(BootImageBase):
system.install_system(
manager
)
+ self.runtime_config = RuntimeConfig()
@@ -99,6 +100,7 @@ class BootImageKiwi(BootImageBase):
system.install_system(
manager
)
+ self.runtime_config = RuntimeConfig()
profile = Profile(self.boot_xml_state)
profile.add('kiwi_initrdname', boot_image_name)
@@ -96,16 +98,21 @@ class BootImageKiwi(BootImageBase):
self.setup.import_overlay_files(
follow_links=True
)
+ if self.runtime_config.get_custom_hw_systemflag():
+ self.setup.setup_groups()
+ self.setup.setup_users()
self.setup.call_config_script()
profile = Profile(self.boot_xml_state)
profile.add('kiwi_initrdname', boot_image_name)
@@ -121,16 +123,22 @@ class BootImageKiwi(BootImageBase):
self.setup.import_overlay_files(
follow_links=True
)
+
+ if self.runtime_config.get_custom_hw_systemflag():
+ self.setup.setup_groups()
+ self.setup.setup_users()
self.setup.call_config_script()
- system.pinch_system(
- manager=manager, force=True
- )
+ if not self.runtime_config.get_custom_hw_systemflag():
+ system.pinch_system(
+ manager=manager, force=True
+ )
# make sure system instance is cleaned up before setting up
del system
self.setup.call_image_script()
- self.setup.create_init_link_from_linuxrc()
+ if not self.runtime_config.get_custom_hw_systemflag():
+ self.setup.create_init_link_from_linuxrc()
def create_initrd(self, mbrid=None, basename=None, install_initrd=False):
"""
@@ -144,14 +151,15 @@ class BootImageKiwi(BootImageBase):
- system.pinch_system(
- manager=manager, force=True
- )
+ if not self.runtime_config.get_custom_hw_systemflag():
+ system.pinch_system(
+ manager=manager, force=True
+ )
# make sure system instance is cleaned up before setting up
del system
self.setup.call_image_script()
- self.setup.create_init_link_from_linuxrc()
+ if not self.runtime_config.get_custom_hw_systemflag():
+ self.setup.create_init_link_from_linuxrc()
def create_initrd(
self, mbrid: Optional[SystemIdentifier] = None,
@@ -169,15 +177,16 @@ class BootImageKiwi(BootImageBase):
data.sync_data(
options=['-a']
)
boot_directory = temp_boot_root_directory + '/boot'
- boot_directory = temp_boot_root_directory + '/boot'
- Path.wipe(boot_directory)
- if mbrid:
- log.info(
@ -145,6 +145,7 @@ index 08c5644..1e8a3b4 100644
- Path.create(boot_directory)
- image_identifier = boot_directory + '/mbrid'
- mbrid.write(image_identifier)
+
+ if not self.runtime_config.get_custom_hw_systemflag():
+ Path.wipe(boot_directory)
+ if mbrid:
@ -157,7 +158,7 @@ index 08c5644..1e8a3b4 100644
cpio = ArchiveCpio(
os.sep.join([self.target_dir, kiwi_initrd_basename])
@@ -159,19 +167,34 @@ class BootImageKiwi(BootImageBase):
@@ -185,19 +194,33 @@ class BootImageKiwi(BootImageBase):
# the following is a list of directories which were needed
# during the process of creating an image but not when the
# image is actually booting with this initrd
@ -175,19 +176,19 @@ index 08c5644..1e8a3b4 100644
+ '/' + Defaults.get_shared_cache_location(),
+ '/image', '/usr/lib/grub*'
+ ]
+
# the following is a list of directories to exclude which
# are not needed inside of the initrd
- # are not needed inside of the initrd
- exclude_from_archive += [
- '/usr/share/doc', '/usr/share/man', '/home', '/media', '/srv'
- ]
+ #
+ if self.runtime_config.get_custom_hw_systemflag():
+ exclude_from_archive += [
+ '/media'
+ ]
+ else:
+ exclude_from_archive += [
+ '/usr/share/doc', '/usr/share/man', '/home', '/media', '/srv'
+ '/usr/share/doc', '/usr/share/man', '/home', '/media', '/srv'
+ ]
cpio.create(
source_dir=temp_boot_root_directory,
@ -200,15 +201,14 @@ index 08c5644..1e8a3b4 100644
'--> xz compressing archive'
)
diff --git a/kiwi/builder/kis.py b/kiwi/builder/kis.py
index ea33c6a..542a345 100644
index 55da66f..271f46b 100644
--- a/kiwi/builder/kis.py
+++ b/kiwi/builder/kis.py
@@ -132,25 +132,27 @@ class KisBuilder:
self.system_setup.export_modprobe_setup(
@@ -140,24 +140,27 @@ class KisBuilder:
self.boot_image_task.boot_root_directory
)
-
- # extract kernel from boot(initrd) root system
- # extract kernel from boot system
- kernel = Kernel(self.boot_image_task.boot_root_directory)
- kernel_data = kernel.get_kernel()
- if kernel_data:
@ -228,7 +228,7 @@ index ea33c6a..542a345 100644
- 'No kernel in boot image tree %s found' %
- self.boot_image_task.boot_root_directory
- )
+ # extract kernel from boot(initrd) root system
+ # extract kernel from boot system
+ kernel = Kernel(self.boot_image_task.boot_root_directory)
+ kernel_data = kernel.get_kernel()
+ if kernel_data:
@ -249,7 +249,7 @@ index ea33c6a..542a345 100644
# extract hypervisor from boot(initrd) root system
if self.xen_server:
@@ -187,6 +189,8 @@ class KisBuilder:
@@ -198,6 +201,8 @@ class KisBuilder:
cmdline += ' {}'.format(self.custom_cmdline)
with open(self.append_file, 'w') as append:
append.write(cmdline)
@ -259,104 +259,10 @@ index ea33c6a..542a345 100644
# put results into a tarball
if not self.xz_options:
diff --git a/kiwi/config/functions.sh b/kiwi/config/functions.sh
index a81be6a..cd28ec8 100644
index 98915af..0a7afb3 100644
--- a/kiwi/config/functions.sh
+++ b/kiwi/config/functions.sh
@@ -176,6 +176,34 @@ function suseInsertService {
baseInsertService "$@"
}
+
+#======================================
+# suseActivateAllServices ---- add
+#--------------------------------------
+function suseRemoveAllServices {
+ # /.../
+ # Check all services in /etc/init.d/ and activate them
+ # by calling insertService
+ # -----
+ for i in /etc/init.d/*;do
+ if [ -x $i ] && [ -f $i ];then
+ echo $i | grep -q skel
+ if [ $? = 0 ];then
+ continue
+ fi
+ echo $i | grep -q halt
+ if [ $? = 0 ];then
+ continue
+ fi
+ echo $i | grep -q reboot
+ if [ $? = 0 ];then
+ continue
+ fi
+ suseRemoveService ${i##*/}
+ fi
+ done
+}
+
#======================================
# suseService
#--------------------------------------
@@ -361,10 +389,58 @@ function baseStripDocs {
grep -iv "copying\|license\|copyright")
rm -f "${docfiles}"
done
+ rm -rf `rpm -qad`
rm -rf /usr/share/info
rm -rf /usr/share/man
}
+#======================================
+# baseStripcustomBep
+#--------------------------------------
+function baseStripcustomBep {
+ # /.../
+ # remove custom difference files
+ # ----
+ local hookdir=$1
+ local hookscript=$hookdir/S00bep
+
+ [ ! -d "$hookdir" ] && return
+ [ ! -f "$hookscript" ] && return
+ chmod u+x $hookscript &>/dev/null
+ dos2unix $hookscript &>/dev/null
+ if [ -x "$hookscript" ]; then
+ /bin/bash $hookscript
+ fi
+ rm -rf $hookdir
+ rm -rf /usr/custom/usrfile/$hookdir
+
+}
+
+#======================================
+# baseStripBep
+#--------------------------------------
+function baseStripBep {
+ # /.../
+ # remove log,dnf, files
+ # ----
+ local dbepfiles=""
+ local directories="
+ /var/log/
+ /var/lib/systemd/catalog
+ "
+ local dbephookdir="/usr/openEuler/hook/bep_delete_hook"
+ for dir in $directories; do
+ dbepfiles=$(find $dir -type f)
+ for file in $dbepfiles
+ do
+ echo -n > $file
+ done
+ done
+ rm -f /var/lib/dnf/history*
+ rm -f /var/lib/rpm/__db.00*
+ baseStripcustomBep $dbephookdir
+}
+
#======================================
# baseStripLocales
#--------------------------------------
@@ -374,13 +450,25 @@ function baseStripLocales {
@@ -173,10 +173,22 @@ function baseStripLocales {
baseStripAndKeep "${keepLocales}"
}
@ -373,9 +279,6 @@ index a81be6a..cd28ec8 100644
+ baseStripAndKeep ${keepGconv}
+}
+
#======================================
# baseStripTranslations
#--------------------------------------
function baseStripTranslations {
- local keepMatching="$*"
- find /usr/share/locale -name "*.mo" |\
@ -384,63 +287,8 @@ index a81be6a..cd28ec8 100644
+ find /usr/share/locale -name "*.mo" | baseStripAndKeep ${keepMatching}
}
#======================================
@@ -422,7 +510,7 @@ function baseStripAndKeep {
fi
done
if [ "${found}" = 0 ]; then
- Rm -rf "${file}"
+ rm_isnot_usrfile $file
fi
done
}
@@ -507,6 +595,45 @@ function Debug {
echo "+++++> (caller:${FUNCNAME[1]}:${FUNCNAME[2]} ) $*"
fi
}
+#======================================
+# baseSetupBusyBox
+#--------------------------------------
+function baseSetupBusyBox {
+ # /.../
+ # activates busybox if installed for all links from
+ # the busybox/busybox.links file - you can choose custom apps to
+ # be forced into busybox with the "-f" option as first parameter
+ # ---
+ # example: baseSetupBusyBox -f /bin/zcat /bin/vi
+ # ---
+ local applets=""
+ local force=no
+ local busyboxlinks=/usr/share/busybox/busybox.links
+ if [ ! -f "/usr/sbin/busybox" ]; then
+ echo "Busybox not installed... skipped"
+ return 0
+ fi
+ if [ $# -gt 0 ] && [ "$1" = "-f" ]; then
+ force=yes
+ shift
+ fi
+ if [ $# -gt 0 ]; then
+ for i in "$@"; do
+ if grep -q "^$i$" "$busyboxlinks"; then
+ applets="${applets} $i"
+ fi
+ done
+ else
+ applets=`cat "$busyboxlinks"`
+ fi
+ for applet in $applets; do
+ if [ ! -f "$applet" ] || [ "$force" = "yes" ]; then
+ echo "Busybox Link: ln -sf /usr/sbin/busybox $applet"
+ ln -sf /usr/sbin/busybox "$applet"
+ fi
+ done
+}
+
#======================================
# stripUnusedLibs
#--------------------------------------
@@ -518,6 +645,8 @@ function baseStripUnusedLibs {
function baseStripUnusedLibs {
@@ -187,6 +199,8 @@ function baseStripUnusedLibs {
local needlibs
local found
local dir
@ -449,7 +297,7 @@ index a81be6a..cd28ec8 100644
local lib
local lddref
# /.../
@@ -525,33 +654,33 @@ function baseStripUnusedLibs {
@@ -194,33 +208,33 @@ function baseStripUnusedLibs {
# on files in *bin*
# ---
ldconfig
@ -496,14 +344,15 @@ index a81be6a..cd28ec8 100644
count=$((count + 1))
fi
done
@@ -559,46 +688,42 @@ function baseStripUnusedLibs {
@@ -228,47 +242,41 @@ function baseStripUnusedLibs {
# /.../
# add exceptions
# ----
- for libname in $1; do
- for libfile in \
- /lib*/"$libname"* /usr/lib*/"$libname"* \
- /lib/x86_64-linux-gnu/"$libname"* /usr/lib/x86_64-linux-gnu/"$libname"* \
- /lib/x86_64-linux-gnu/"$libname"* \
- /usr/lib/x86_64-linux-gnu/"$libname"* \
- /usr/X11R6/lib*/"$libname"*
- do
- if [ -e "$libfile" ];then
@ -541,7 +390,6 @@ index a81be6a..cd28ec8 100644
fi
- if [ -L "$i" ];then
+ if [ -L $i ];then
+ continue
continue
fi
for n in ${needlibs[*]};do
@ -558,11 +406,16 @@ index a81be6a..cd28ec8 100644
fi
done
}
@@ -622,60 +747,144 @@ function baseUpdateSysConfig {
@@ -289,27 +297,160 @@ function baseUpdateSysConfig {
fi
}
+#find all need tool which ÃüÁîÒ»¶¨ÓÐ
-function baseStripInitrd {
- declare kiwi_initrd_system=${kiwi_initrd_system}
- declare kiwi_strip_tools=${kiwi_strip_tools}
- declare kiwi_strip_libs=${kiwi_strip_libs}
+
+#find all need tool which һ
+function baseStripAllTools {
+ local needtools=$1
+ local newneedtools=
@ -595,14 +448,30 @@ index a81be6a..cd28ec8 100644
+
+}
+
#======================================
-# baseStripInitrd
+# function baseStripInitrd {
+# declare kiwi_initrd_system=${kiwi_initrd_system}
+# declare kiwi_strip_tools=${kiwi_strip_tools}
+# declare kiwi_strip_libs=${kiwi_strip_libs}
+# #==========================================
+# # Check for initrd system
+# #------------------------------------------
+# if [ "${kiwi_initrd_system}" = "dracut" ]; then
+# echo "dracut initrd system requested, initrd strip skipped"
+# return
+# fi
+# #==========================================
+# # remove unneeded tools
+# #------------------------------------------
+# local tools="${kiwi_strip_tools}"
+# tools="${tools} $*"
+# for path in /sbin /usr/sbin /usr/bin /bin;do
+# baseStripTools "${path}" "${tools}"
+# done
+# }
+
+#======================================
+# baseStripInvalidLink
#--------------------------------------
-function baseStripInitrd {
- declare kiwi_initrd_system=${kiwi_initrd_system}
- declare kiwi_strip_tools=${kiwi_strip_tools}
- declare kiwi_strip_libs=${kiwi_strip_libs}
+#--------------------------------------
+function baseStripInvalidLink {
+ local path
+ local link_file
@ -628,17 +497,8 @@ index a81be6a..cd28ec8 100644
- return
- fi
+ echo $kiwi_strip_delete | xargs rm -rfv
#==========================================
# remove unneeded tools
#------------------------------------------
- local tools="${kiwi_strip_tools}"
- tools="${tools} $*"
- for path in /sbin /usr/sbin /usr/bin /bin;do
- baseStripTools "${path}" "${tools}"
- done
+ local tools="$kiwi_strip_tools"
+ tools="$tools $@"
+
+ #for path in /sbin /usr/sbin /usr/bin /bin;do
+ # baseStripTools "$path" "$tools"
+ #done
@ -648,18 +508,18 @@ index a81be6a..cd28ec8 100644
+ baseSetupBusyBox -f
+
#==========================================
# remove unused libs
- # remove unneeded tools
+ # remove unused libs
#------------------------------------------
- baseStripUnusedLibs "${kiwi_strip_libs}"
+ baseStripUnusedLibs $kiwi_strip_libs
#==========================================
- # remove package manager meta data
+ # remove images.sh
#------------------------------------------
- for p in dpkg rpm yum;do
- rm -rf "/var/lib/$p"
- local tools="${kiwi_strip_tools}"
- tools="${tools} $*"
- for path in /sbin /usr/sbin /usr/bin /bin;do
- baseStripTools "${path}" "${tools}"
- done
-}
+ baseStripUnusedLibs $kiwi_strip_libs
+ #==========================================
+ # remove images.sh
+ #------------------------------------------
+ rm -f /image/images.sh
+ #==========================================
+ # remove unused root directories
@ -674,21 +534,14 @@ index a81be6a..cd28ec8 100644
+ rm -rf /usr/share/doc
+ rm -rf /usr/share/man
+ #==========================================
+
+ find /sbin /usr/sbin /usr/bin /bin -maxdepth 1 -type f |xargs rpm -qf --qf '%{name}\n' |sort -u > /opt/need_rpmlst
+ find /sbin /usr/sbin /usr/bin /bin -maxdepth 1 -type l |xargs rpm -qf --qf '%{name}\n' |sort -u >> /opt/need_rpmlst
+
+ find /lib /lib64 /usr/lib /usr/lib64 \
+ /usr/X11R6/lib /usr/X11R6/lib64 \
+ -maxdepth 1 -type f |grep so |xargs rpm -qf --qf '%{name}\n' |sort -u >> /opt/need_rpmlst
+
+
+ find /lib/modules/ -type f -name "*.ko" |xargs rpm -qf --qf '%{name}\n' |sort -u >> /opt/need_rpmlst
-#======================================
-# suseStripInitrd
-#--------------------------------------
-function suseStripInitrd {
- baseStripInitrd "$@"
+ for i in `baseGetPackagesForDeletion`;do
+ grep -q ^${i}$ /opt/need_rpmlst
+ if [ $? -ne 0 ];then
@ -698,6 +551,16 @@ index a81be6a..cd28ec8 100644
+ chmod 640 /var/log/cancel_uninstallrpm
+ fi
+ done
+
+ # remove invalid link file
+ #------------------------------------------
+ baseStripInvalidLink
}
+function strip_rpm {
+ #==========================================
+ # remove rpm cmd, until get src rpm list
+ #------------------------------------------
+
+ if [ "$sys_cut" = "yes" ];then
+
@ -713,30 +576,13 @@ index a81be6a..cd28ec8 100644
+ rm -rf /var/lib/$p
+ done
+ fi
+ #==========================================
+ # remove invalid link file
+ #------------------------------------------
+ baseStripInvalidLink
}
#======================================
# rhelStripInitrd
#--------------------------------------
function rhelStripInitrd {
- baseStripInitrd "$@"
+ suseStripInitrd
}
-#======================================
-# debianStripInitrd
-#--------------------------------------
-function debianStripInitrd {
- baseStripInitrd "$@"
-}
#======================================
# rhelSplashToGrub
@@ -825,7 +1034,7 @@ function baseStripModules {
+}
+
+
function baseStripFirmware {
# /.../
# check all kernel modules if they require a firmware and
@@ -412,7 +553,7 @@ function baseStripModules {
if [[ ${file} =~ ${mod} ]] && [[ ! ${file} =~ "updates" ]];then
echo "baseStripModules: Update driver found for ${mod}"
echo "baseStripModules: Removing old version: ${file}"
@ -745,22 +591,7 @@ index a81be6a..cd28ec8 100644
fi
done
done
@@ -852,6 +1061,14 @@ function baseSyncKernelTree {
rm -rf /lib/modules/*
cp -a /kernel-tree/* /lib/modules/
rm -rf /kernel-tree
+ if [ -d /lib/modules/openEuler ]; then
+ kversion=($(ls /lib/modules/|grep -v 'openEuler'))
+ for((i=0;i<${#kversion[@]};i++))
+ do
+ rm -rf /lib/modules/${kversion[i]}/openEuler
+ ln -sf /lib/modules/openEuler /lib/modules/${kversion[i]}/openEuler
+ done
+ fi
}
#======================================
@@ -976,10 +1193,6 @@ function baseStripKernel {
@@ -478,10 +619,6 @@ function baseStripKernel {
if [ "${kiwi_initrd_system}" = "dracut" ]; then
echo "dracut initrd system requested, kernel strip skipped"
else
@ -771,27 +602,185 @@ index a81be6a..cd28ec8 100644
baseCreateKernelTree
baseStripKernelModules
baseFixupKernelModuleDependencies
@@ -1001,14 +1214,7 @@ function suseStripKernel {
# rhelStripKernel
#--------------------------------------
function rhelStripKernel {
- baseStripKernel
@@ -594,14 +731,40 @@ function suseInsertService {
baseInsertService "$@"
}
+
+
+#======================================
+# suseActivateAllServices ---- add
+#--------------------------------------
+function suseRemoveAllServices {
+ # /.../
+ # Check all services in /etc/init.d/ and activate them
+ # by calling insertService
+ # -----
+ for i in /etc/init.d/*;do
+ if [ -x $i ] && [ -f $i ];then
+ echo $i | grep -q skel
+ if [ $? = 0 ];then
+ continue
+ fi
+ echo $i | grep -q halt
+ if [ $? = 0 ];then
+ continue
+ fi
+ echo $i | grep -q reboot
+ if [ $? = 0 ];then
+ continue
+ fi
+ suseRemoveService ${i##*/}
+ fi
+ done
+}
+
function suseService {
# function kept for compatibility
baseService "$@"
}
-function suseStripInitrd {
- baseStripInitrd "$@"
-}
-
-#======================================
-# debianStripKernel
-#--------------------------------------
-function debianStripKernel {
- baseStripKernel
+ suseStripKernel
function suseStripKernel {
baseStripKernel
@@ -677,6 +840,46 @@ function Debug {
fi
}
+
+#======================================
+# baseSetupBusyBox
+#--------------------------------------
+function baseSetupBusyBox {
+ # /.../
+ # activates busybox if installed for all links from
+ # the busybox/busybox.links file - you can choose custom apps to
+ # be forced into busybox with the "-f" option as first parameter
+ # ---
+ # example: baseSetupBusyBox -f /bin/zcat /bin/vi
+ # ---
+ local applets=""
+ local force=no
+ local busyboxlinks=/usr/share/busybox/busybox.links
+ if [ ! -f "/usr/sbin/busybox" ]; then
+ echo "Busybox not installed... skipped"
+ return 0
+ fi
+ if [ $# -gt 0 ] && [ "$1" = "-f" ]; then
+ force=yes
+ shift
+ fi
+ if [ $# -gt 0 ]; then
+ for i in "$@"; do
+ if grep -q "^$i$" "$busyboxlinks"; then
+ applets="${applets} $i"
+ fi
+ done
+ else
+ applets=`cat "$busyboxlinks"`
+ fi
+ for applet in $applets; do
+ if [ ! -f "$applet" ] || [ "$force" = "yes" ]; then
+ echo "Busybox Link: ln -sf /usr/sbin/busybox $applet"
+ ln -sf /usr/sbin/busybox "$applet"
+ fi
+ done
+}
+
function baseQuoteFile {
# /.../
# Quote file to be shell sourceable
@@ -715,6 +918,14 @@ function baseSyncKernelTree {
rm -rf /lib/modules/*
cp -a /kernel-tree/* /lib/modules/
rm -rf /kernel-tree
+ if [ -d /lib/modules/openEuler ]; then
+ kversion=($(ls /lib/modules/|grep -v 'openEuler'))
+ for((i=0;i<${#kversion[@]};i++))
+ do
+ rm -rf /lib/modules/${kversion[i]}/openEuler
+ ln -sf /lib/modules/openEuler /lib/modules/${kversion[i]}/openEuler
+ done
+ fi
}
function baseFixupKernelModuleDependencies {
@@ -797,7 +1008,7 @@ function baseStripAndKeep {
fi
done
if [ "${found}" = 0 ]; then
- Rm -rf "${file}"
+ rm_isnot_usrfile $file
fi
done
}
@@ -816,6 +1027,11 @@ function baseStripTools {
while IFS= read -r -d $'\0' file; do
found=0
base=$(/usr/bin/basename "${file}")
+ if [ "${base}" = "rpm" ]; then
+ # Keep the RPM command, and delete by sys_cut=yes
+ echo "sys_cut keep rpm cmd."
+ found=1
+ fi
for need in ${tools};do
if [ "${base}" = "$need" ];then
found=1
@@ -846,16 +1062,133 @@ function deprecated {
exit 1
}
+#======================================
+# baseStripcustomBep
+#--------------------------------------
+function baseStripcustomBep {
+ # /.../
+ # remove custom difference files
+ # ----
+ local hookdir=$1
+ local hookscript=$hookdir/S00bep
+
+ [ ! -d "$hookdir" ] && return
+ [ ! -f "$hookscript" ] && return
+ chmod u+x $hookscript &>/dev/null
+ dos2unix $hookscript &>/dev/null
+ if [ -x "$hookscript" ]; then
+ /bin/bash $hookscript
+ fi
+ rm -rf $hookdir
+ rm -rf /usr/custom/usrfile/$hookdir
+
+}
#======================================
@@ -1160,4 +1366,18 @@ function baseQuoteFile {
mv "${conf}" "${file}"
}
-# vim: set noexpandtab:
-# Deprecated methods
+# baseStripBep
#--------------------------------------
+function baseStripBep {
+ # /.../
+ # remove log,dnf, files
+ # ----
+ local dbepfiles=""
+ local directories="
+ /var/log/
+ /var/lib/systemd/catalog
+ "
+ local dbephookdir="/usr/openEuler/hook/bep_delete_hook"
+ for dir in $directories; do
+ dbepfiles=$(find $dir -type f)
+ for file in $dbepfiles
+ do
+ echo -n > $file
+ done
+ done
+ rm -f /var/lib/dnf/history*
+ rm -f /var/lib/rpm/__db.00*
+ baseStripcustomBep $dbephookdir
+}
+
+function rm_isnot_usrfile {
+ local rm_file=$1
+ local usrrpm_filelst='/opt/usrrpm_filelst'
@ -807,6 +796,142 @@ index a81be6a..cd28ec8 100644
+
+ return 0
+}
+
+function rhelStripKernel {
+ suseStripKernel
+}
+
+function rhelStripInitrd {
+ suseStripInitrd
+}
+
+function baseStripDocs {
+ # /.../
+ # remove all documentation, except
+ # copying license copyright
+ # ----
+ local docfiles
+ local dir
+ local directories="
+ /opt/gnome/share/doc/packages
+ /usr/share/doc/packages
+ /opt/kde3/share/doc/packages
+ "
+ for dir in ${directories}; do
+ docfiles=$(find "${dir}" -type f |\
+ grep -iv "copying\|license\|copyright")
+ rm -f "${docfiles}"
+ done
+ rm -rf `rpm -qad`
+ rm -rf /usr/share/info
+ rm -rf /usr/share/man
+}
+
function baseCleanMount {
- deprecated "${FUNCNAME[0]}" <<- EOF
- Cleanup operations are a responsibility of the kiwi code
- EOF
+ for path in /proc/sys/fs/binfmt_misc /proc /dev/pts /sys;do
+ [ -d "${path}" ] && umount "${path}" &>/dev/null
+ done
+}
+
+function suseConfig {
+ return
+}
+
+#======================================
+# Rpm
+#--------------------------------------
+function Rpm {
+ # /.../
+ # all rpm function & anounce it to log
+ # ----
+ Debug "rpm $*"
+ rpm "$@"
}
+#======================================
+# baseGetPackagesForDeletion
+#--------------------------------------
+function baseGetPackagesForDeletion {
+ declare kiwi_delete=${kiwi_delete}
+ echo "${kiwi_delete}"
+}
+
+
+#======================================
+# Deprecated methods
+#--------------------------------------
+
function baseMount {
deprecated "${FUNCNAME[0]}" <<- EOF
Mounting of kernel and other base filesystems are a
@@ -877,18 +1210,6 @@ function baseSetupUserPermissions {
EOF
}
-function suseConfig {
- deprecated "${FUNCNAME[0]}" <<- EOF
- suse script no longer present
- EOF
-}
-
-function baseGetPackagesForDeletion {
- deprecated "${FUNCNAME[0]}" <<- EOF
- Provided by the kiwi_delete environment variable
- EOF
-}
-
function baseGetProfilesUsed {
deprecated "${FUNCNAME[0]}" <<- EOF
Provided by the kiwi_profiles environment variable
@@ -902,13 +1223,6 @@ function baseStripMans {
EOF
}
-function baseStripDocs {
- deprecated "${FUNCNAME[0]}" <<- EOF
- Documentation lives at different places and a method
- to do this in a common way should not be a responsibility
- of kiwi
- EOF
-}
function baseStripInfos {
deprecated "${FUNCNAME[0]}" <<- EOF
@@ -917,18 +1231,6 @@ function baseStripInfos {
EOF
}
-function Rpm {
- deprecated "${FUNCNAME[0]}" <<- EOF
- Please call rpm as it fits in the caller scope
- EOF
-}
-
-function rhelStripInitrd {
- deprecated "${FUNCNAME[0]}" <<- EOF
- Useful only in the context of a kiwi created initrd
- This concept was never exposed to RHEL/Fedora
- EOF
-}
function debianStripInitrd {
deprecated "${FUNCNAME[0]}" <<- EOF
@@ -937,12 +1239,6 @@ function debianStripInitrd {
EOF
}
-function rhelStripKernel {
- deprecated "${FUNCNAME[0]}" <<- EOF
- Useful only in the context of a kiwi created initrd
- This concept was never exposed to RHEL/Fedora
- EOF
-}
function debianStripKernel {
deprecated "${FUNCNAME[0]}" <<- EOF
diff --git a/kiwi/path.py b/kiwi/path.py
index b763211..b2ce909 100644
--- a/kiwi/path.py
@ -821,10 +946,10 @@ index b763211..b2ce909 100644
for path_index in reversed(range(0, len(path_elements))):
sub_path = os.sep.join(path_elements[0:path_index])
diff --git a/kiwi/runtime_config.py b/kiwi/runtime_config.py
index e968f3c..ba13267 100644
index 11863c3..5fb93dc 100644
--- a/kiwi/runtime_config.py
+++ b/kiwi/runtime_config.py
@@ -259,6 +259,56 @@ class RuntimeConfig:
@@ -345,6 +345,56 @@ class RuntimeConfig:
)
return disabled_checks or ''
@ -879,15 +1004,15 @@ index e968f3c..ba13267 100644
+ return hw_relese_iso_cmdline or None
+
def _get_attribute(self, element, attribute):
if self.config_data:
if RUNTIME_CONFIG:
try:
diff --git a/kiwi/tasks/base.py b/kiwi/tasks/base.py
index 90f7c45..426e79b 100644
index 68b7bd5..d714770 100644
--- a/kiwi/tasks/base.py
+++ b/kiwi/tasks/base.py
@@ -74,7 +74,6 @@ class CliTask:
'check_minimal_required_preferences': [],
@@ -75,7 +75,6 @@ class CliTask:
'check_efi_mode_for_disk_overlay_correctly_setup': [],
'check_initrd_selection_required': [],
'check_boot_description_exists': [],
- 'check_consistent_kernel_in_boot_and_system_image': [],
'check_container_tool_chain_installed': [],
@ -895,4 +1020,3 @@ index 90f7c45..426e79b 100644
'check_volume_setup_defines_multiple_fullsize_volumes': [],
--
2.33.0

View File

@ -1,26 +1,24 @@
diff --git a/kiwi/boot/image/builtin_kiwi.py b/kiwi/boot/image/builtin_kiwi.py
index 1e8a3b4..8ac574a 100644
index 6167ad5..5811a96 100644
--- a/kiwi/boot/image/builtin_kiwi.py
+++ b/kiwi/boot/image/builtin_kiwi.py
@@ -95,9 +95,15 @@ class BootImageKiwi(BootImageBase):
Defaults.get_profile_file(self.boot_root_directory)
)
self.setup.import_description()
- self.setup.import_overlay_files(
- follow_links=True
- )
+ if self.runtime_config.get_custom_hw_systemflag():
+ self.setup.import_overlay_files(
+ follow_links=False
+ )
+ else:
+ self.setup.import_overlay_files(
+ follow_links=True
+ )
+
if self.runtime_config.get_custom_hw_systemflag():
self.setup.setup_groups()
self.setup.setup_users()
@@ -113,9 +113,14 @@ class BootImageKiwi(BootImageBase):
Defaults.get_profile_file(self.boot_root_directory)
)
self.setup.import_description()
- self.setup.import_overlay_files(
- follow_links=True
- )
+ if self.runtime_config.get_custom_hw_systemflag():
+ self.setup.import_overlay_files(
+ follow_links=False
+ )
+ else:
+ self.setup.import_overlay_files(
+ follow_links=True
+ )
self.setup.call_config_script()
system.pinch_system(
--
2.23.0
2.39.1