Compare commits

...

10 Commits

Author SHA1 Message Date
openeuler-ci-bot
4b563c9bdf
!103 [sync] PR-102: 在ARM64架构下,支持UEFI模式
From: @openeuler-sync-bot 
Reviewed-by: @zhuchunyi 
Signed-off-by: @zhuchunyi
2023-01-13 06:24:03 +00:00
Chenxi Mao
d7025d16a6 Support UEFI on ARM64
Current KIWI cannot support UEFI on aarch64, backport upstream
patch to re-work bootloader installation code to support UEFI
on ARM64 platform.

References: bsn#392
Signed-off-by: Chenxi Mao <chenxi.mao@suse.com>
(cherry picked from commit 0d03e05f4c33a0ccde304578a0dafa140bcc9d4f)
2023-01-12 15:40:30 +08:00
openeuler-ci-bot
1cb6f90313
!94 [sync] PR-93: Delete xorriso dependencies
From: @openeuler-sync-bot 
Reviewed-by: @xiezhipeng1 
Signed-off-by: @xiezhipeng1
2022-06-30 09:29:36 +00:00
weiwei_tiantian
061a0e7582 Delete xorriso dependencies
(cherry picked from commit 2016a4ef2588039c21070b6fd26d49268504fd40)
2022-06-30 11:25:30 +08:00
openeuler-ci-bot
a601d286e4
!91 add release for rebuild
From: @tong_1001 
Reviewed-by: @xiezhipeng1 
Signed-off-by: @xiezhipeng1
2022-04-27 07:16:36 +00:00
shixuantong
7d2570c4eb add release for rebuild 2022-04-27 14:43:19 +08:00
openeuler-ci-bot
3dff9c28dc
!88 update version to 9.21.7
From: @tong_1001 
Reviewed-by: @zhuchunyi 
Signed-off-by: @zhuchunyi
2022-04-18 01:43:21 +00:00
shixuantong
0bfdc16236 update version to 9.21.7 2022-04-18 09:08:55 +08:00
openeuler-ci-bot
c19acd4f4e
!84 Add new features
Merge pull request !84 from SandMan/openEuler-22.03-LTS-Next
2022-01-27 01:37:20 +00:00
weiwei_tiantian
da3cc6e8db Add new features 2022-01-25 16:46:53 +08:00
13 changed files with 1418 additions and 136 deletions

View File

