How to create a pattern?

I understand that Patterns are used to install a collection of software in a comfortable way, and a pattern contains group of software to install.
I would like to get information about how to create a pattern which contains several my RPMs. I want to include this pattern in autoinst.xml to install my RPMs.
Thanks in advance.

1 Like

Patterns appear to be built as part of the process by which the installation media is created. The canonical source is at Show system:install:head / patterns-base - openSUSE Build Service - the spec file shows how patterns are defined.

To understand more about how this is used to build your own custom media, though, you might need to ask on the development mailing list.

It will probably be easier just to add the individual packages to the autoinst.xml file directly - that’s my guess.

1 Like

Pattern is just a package that requires or recommends other packages, nothing more. If you want it to be listed as “pattern” in YaST/zypper, it needs special provides. Like

bor@leap15:~> rpm -q --provides patterns-xfce-xfce_office-20230212-lp155.1.4.x86_64
pattern() = xfce_office
pattern-category() = Graphical%20Environments
pattern-extends() = office
pattern-icon() = yast-x11
pattern-order() = 2241
patterns-openSUSE-xfce_office = 20230212
patterns-xfce-xfce_office = 20230212-lp155.1.4
patterns-xfce-xfce_office(x86-64) = 20230212-lp155.1.4

They are just normal packages on OBS.

1 Like

Patterns come with an associated package:

erlangen:~ # zypper se -is kde_plasma
Loading repository data...
Reading installed packages...

S  | Name                    | Type    | Version      | Arch   | Repository
i+ | kde_plasma              | pattern | 20230801-1.1 | noarch | Haupt-Repository (OSS)
i+ | patterns-kde-kde_plasma | package | 20230801-1.1 | noarch | Haupt-Repository (OSS)
erlangen:~ # 
erlangen:~ # rpm -ql patterns-kde-kde_plasma 
erlangen:~ # cat /usr/share/doc/packages/patterns/kde_plasma.txt
This file marks the pattern kde_plasma to be installed.
erlangen:~ # 

True, they install a package, but the definitions of what’s included in the pattern is actually in the spec file rather than in the package itself.

At least that’s what I’ve been able to determine - looking at, for example, the package “patterns-base-apparmor”, the only file in it is /usr/share/doc/packages/patterns/apparmor.txt, and it only contains the text “This file marks the pattern apparmor to be installed.”

All the logic for what’s included in the pattern is defined in that package’s spec file:

%package apparmor
Summary:        AppArmor
Group:          Metapackages
Provides:       pattern() = apparmor
Provides:       pattern-icon() = pattern-apparmor
Provides:       pattern-order() = 1100
Provides:       pattern-visible()
Requires:       apparmor-abstractions
Requires:       apparmor-parser
Requires:       apparmor-profiles
Requires:       pattern() = minimal_base
Recommends:     apparmor-docs
Recommends:     apparmor-utils
Recommends:     yast2-apparmor
Suggests:       pam_apparmor
%{obsolete_legacy_pattern apparmor}
%if 0%{?is_opensuse}
Requires:       audit
Recommends:     audit

%description apparmor
AppArmor is an application security framework that provides mandatory access control for programs. It protects from exploitation of software flaws and compromised systems. It offers an advanced tool set that automates the development of per-program application security without requiring additional knowledge.

%files apparmor
%dir %{_docdir}/patterns

(Edited to only show the pattern for apparmor; obviously the file is larger than just that one set of rules.)

If there’s any documentation on how to create your own patterns for the installer, I’ve not yet found them. Feel free, though, to point the OP at those instructions if you know where they are. :slight_smile:

1 Like

There is no such thing as “pattern for the installer”. There is pattern which is created like any normal package and has some special metadata to recognize it as pattern.

1 Like


SUSE Best Practices
Introduction to RPM Packaging

"Important: All Information Comes from the Installed Packages

Be aware that all those types mentioned (Patterns, Products, System) are only present at
solving time. Actually your system consists only of packages, and all information comes
from the installed packages. Every operation on patches, patterns and products result in
a package operation. The purpose behind is to make the package manager compatible
with the lower level rpm tool."

1 Like

To clarify, I mean “a pattern that’s displayed as a selection by the installer at installation time”. In the installer, you can select patterns, hence, a “pattern for the installer”. I thought that was clear from what I wrote, but apparently not - my apologies.

1 Like

Again - it is just a package. To add a package to the installation one needs additional repository (because you obviously cannot add package to the existing openSUSE repositories). At which point I would say listing the same packages in autoyast.xml becomes much easier.

1 Like

Definitely easier using autoyast.xml, and I would also agree that using a pattern doesn’t really make sense for this use case - just add all the packages in and save the step.

I was thinking that the system role selection screen was patterns, but it isn’t. If you go into the Software Selection during a regular installation, you also have the option to do Software Selection, and patterns are shown there; presumably if you have your own repo with a package that’s a pattern in it, that would show up there at install time.

OK, thanks for the explanation.

1 Like