forked from pool/mkosi
- Create new subpackage mkosi-initrd-tukit.
* This package adds a special mkosi-initrd wrapper to support creating initrds on transactional systems. I.e., with transactional-update, a transaction runs on a chroot, but mkosi requires bubblewrap, which uses pivot_root, and that is known to fail on a chroot environment. - Do not install 50-mkosi.install kernel-install script. * Although kernel-install is provided in openSUSE, it is not run when a kernel is installed or removed (this work is done by suse-module-tools). Also, even calling it manually, it does not support the custom systemd-boot integration in openSUSE. OBS-URL: https://build.opensuse.org/package/show/Virtualization/mkosi?expand=0&rev=43
This commit is contained in:
commit
019f4d9e73
23
.gitattributes
vendored
Normal file
23
.gitattributes
vendored
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
## Default LFS
|
||||||
|
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.bsp filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.gem filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.jar filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.lz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.lzma filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.obscpio filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.oxt filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pdf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.png filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.rpm filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tbz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tbz2 filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.ttf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.txz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.whl filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.zst filter=lfs diff=lfs merge=lfs -text
|
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
.osc
|
3
mkosi-23.1.tar.gz
Normal file
3
mkosi-23.1.tar.gz
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:116bd3d848ce767a584ce288ad5a098a47d42067c9b95aa5a6662de33dc04eb9
|
||||||
|
size 337863
|
3
mkosi-24.3.tar.gz
Normal file
3
mkosi-24.3.tar.gz
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:27e4ee602089509c20d41e6deabae906368dcdc906e44460656272f546b8e2bd
|
||||||
|
size 349900
|
12
mkosi-initrd-chroot.sh
Normal file
12
mkosi-initrd-chroot.sh
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
__mkosi_initrd_chroot_call() {
|
||||||
|
mount --rbind / /.mkosi-root --mkdir
|
||||||
|
cd /.mkosi-root
|
||||||
|
mount --move . /
|
||||||
|
chroot . /usr/libexec/mkosi-initrd/mkosi-initrd $@
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
export -f __mkosi_initrd_chroot_call
|
||||||
|
|
||||||
|
unshare --mount /bin/bash -c '__mkosi_initrd_chroot_call $@' -- $@
|
59
mkosi-initrd.conf
Normal file
59
mkosi-initrd.conf
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
[Content]
|
||||||
|
RemoveFiles=
|
||||||
|
/etc/bash_completion.d
|
||||||
|
/etc/man.conf
|
||||||
|
/srv
|
||||||
|
/usr/local/man
|
||||||
|
/usr/share/bash-completion
|
||||||
|
/usr/share/bash/helpfiles
|
||||||
|
/usr/share/doc
|
||||||
|
/usr/share/fillup-templates
|
||||||
|
/usr/share/help
|
||||||
|
/usr/share/icons
|
||||||
|
/usr/share/info
|
||||||
|
/usr/share/licenses
|
||||||
|
/usr/share/locale
|
||||||
|
/usr/share/man
|
||||||
|
/usr/share/zsh
|
||||||
|
/usr/etc/services
|
||||||
|
/var/adm
|
||||||
|
|
||||||
|
# Keep only C.utf-8 locale
|
||||||
|
/usr/lib/locale/*_*/
|
||||||
|
/usr/lib/locale/??/
|
||||||
|
/usr/lib/locale/???/
|
||||||
|
|
||||||
|
# RPM
|
||||||
|
/etc/rpm
|
||||||
|
/usr/bin/gendiff
|
||||||
|
/usr/bin/rpm*
|
||||||
|
/usr/lib/rpm
|
||||||
|
/usr/lib/sysimage
|
||||||
|
/usr/lib/systemd/system/rpmconfigcheck.service
|
||||||
|
/usr/lib64/rpm-plugins
|
||||||
|
/usr/sbin/rpmconfigcheck
|
||||||
|
/usr/src/packages
|
||||||
|
|
||||||
|
# Zypper
|
||||||
|
/etc/zypp
|
||||||
|
/usr/bin/installation_sources
|
||||||
|
/usr/bin/yzpper
|
||||||
|
/usr/bin/zypper
|
||||||
|
/usr/etc/logrotate.d/zypp*
|
||||||
|
/usr/lib/zypper
|
||||||
|
/usr/sbin/zypp-refresh
|
||||||
|
/usr/share/zypper
|
||||||
|
/var/log/zypp
|
||||||
|
/var/log/zypper.log
|
||||||
|
|
||||||
|
# YaST2
|
||||||
|
/etc/YaST2
|
||||||
|
|
||||||
|
# suse-module-tools scripts (except unblacklist: bsc#1224320)
|
||||||
|
/usr/lib/module-init-tools/driver-check.sh
|
||||||
|
/usr/lib/module-init-tools/get_dracut_drivers
|
||||||
|
/usr/lib/module-init-tools/lsinitrd-quick
|
||||||
|
/usr/lib/module-init-tools/weak-modules2
|
||||||
|
|
||||||
|
# dracut modules installed by other packages
|
||||||
|
/usr/lib/dracut
|
1024
mkosi.changes
Normal file
1024
mkosi.changes
Normal file
File diff suppressed because it is too large
Load Diff
162
mkosi.spec
Normal file
162
mkosi.spec
Normal file
@ -0,0 +1,162 @@
|
|||||||
|
#
|
||||||
|
# spec file for package mkosi
|
||||||
|
#
|
||||||
|
# Copyright (c) 2024 SUSE LLC
|
||||||
|
#
|
||||||
|
# All modifications and additions to the file contributed by third parties
|
||||||
|
# remain the property of their copyright owners, unless otherwise agreed
|
||||||
|
# upon. The license for this file, and modifications and additions to the
|
||||||
|
# file, is the same license as for the pristine package itself (unless the
|
||||||
|
# license for the pristine package is not an Open Source License, in which
|
||||||
|
# case the license is the MIT License). An "Open Source License" is a
|
||||||
|
# license that conforms to the Open Source Definition (Version 1.9)
|
||||||
|
# published by the Open Source Initiative.
|
||||||
|
|
||||||
|
# Please submit bugfixes or comments via https://bugs.opensuse.org/
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
|
%define pythons python3
|
||||||
|
|
||||||
|
Name: mkosi
|
||||||
|
Version: 24.3
|
||||||
|
Release: 0
|
||||||
|
Summary: Build bespoke OS Images
|
||||||
|
License: LGPL-2.1-or-later
|
||||||
|
Group: System/Management
|
||||||
|
URL: https://github.com/systemd/mkosi
|
||||||
|
Source0: https://github.com/systemd/mkosi/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
|
||||||
|
Source1: mkosi-initrd.conf
|
||||||
|
Source2: mkosi-initrd-chroot.sh
|
||||||
|
BuildRequires: %{python_module pip}
|
||||||
|
BuildRequires: %{python_module pytest}
|
||||||
|
BuildRequires: %{python_module wheel}
|
||||||
|
BuildRequires: %{pythons}
|
||||||
|
BuildRequires: fdupes
|
||||||
|
BuildRequires: pandoc
|
||||||
|
BuildRequires: python-rpm-macros
|
||||||
|
Requires: bubblewrap
|
||||||
|
Requires: python3 >= 3.9
|
||||||
|
Requires: zypper
|
||||||
|
Recommends: btrfsprogs
|
||||||
|
Recommends: cpio
|
||||||
|
Recommends: dosfstools
|
||||||
|
Recommends: dpkg
|
||||||
|
Recommends: edk2-ovmf
|
||||||
|
Recommends: gnupg
|
||||||
|
Recommends: squashfs
|
||||||
|
Recommends: tar
|
||||||
|
Recommends: xz
|
||||||
|
Recommends: zstd
|
||||||
|
BuildArch: noarch
|
||||||
|
ExclusiveArch: x86_64 aarch64
|
||||||
|
|
||||||
|
%description
|
||||||
|
A fancy wrapper around "dnf --installroot", "apt", "pacman", and "zypper" that
|
||||||
|
generates disk images with a number of bells and whistles.
|
||||||
|
|
||||||
|
Generated images are tailored to the purpose: GPT partitions,
|
||||||
|
systemd-boot or grub2, images for containers, VMs, initrd, and extensions.
|
||||||
|
|
||||||
|
mkosi can boot an image via QEMU or systemd-nspawn, or simply start a shell in
|
||||||
|
chroot, burn the image to a device, connect to a running VM via ssh, extract
|
||||||
|
logs and coredumps, and also serve an image over HTTP.
|
||||||
|
|
||||||
|
See https://mkosi.systemd.io/ for documentation.
|
||||||
|
|
||||||
|
%package initrd
|
||||||
|
Summary: Build initrds locally using mkosi
|
||||||
|
Requires: %{name} = %{version}-%{release}
|
||||||
|
Requires: coreutils
|
||||||
|
Requires: (%{name}-initrd-tukit if read-only-root-fs)
|
||||||
|
|
||||||
|
%description initrd
|
||||||
|
This package provides the mkosi-initrd wrapper to build initrds with mkosi
|
||||||
|
locally.
|
||||||
|
|
||||||
|
%package initrd-tukit
|
||||||
|
Summary: Build initrds locally using mkosi with transactional updates
|
||||||
|
Requires: %{name} = %{version}-%{release}
|
||||||
|
Requires: read-only-root-fs
|
||||||
|
|
||||||
|
%description initrd-tukit
|
||||||
|
mkosi calls bwrap, and that does not work with transactional updates, so this
|
||||||
|
package provides a special mkosi-initrd wrapper to support building initrds on
|
||||||
|
transactional systems.
|
||||||
|
|
||||||
|
%prep
|
||||||
|
%autosetup -p1
|
||||||
|
|
||||||
|
%build
|
||||||
|
tools/make-man-page.sh
|
||||||
|
%pyproject_wheel
|
||||||
|
|
||||||
|
%install
|
||||||
|
%pyproject_install
|
||||||
|
%python_expand %fdupes %{buildroot}/%{$python_sitelib}/mkosi
|
||||||
|
|
||||||
|
mkdir -p %{buildroot}%{_mandir}/man1
|
||||||
|
cp %{buildroot}%{python3_sitelib}/mkosi/resources/mkosi.1* %{buildroot}%{_mandir}/man1/
|
||||||
|
cp %{buildroot}%{python3_sitelib}/mkosi/initrd/resources/mkosi-initrd.1* %{buildroot}%{_mandir}/man1/
|
||||||
|
|
||||||
|
# Install mkosi-initrd conf
|
||||||
|
mkdir -p %{buildroot}%{_prefix}/lib/mkosi-initrd
|
||||||
|
install -m 644 %{SOURCE1} %{buildroot}%{_prefix}/lib/mkosi-initrd/mkosi.conf
|
||||||
|
mkdir -p %{buildroot}%{_sysconfdir}/mkosi-initrd
|
||||||
|
|
||||||
|
# Install the tukit script
|
||||||
|
mkdir -p %{buildroot}%{_prefix}/libexec/mkosi-initrd
|
||||||
|
install -m 744 %{SOURCE2} %{buildroot}%{_prefix}/libexec/mkosi-initrd/mkosi-initrd-chroot.sh
|
||||||
|
|
||||||
|
%post initrd
|
||||||
|
if [ ! -e %{_sysconfdir}/mkosi-initrd/mkosi.conf ]; then
|
||||||
|
cat >> %{_sysconfdir}/mkosi-initrd/mkosi.conf<<EOF
|
||||||
|
# Write here your own configuration.
|
||||||
|
# See man mkosi(1) for details.
|
||||||
|
[Content]
|
||||||
|
#ExtraTrees=
|
||||||
|
#KernelModulesInclude=
|
||||||
|
#KernelModulesExclude=
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
|
||||||
|
%posttrans initrd-tukit
|
||||||
|
# mkosi runs in a sandbox, and for that purpose it relies on bubblewrap. The
|
||||||
|
# problem is transactional-update chroots to a snapshot, and bubblewrap does not
|
||||||
|
# work there because it requires pivot_root:
|
||||||
|
# https://github.com/containers/bubblewrap/issues/135
|
||||||
|
# The issue is quite old, there is even a PR trying to fall back to chroot if
|
||||||
|
# pivot_root fails (https://github.com/containers/bubblewrap/pull/595), but
|
||||||
|
# apparently bubblewrap upstream is not trying to fix this.
|
||||||
|
# The workaround implemented in mkosi-initrd-chroot.sh was proposed by the main
|
||||||
|
# mkosi upstream maintainer:
|
||||||
|
# https://github.com/containers/bubblewrap/issues/592#issuecomment-2243087731
|
||||||
|
mv %{_bindir}/mkosi-initrd %{_prefix}/libexec/mkosi-initrd
|
||||||
|
ln -s %{_prefix}/libexec/mkosi-initrd/mkosi-initrd-chroot.sh %{_bindir}/mkosi-initrd
|
||||||
|
|
||||||
|
%preun initrd-tukit
|
||||||
|
rm -f %{_prefix}/libexec/mkosi-initrd/mkosi-initrd
|
||||||
|
|
||||||
|
%check
|
||||||
|
%pytest
|
||||||
|
|
||||||
|
%files
|
||||||
|
%doc mkosi.md README.md
|
||||||
|
%license LICENSE
|
||||||
|
%{_bindir}/mkosi
|
||||||
|
%{_mandir}/man1/mkosi.1*
|
||||||
|
%{python3_sitelib}/mkosi
|
||||||
|
%{python3_sitelib}/mkosi-%{version}.dist-info
|
||||||
|
|
||||||
|
%files initrd
|
||||||
|
%{_bindir}/mkosi-initrd
|
||||||
|
%{_mandir}/man1/mkosi-initrd.1*
|
||||||
|
%dir %{_prefix}/lib/mkosi-initrd
|
||||||
|
%{_prefix}/lib/mkosi-initrd/mkosi.conf
|
||||||
|
%dir %{_sysconfdir}/mkosi-initrd
|
||||||
|
|
||||||
|
%files initrd-tukit
|
||||||
|
%dir %{_prefix}/libexec/mkosi-initrd
|
||||||
|
%{_prefix}/libexec/mkosi-initrd/mkosi-initrd-chroot.sh
|
||||||
|
|
||||||
|
%changelog
|
Loading…
x
Reference in New Issue
Block a user