@ -1,108 +0,0 @@
From 575f7788f2af100d7cc1e102637d3a8653caceea Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marcus=20Sch=C3=A4fer?= <ms@suse.de>
Date: Tue, 11 Aug 2020 11:54:50 +0200
Subject: [PATCH] Simplify build_status helper
Instead of a static list with all integration test build names
only maintain a list of integration test build project names
---
helper/build_status.sh | 86 +++++++++++++++++++++---------------------
1 file changed, 43 insertions(+), 43 deletions(-)
diff --git a/helper/build_status.sh b/helper/build_status.sh
index 670c5b161f..ef93ee847c 100755
--- a/helper/build_status.sh
+++ b/helper/build_status.sh
@@ -1,49 +1,49 @@
#!/bin/bash
-for image in \
- Virtualization:Appliances:Images:Testing_x86:suse/test-image-azure \
- Virtualization:Appliances:Images:Testing_x86:suse/test-image-docker \
- Virtualization:Appliances:Images:Testing_x86:suse/test-image-docker-derived\
- Virtualization:Appliances:Images:Testing_x86:suse/test-image-ec2 \
- Virtualization:Appliances:Images:Testing_x86:suse/test-image-gce \
- Virtualization:Appliances:Images:Testing_x86:suse/test-image-iso \
- Virtualization:Appliances:Images:Testing_x86:suse/test-image-luks \
- Virtualization:Appliances:Images:Testing_x86:suse/test-image-MicroOS \
- Virtualization:Appliances:Images:Testing_x86:suse/test-image-oem \
- Virtualization:Appliances:Images:Testing_x86:suse/test-image-oem-legacy \
- Virtualization:Appliances:Images:Testing_x86:suse/test-image-orthos-oem \
- Virtualization:Appliances:Images:Testing_x86:suse/test-image-overlayroot \
- Virtualization:Appliances:Images:Testing_x86:suse/test-image-pxe \
- Virtualization:Appliances:Images:Testing_x86:suse/test-image-qcow-openstack\
- Virtualization:Appliances:Images:Testing_x86:suse/test-image-tbz \
- Virtualization:Appliances:Images:Testing_x86:suse/test-image-vmx \
- Virtualization:Appliances:Images:Testing_x86:suse/test-image-vmx-lvm \
- Virtualization:Appliances:Images:Testing_x86:suse/test-image-custom-partitions \
- Virtualization:Appliances:Images:Testing_x86:centos/test-image-iso-oem-vmx \
- Virtualization:Appliances:Images:Testing_x86:fedora/test-image-iso-oem-vmx \
- Virtualization:Appliances:Images:Testing_x86:ubuntu/test-image-iso-oem-vmx \
- Virtualization:Appliances:Images:Testing_s390:suse/test-image-oem \
- Virtualization:Appliances:Images:Testing_s390:suse/test-image-vmx \
- Virtualization:Appliances:Images:Testing_arm:suse/test-image-iso \
- Virtualization:Appliances:Images:Testing_arm:suse/test-image-rpi-oem \
- Virtualization:Appliances:Images:Testing_arm:fedora/test-image-iso \
- Virtualization:Appliances:Images:Testing_ppc:suse/test-image-vmx \
- Virtualization:Appliances:Images:Testing_ppc:fedora/test-image-vmx \
- Virtualization:Appliances:Images:Testing_x86:archlinux/test-image-iso-oem-vmx-kis
+for project in \
+ Virtualization:Appliances:Images:Testing_x86:suse \
+ Virtualization:Appliances:Images:Testing_x86:centos \
+ Virtualization:Appliances:Images:Testing_x86:fedora \
+ Virtualization:Appliances:Images:Testing_x86:ubuntu \
+ Virtualization:Appliances:Images:Testing_s390:suse \
+ Virtualization:Appliances:Images:Testing_arm:suse \
+ Virtualization:Appliances:Images:Testing_arm:fedora \
+ Virtualization:Appliances:Images:Testing_ppc:suse \
+ Virtualization:Appliances:Images:Testing_ppc:fedora \
+ Virtualization:Appliances:Images:Testing_x86:archlinux
do
- project=$(echo "${image}" | cut -f1 -d/)
- package=$(echo "${image}" | cut -f2 -d/)
- if [ "${project_last}" != "${project}" ];then
- echo
- echo "$project"
- fi
- echo "${package}"
- osc -A https://api.opensuse.org \
- results "${project}" "${package}"
- if [ "$1" = "refresh" ];then
- echo -n "[refresh requested: ]"
+ echo "${project}"
+ if [ ! "$1" = "refresh" ];then
osc -A https://api.opensuse.org \
- service remoterun "${project}" "${package}"
+ 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
+ echo -n "[refresh requested for ${package}: ]"
+ osc -A https://api.opensuse.org \
+ service remoterun "${project}" "${package}"
+ fi
+ done
+ echo
fi
- project_last="${project}"
done
+
+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
+ ? buildstatus not available
+EOF
+fi

View File

@ -3,8 +3,10 @@ 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 +
@ -12,10 +14,10 @@ supported package manager
3 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/kiwi/schema/kiwi.rnc b/kiwi/schema/kiwi.rnc
index a9dc8d22c7..35f8750cb1 100644
index 2e296fe..03bfffe 100644
--- a/kiwi/schema/kiwi.rnc
+++ b/kiwi/schema/kiwi.rnc
@@ -812,7 +812,7 @@ div {
@@ -793,7 +793,7 @@ div {
#
div {
k.packagemanager.content =
@ -25,10 +27,10 @@ index a9dc8d22c7..35f8750cb1 100644
k.packagemanager =
## Name of the Package Manager
diff --git a/kiwi/schema/kiwi.rng b/kiwi/schema/kiwi.rng
index 270e2eaa83..3d2a12595c 100644
index daaca9e..11a83aa 100644
--- a/kiwi/schema/kiwi.rng
+++ b/kiwi/schema/kiwi.rng
@@ -1250,6 +1250,7 @@ the device is looked up in /dev/disk/by-* and /dev/mapper/*</a:documentation>
@@ -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>
@ -37,7 +39,7 @@ index 270e2eaa83..3d2a12595c 100644
</choice>
</define>
diff --git a/kiwi/xml_parse.py b/kiwi/xml_parse.py
index 79b52455f3..3f103b7655 100644
index d5677a5..43ccc0d 100644
--- a/kiwi/xml_parse.py
+++ b/kiwi/xml_parse.py
@@ -730,6 +730,7 @@ class k_packagemanager_content(object):
@ -46,4 +48,8 @@ index 79b52455f3..3f103b7655 100644
DNF='dnf'
+ MICRODNF='microdnf'
PACMAN='pacman'
--
2.33.0

View File

@ -9,7 +9,7 @@ Show disabled integration test builds with a clear indicator
1 file changed, 15 insertions(+), 13 deletions(-)
diff --git a/helper/build_status.sh b/helper/build_status.sh
index 09af11c964..c740700076 100755
index 09af11c..c740700 100755
--- a/helper/build_status.sh
+++ b/helper/build_status.sh
@@ -23,9 +23,11 @@ do
@ -29,18 +29,18 @@ index 09af11c964..c740700076 100755
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
- 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
@ -56,3 +56,6 @@ index 09af11c964..c740700076 100755
? buildstatus not available
EOF
fi
--
2.33.0

View File

@ -0,0 +1,68 @@
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

@ -0,0 +1,362 @@
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.21.7.tar.gz Normal file

Binary file not shown.

View File

@ -1,20 +1,23 @@
%{?python_enable_dependency_generator}
Name: kiwi
Version: 9.21.5
Release: 2
Version: 9.21.7
Release: 4
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: Added-microdnf-support-in-XML-schema.patch
Patch1: Simplify-build_status-helpe.patch
Patch2: Include-box-plugin-images-to-build_status.patch
Patch3: Added-s390-SLE15-integration-tests.patch
Patch4: Cosmetic-update-for-build-status-helper.patch
Patch5: Added-universal-box-to-build-status-helper.patch
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
BuildRequires: bash-completion dracut fdupes gcc make
BuildRequires: python3-devel python3-setuptools shadow-utils
@ -40,7 +43,7 @@ Requires: yum
Provides: %{name}-packagemanager:yum
Requires: device-mapper-multipath dosfstools e2fsprogs
Requires: xorriso gdisk lvm2 mtools parted
Requires: gdisk lvm2 mtools parted
Requires: qemu-img rsync squashfs-tools tar >= 1.2.7
Requires: %{name}-tools = %{version}-%{release}
%ifarch x86_64
@ -196,6 +199,30 @@ done
%{_mandir}/man8/%{name}*
%changelog
* Thu Jan 12 2023 Chenxi Mao <chenxi.mao@suse.com>> - 9.21.7-4
- Type:bugfix
- ID:NA
- SUG:NA
- DESC: Support UEFI on ARM64 platform.
* Wed Jun 29 2022 tianwei <tianwei12@h-partners.com>> - 9.21.7-3
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:Delete xorriso dependencies
* Wed Apr 27 2022 shixuantong <shixuantong@h-partners.com> - 9.21.7-2
- add release for rebuild
* Sat Apr 16 2022 shixuantong <shixuantong@h-partners.com> - 9.21.7-1
- update version to 9.21.7
* Sat Jan 22 2022 liudabo <liudabo1@huawei.com> - 9.21.5-3
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:Add new features
* Thu Nov 26 2020 wuchaochao <wuchaochao4@huawei.com> - 9.21.5-2
- Type:bugfix
- ID:NA

898
openEuler-custom-make.patch Normal file
View File

@ -0,0 +1,898 @@
diff --git a/kiwi/archive/cpio.py b/kiwi/archive/cpio.py
index 27d596c..f147aa1 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/>
#
# project
+from kiwi.runtime_config import RuntimeConfig
from kiwi.command import Command
+import os
+import logging
+
+log = logging.getLogger('kiwi')
class ArchiveCpio:
"""
@@ -27,6 +32,7 @@ class ArchiveCpio:
"""
def __init__(self, filename):
self.filename = filename
+ self.runtime_config = RuntimeConfig()
def create(self, source_dir, exclude=None):
"""
@@ -35,6 +41,62 @@ class ArchiveCpio:
:param string source_dir: data source directory
:param list exclude: list of excluded items
"""
+ if self.runtime_config.get_custom_hw_systemflag():
+ delete_list = ['vmlinuz*', 'initrd*', 'initramfs*', 'grub']
+ for delete_file in delete_list:
+ rm_boot_cmd = 'rm -rf '+ source_dir + '/boot/' + delete_file
+ os.system(rm_boot_cmd)
+ sec_flag = "false"
+ pwd = os.getcwd()
+ secDir = pwd + '/kiwi/eulerlinuxiso/'
+ secfile = secDir + 'security_s.conf'
+ if os.path.isfile(secfile):
+ sec_flag = "true"
+ log.info('Starting to do security hardening...')
+ sec_com = pwd + '/security-tool/sysenhance.sh -s -c ' + pwd + '/security-tool/security.conf -u ' + secfile + ' -d ' + source_dir
+ sec_com = 'sh '+ sec_com + ' -l /tmp/sysenhance.log > /tmp/sysenhancelog 2>&1'
+ os.system(sec_com)
+ Command.run(
+ ['rm', '-f', secfile]
+ )
+ log.info("Security hardening log file at /tmp/sysenhance.log")
+ else:
+ log.info("Skip security hardening...")
+
+ if self.runtime_config.get_custom_hw_release_type() == 'TAR':
+ resolve_file = secDir + 'resolve.sh'
+ change_uid_files = source_dir + '/usr/openEuler/conf/change_uid_files'
+ change_gid_files = source_dir + '/usr/openEuler/conf/change_gid_files'
+ if os.path.isfile(resolve_file):
+ log.info('Starting to resolve none-owner problem...')
+ Command.run(
+ ['cp', resolve_file, source_dir + '/tmp']
+ )
+ Command.run(
+ ['chmod', 'u+x', source_dir + '/tmp/resolve.sh']
+ )
+ Command.run(
+ ['chroot', source_dir, '/tmp/resolve.sh']
+ )
+ Command.run(
+ ['rm', '-f', source_dir + '/tmp/resolve.sh']
+ )
+ if not os.path.isfile(change_uid_files) or not os.path.isfile(change_gid_files):
+ log.info('Failed to Resolve the non-owner problem...')
+ else:
+ log.info("Skip resolve none-owner...")
+
+ if self.runtime_config.get_custom_hw_systemflag():
+ find_command = ['cd', source_dir, '&&', 'find', '.']
+ cpio_command = [
+ 'cpio', '-H', 'newc', '--create', '--quiet', '|', 'pigz', '-9', '>', self.filename
+ ]
+ bash_command = find_command + ['|'] + cpio_command + ['&&'] + ['cd -']
+ Command.run(
+ ['bash', '-c', ' '.join(bash_command)]
+ )
+ return
+
find_excludes = []
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
--- a/kiwi/boot/image/builtin_kiwi.py
+++ b/kiwi/boot/image/builtin_kiwi.py
@@ -29,6 +29,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
+from kiwi.runtime_config import RuntimeConfig
log = logging.getLogger('kiwi')
@@ -79,6 +80,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()
- 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):
options=['-a']
)
boot_directory = temp_boot_root_directory + '/boot'
- Path.wipe(boot_directory)
- if mbrid:
- log.info(
- '--> Importing mbrid: %s', mbrid.get_id()
- )
- 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:
+ log.info(
+ '--> Importing mbrid: %s', mbrid.get_id()
+ )
+ Path.create(boot_directory)
+ image_identifier = boot_directory + '/mbrid'
+ mbrid.write(image_identifier)
cpio = ArchiveCpio(
os.sep.join([self.target_dir, kiwi_initrd_basename])
@@ -159,19 +167,34 @@ 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
- exclude_from_archive = [
- '/' + Defaults.get_shared_cache_location(),
- '/image', '/usr/lib/grub*'
- ]
+ if self.runtime_config.get_custom_hw_systemflag():
+ exclude_from_archive = [
+ '/' + Defaults.get_shared_cache_location(),
+ '/image'
+ ]
+ else:
+ exclude_from_archive = [
+ '/' + 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
- 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'
+ ]
cpio.create(
source_dir=temp_boot_root_directory,
exclude=exclude_from_archive
)
+ if self.runtime_config.get_custom_hw_systemflag():
+ self.initrd_filename = kiwi_initrd_basename
+ return
log.info(
'--> xz compressing archive'
)
diff --git a/kiwi/builder/kis.py b/kiwi/builder/kis.py
index ea33c6a..542a345 100644
--- a/kiwi/builder/kis.py
+++ b/kiwi/builder/kis.py
@@ -132,25 +132,27 @@ class KisBuilder:
self.system_setup.export_modprobe_setup(
self.boot_image_task.boot_root_directory
)
-
- # extract kernel from boot(initrd) root system
- kernel = Kernel(self.boot_image_task.boot_root_directory)
- kernel_data = kernel.get_kernel()
- if kernel_data:
- self.kernel_filename = ''.join(
- [
- os.path.basename(self.image_name), '-',
- kernel_data.version, '.kernel'
- ]
- )
- kernel.copy_kernel(
- self.target_dir, self.kernel_filename
- )
+ if self.runtime_config.get_custom_hw_product_type() == 'DPROJ':
+ log.info('Skin copy kernel for DPROJ')
else:
- raise KiwiKisBootImageError(
- 'No kernel in boot image tree %s found' %
- self.boot_image_task.boot_root_directory
- )
+ # extract kernel from boot(initrd) root system
+ kernel = Kernel(self.boot_image_task.boot_root_directory)
+ kernel_data = kernel.get_kernel()
+ if kernel_data:
+ self.kernel_filename = ''.join(
+ [
+ os.path.basename(self.image_name), '-',
+ kernel_data.version, '.kernel'
+ ]
+ )
+ kernel.copy_kernel(
+ self.target_dir, self.kernel_filename
+ )
+ else:
+ raise KiwiKisBootImageError(
+ 'No kernel in boot image tree %s found' %
+ self.boot_image_task.boot_root_directory
+ )
# extract hypervisor from boot(initrd) root system
if self.xen_server:
@@ -187,6 +189,8 @@ class KisBuilder:
cmdline += ' {}'.format(self.custom_cmdline)
with open(self.append_file, 'w') as append:
append.write(cmdline)
+ if self.runtime_config.get_custom_hw_systemflag():
+ return self.result
# 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
--- 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 {
baseStripAndKeep "${keepLocales}"
}
+#======================================
+# baseStripGconv
+#--------------------------------------
+function baseStripGconv {
+ local keepGconv="$@"
+
+ find /usr/lib/gconv -mindepth 1 -maxdepth 1 -type f 2>/dev/null |\
+ baseStripAndKeep ${keepGconv}
+
+ find /usr/lib64/gconv -mindepth 1 -maxdepth 1 -type f 2>/dev/null |\
+ baseStripAndKeep ${keepGconv}
+}
+
#======================================
# baseStripTranslations
#--------------------------------------
function baseStripTranslations {
- local keepMatching="$*"
- find /usr/share/locale -name "*.mo" |\
- grep -v "${keepMatching}" | xargs rm -f
+ local keepMatching="$@"
+ 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 {
local needlibs
local found
local dir
+ local lnk
+ local new
local lib
local lddref
# /.../
@@ -525,33 +654,33 @@ function baseStripUnusedLibs {
# on files in *bin*
# ---
ldconfig
- rm -f /tmp/needlibs
- for i in /usr/bin/* /bin/* /sbin/* /usr/sbin/* /lib/systemd/systemd-*;do
- for n in $(ldd "$i" 2>/dev/null | cut -f2- -d "/" | cut -f1 -d " ");do
- if [ ! -e "/$n" ];then
+ rm -f /opt/needlibs
+ for i in /usr/bin/* /bin/* /sbin/* /usr/sbin/*;do
+ for n in $(ldd $i 2>/dev/null | cut -f2- -d\/ | cut -f1 -d " ");do
+ if [ ! -e /$n ];then
continue
fi
- lddref="/$n"
+ lddref=/$n
while true;do
- if lib=$(readlink "${lddref}"); then
- lddref="${lib}"
+ lib=$(readlink $lddref)
+ if [ $? -eq 0 ];then
+ lddref=$lib
continue
fi
break
done
- lddref=$(basename "${lddref}")
- echo "${lddref}" >> /tmp/needlibs
+ lddref=$(basename $lddref)
+ echo $lddref >> /opt/needlibs
done
done
count=0
- for i in $(sort /tmp/needlibs | uniq);do
+ for i in `cat /opt/needlibs | sort | uniq`;do
for d in \
/lib /lib64 /usr/lib /usr/lib64 \
- /usr/X11R6/lib /usr/X11R6/lib64 \
- /lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu
+ /usr/X11R6/lib /usr/X11R6/lib64
do
if [ -e "$d/$i" ];then
- needlibs[${count}]="$d/$i"
+ needlibs[$count]=$d/$i
count=$((count + 1))
fi
done
@@ -559,46 +688,42 @@ 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"* \
- /usr/X11R6/lib*/"$libname"*
- do
- if [ -e "$libfile" ];then
- needlibs[$count]=$libfile
- count=$((count + 1))
+ while [ ! -z $1 ];do
+ for i in /lib*/$1* /usr/lib*/$1* /usr/X11R6/lib*/$1*;do
+ if [ -e $i ];then
+ needlibs[$count]=$i
+ count=`expr $count + 1`
fi
done
+ shift
done
# /.../
# find unused libs and remove it, dl loaded libs
# seems not to be that important within the initrd
# ----
- rm -f /tmp/needlibs
+ rm -f /opt/needlibs
for i in \
/lib/lib* /lib64/lib* /usr/lib/lib* \
- /usr/lib64/lib* /usr/X11R6/lib*/lib* \
- /lib/x86_64-linux-gnu/lib* /usr/lib/x86_64-linux-gnu/lib*
+ /usr/lib64/lib* /usr/X11R6/lib*/lib*
do
found=0
- if [ ! -e "$i" ];then
+ if [ ! -e $i ];then
continue
fi
- if [ -d "$i" ];then
+ if [ -d $i ];then
continue
fi
- if [ -L "$i" ];then
+ if [ -L $i ];then
+ continue
continue
fi
for n in ${needlibs[*]};do
- if [ "$i" = "$n" ];then
+ if [ $i = $n ];then
found=1; break
fi
done
- if [ "${found}" -eq 0 ];then
- echo "Removing library: $i"
- rm "$i"
+ if [ $found -eq 0 ];then
+ rm_isnot_usrfile $i
fi
done
}
@@ -622,60 +747,144 @@ function baseUpdateSysConfig {
fi
}
+#find all need tool which ÃüÁîÒ»¶¨ÓÐ
+function baseStripAllTools {
+ local needtools=$1
+ local newneedtools=
+ local cmdfile
+ local count=0
+ for need in $needtools;do
+ cmdfile=$(which $need)
+ if [ $? -eq 0 ];then
+ newneedtools[$count]=$(basename $cmdfile)
+ count=$((count + 1))
+ while true;do
+ needtool=$(readlink $cmdfile)
+ if [ $? -eq 0 ];then
+ newneedtools[$count]=$(basename $needtool)
+ count=$((count + 1))
+ cmdfile=$needtool
+ continue
+ fi
+ newneedtools[$count]=$(basename $cmdfile)
+ count=$((count + 1))
+ break
+ done
+
+ fi
+ done
+
+ for path in /sbin /usr/sbin /usr/bin /bin;do
+ baseStripTools "$path" "${newneedtools[*]}"
+ done
+
+}
+
#======================================
-# baseStripInitrd
+# 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
+ for path in /etc /lib /lib64 /usr /var;do
+ find $path -type l -follow -exec ls {} \; | while read link_file
+ do
+ ls -l $link_file | grep -E "/proc|fd/" 1>/dev/null 2>&1
+ [ $? != 0 ] && rm -f $link_file
+ done
+ done
+}
+
+#======================================
+# suseStripInitrd
+#--------------------------------------
+function suseStripInitrd {
#==========================================
- # Check for initrd system
+ # Remove unneeded files
#------------------------------------------
- if [ "${kiwi_initrd_system}" = "dracut" ]; then
- echo "dracut initrd system requested, initrd strip skipped"
- 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
+ baseStripAllTools "$tools"
+
+ #create busybox cmd link
+ baseSetupBusyBox -f
+
#==========================================
# 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"
- done
-}
+ rm -f /image/images.sh
+ #==========================================
+ # remove unused root directories
+ #------------------------------------------
+ #rm -rf /root
+ #rm -rf /home
+ #rm -rf /media
+ #rm -rf /srv
+ #==========================================
+ # remove unused doc directories
+ #------------------------------------------
+ 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
+ Rpm -e --nodeps --noscripts $i
+ else
+ echo ${i} | tee -a /var/log/cancel_uninstallrpm
+ chmod 640 /var/log/cancel_uninstallrpm
+ fi
+ done
+
+ if [ "$sys_cut" = "yes" ];then
+
+ #zypper#
+ Rpm -e --nodeps zypper libzypp satsolver-tools
+
+ #smart
+ Rpm -e --nodeps smart smart-gui
+
+ Rpm -e --nodeps rpm
+
+ for p in dpkg rpm smart zypp YaST2;do
+ 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 {
if [[ ${file} =~ ${mod} ]] && [[ ! ${file} =~ "updates" ]];then
echo "baseStripModules: Update driver found for ${mod}"
echo "baseStripModules: Removing old version: ${file}"
- rm -f "${file}"
+ rm_isnot_usrfile $file
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 {
if [ "${kiwi_initrd_system}" = "dracut" ]; then
echo "dracut initrd system requested, kernel strip skipped"
else
- for delete in ${kiwi_strip_delete};do
- echo "Removing file/directory: ${delete}"
- rm -rf "${delete}"
- done
baseCreateKernelTree
baseStripKernelModules
baseFixupKernelModuleDependencies
@@ -1001,14 +1214,7 @@ function suseStripKernel {
# rhelStripKernel
#--------------------------------------
function rhelStripKernel {
- baseStripKernel
-}
-
-#======================================
-# debianStripKernel
-#--------------------------------------
-function debianStripKernel {
- baseStripKernel
+ suseStripKernel
}
#======================================
@@ -1160,4 +1366,18 @@ function baseQuoteFile {
mv "${conf}" "${file}"
}
-# vim: set noexpandtab:
+function rm_isnot_usrfile {
+ local rm_file=$1
+ local usrrpm_filelst='/opt/usrrpm_filelst'
+ if [ -f $usrrpm_filelst ];then
+ grep -q ^${rm_file}$ $usrrpm_filelst
+ if [ $? -eq 0 ];then
+ return 0
+ fi
+ fi
+
+ echo "Removing file: $rm_file"
+ rm -rf ${rm_file}
+
+ return 0
+}
diff --git a/kiwi/path.py b/kiwi/path.py
index b763211..b2ce909 100644
--- a/kiwi/path.py
+++ b/kiwi/path.py
@@ -150,7 +150,7 @@ class Path:
)
path_elements = path.split(os.sep)
protected_elements = [
- 'boot', 'dev', 'proc', 'run', 'sys', 'tmp', 'home', 'mnt'
+ 'boot', 'dev', 'proc', 'run', 'sys', 'tmp', 'home', 'mnt', 'opt', 'var', 'bin', 'sbin', 'etc', 'lib', 'root', 'tmp'
]
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
--- a/kiwi/runtime_config.py
+++ b/kiwi/runtime_config.py
@@ -259,6 +259,56 @@ class RuntimeConfig:
)
return disabled_checks or ''
+ def get_custom_hw_systemflag(self):
+ """
+ Returns custom_hw SYSTEMFLAG
+
+ """
+ hw_systemflag = self._get_attribute(
+ element='custom_hw', attribute='SYSTEMFLAG'
+ )
+ return hw_systemflag or None
+
+ def get_custom_hw_product_type(self):
+ """
+ Returns custom_hw PRODUCT_TYPE
+
+ """
+ hw_product_type = self._get_attribute(
+ element='custom_hw', attribute='PRODUCT_TYPE'
+ )
+ return hw_product_type or None
+
+ def get_custom_hw_release_type(self):
+ """
+ Returns custom_hw RELEASE_TYPE
+
+ """
+ hw_release_type = self._get_attribute(
+ element='custom_hw', attribute='RELEASE_TYPE'
+ )
+ return hw_release_type or None
+
+ def get_custom_hw_relese_bootloader_type(self):
+ """
+ Returns custom_hw RELEASE_BOOTLOADER_TYPE
+
+ """
+ hw_relese_bootloader_type = self._get_attribute(
+ element='custom_hw', attribute='RELEASE_BOOTLOADER_TYPE'
+ )
+ return hw_relese_bootloader_type or None
+
+ def get_custom_hw_release_iso_cmdline(self):
+ """
+ Returns custom_hw RELEASE_ISO_CMDLINE
+
+ """
+ hw_relese_iso_cmdline = self._get_attribute(
+ element='custom_hw', attribute='RELEASE_ISO_CMDLINE'
+ )
+ return hw_relese_iso_cmdline or None
+
def _get_attribute(self, element, attribute):
if self.config_data:
try:
diff --git a/kiwi/tasks/base.py b/kiwi/tasks/base.py
index 90f7c45..426e79b 100644
--- a/kiwi/tasks/base.py
+++ b/kiwi/tasks/base.py
@@ -74,7 +74,6 @@ class CliTask:
'check_minimal_required_preferences': [],
'check_efi_mode_for_disk_overlay_correctly_setup': [],
'check_boot_description_exists': [],
- 'check_consistent_kernel_in_boot_and_system_image': [],
'check_container_tool_chain_installed': [],
'check_volume_setup_defines_reserved_labels': [],
'check_volume_setup_defines_multiple_fullsize_volumes': [],
--
2.33.0

View File

@ -0,0 +1,26 @@
diff --git a/kiwi/boot/image/builtin_kiwi.py b/kiwi/boot/image/builtin_kiwi.py
index 1e8a3b4..8ac574a 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()
--
2.23.0