almalinux-release/almalinux-release.spec

269 lines
11 KiB
RPMSpec
Raw Normal View History

2022-01-24 09:22:43 +00:00
%global distro AlmaLinux
2022-03-22 22:04:54 +00:00
%global release_name Emerald Puma
2022-01-24 09:22:43 +00:00
%global major 9
%global minor 0
2022-03-22 22:04:54 +00:00
%global beta Beta
2022-01-24 09:22:43 +00:00
Name: almalinux-release
Version: %{major}.%{minor}
Release: 1%{?dist}
Summary: %{distro} release files
License: GPLv2
URL: https://almalinux.org
2022-03-22 22:04:54 +00:00
# BuildArch: noarch
2022-01-24 09:22:43 +00:00
Provides: centos-release = %{version}-%{release}
Provides: centos-stream-release = %{version}-%{release}
# Required for a lorax run (to generate install media)
Requires: almalinux-repos = %{version}-%{release}
Provides: centos-release-eula
Provides: redhat-release-eula
# required by epel-release
Provides: redhat-release = %{version}-%{release}
# required by dnf
# https://github.com/rpm-software-management/dnf/blob/4.2.23/dnf/const.py.in#L26
Provides: system-release = %{version}-%{release}
Provides: system-release(releasever) = %{major}
# required by libdnf
# https://github.com/rpm-software-management/libdnf/blob/0.48.0/libdnf/module/ModulePackage.cpp#L472
Provides: base-module(platform:el%{major})
Source200: EULA
Source201: LICENSE
Source300: 85-display-manager.preset
Source301: 90-default.preset
Source302: 90-default-user.preset
Source303: 99-default-disable.preset
Source304: 50-redhat.conf
Source400: clsecureboot001.cer
# kernel signing certificate
Source401: clsecureboot001.cer
# grub2 signing certificate
Source402: clsecureboot001.cer
# Fwupd signing certificate
Source403: clsecureboot001.cer
Source500: almalinux.repo
Source501: almalinux-addons.repo
Source600: RPM-GPG-KEY-AlmaLinux-9
%package -n almalinux-sb-certs
Summary: %{distro} public secureboot certificates
Group: System Environment/Base
Provides: system-sb-certs = %{version}-%{release}
Provides: redhat-sb-certs = %{version}-%{release}
%package -n almalinux-repos
Summary: %{distro} package repositories
Requires: almalinux-release = %{version}-%{release}
Requires: almalinux-gpg-keys = %{version}-%{release}
%package -n almalinux-gpg-keys
Summary: %{distro} RPM keys
%description
%{distro} release files.
%description -n almalinux-sb-certs
%{distro} secureboot certificates
%description -n almalinux-repos
This package provides the package repository files for %{distro}.
%description -n almalinux-gpg-keys
This package provides the RPM signature keys for %{distro}.
%install
# copy license and contributors doc here for %%license and %%doc macros
mkdir -p ./docs
cp %{SOURCE201} ./docs
# create /etc/system-release and /etc/redhat-release
install -d -m 0755 %{buildroot}%{_sysconfdir}
2022-03-22 22:04:54 +00:00
echo "%{distro} release %{major}.%{minor}%{?beta: %{beta}} (%{release_name})" > %{buildroot}%{_sysconfdir}/almalinux-release
2022-01-24 09:22:43 +00:00
ln -s almalinux-release %{buildroot}%{_sysconfdir}/system-release
ln -s almalinux-release %{buildroot}%{_sysconfdir}/redhat-release
# Create the os-release file
install -d -m 0755 %{buildroot}%{_prefix}/lib
cat > %{buildroot}%{_prefix}/lib/os-release << EOF
NAME="%{distro}"
2022-03-22 22:04:54 +00:00
VERSION="%{major}.%{minor}%{?beta: %{beta}} (%{release_name})"
2022-01-24 09:22:43 +00:00
ID="almalinux"
ID_LIKE="rhel centos fedora"
2022-03-22 22:04:54 +00:00
VERSION_ID="%{major}.%{minor}"
2022-01-24 09:22:43 +00:00
PLATFORM_ID="platform:el%{major}"
2022-03-22 22:04:54 +00:00
PRETTY_NAME="%{distro} %{major}.%{minor}%{?beta: %{beta}} (%{release_name})"
ANSI_COLOR="0;34"
2022-01-24 09:22:43 +00:00
LOGO="fedora-logo-icon"
2022-03-22 22:04:54 +00:00
CPE_NAME="cpe:/o:almalinux:almalinux:%{major}::baseos"
2022-01-24 09:22:43 +00:00
HOME_URL="https://almalinux.org/"
BUG_REPORT_URL="https://bugs.almalinux.org/"
2022-03-22 22:04:54 +00:00
REDHAT_SUPPORT_PRODUCT="%{distro}"
REDHAT_SUPPORT_PRODUCT_VERSION="%{major}.%{minor}%{?beta: %{beta}}"
ALMALINUX_MANTISBT_PROJECT="AlmaLinux-%{major}"
ALMALINUX_MANTISBT_PROJECT_VERSION="%{major}.%{minor}"
2022-01-24 09:22:43 +00:00
EOF
# Create the symlink for /etc/os-release
ln -s ../usr/lib/os-release %{buildroot}%{_sysconfdir}/os-release
# write cpe to /etc/system/release-cpe
2022-03-22 22:04:54 +00:00
echo "cpe:/o:almalinux:almalinux:%{major}::baseos" > %{buildroot}%{_sysconfdir}/system-release-cpe
2022-01-24 09:22:43 +00:00
# create /etc/issue, /etc/issue.net and /etc/issue.d
echo '\S' > %{buildroot}%{_sysconfdir}/issue
echo 'Kernel \r on an \m' >> %{buildroot}%{_sysconfdir}/issue
cp %{buildroot}%{_sysconfdir}/issue{,.net}
echo >> %{buildroot}%{_sysconfdir}/issue
mkdir -p %{buildroot}%{_sysconfdir}/issue.d
# set up the dist tag macros
mkdir -p %{buildroot}%{_rpmmacrodir}
cat > %{buildroot}%{_rpmmacrodir}/macros.dist << EOF
# dist macros.
%%__bootstrap ~bootstrap
%%centos_ver %{major}
%%centos %{major}
%%rhel %{major}
%%dist %%{!?distprefix0:%%{?distprefix}}%%{expand:%%{lua:for i=0,9999 do print("%%{?distprefix" .. i .."}") end}}.el%{major}%%{?with_bootstrap:%{__bootstrap}}
%%el%{major} 1
EOF
# use unbranded datadir
install -d -m 0755 %{buildroot}%{_datadir}/almalinux-release
ln -s almalinux-release %{buildroot}%{_datadir}/redhat-release
install -p -m 0644 %{SOURCE200} %{buildroot}%{_datadir}/almalinux-release/
# copy systemd presets
install -d -m 0755 %{buildroot}%{_prefix}/lib/systemd/system-preset/
install -d -m 0755 %{buildroot}%{_prefix}/lib/systemd/user-preset
install -p -m 0644 %{SOURCE300} %{buildroot}%{_prefix}/lib/systemd/system-preset/
install -p -m 0644 %{SOURCE301} %{buildroot}%{_prefix}/lib/systemd/system-preset/
install -p -m 0644 %{SOURCE302} %{buildroot}%{_prefix}/lib/systemd/user-preset/
# installing the same file for both system and user presets to set the same behavior for both
install -p -m 0644 %{SOURCE303} %{buildroot}%{_prefix}/lib/systemd/system-preset/
install -p -m 0644 %{SOURCE303} %{buildroot}%{_prefix}/lib/systemd/user-preset/
# copy sysctl presets
mkdir -p %{buildroot}/%{_prefix}/lib/sysctl.d/
install -m 0644 %{SOURCE304} %{buildroot}/%{_prefix}/lib/sysctl.d/
# Create stub yum repos
mkdir %{buildroot}%{_sysconfdir}/yum.repos.d
touch %{buildroot}%{_sysconfdir}/yum.repos.d/redhat.repo
# Copy secureboot certificates
install -d -m 0755 %{buildroot}%{_sysconfdir}/pki/sb-certs/
install -d -m 0755 %{buildroot}%{_datadir}/pki/sb-certs/
# Install aarch64 certs
install -m 644 %{SOURCE400} %{buildroot}%{_datadir}/pki/sb-certs/secureboot-ca-aarch64.cer
install -m 644 %{SOURCE401} %{buildroot}%{_datadir}/pki/sb-certs/secureboot-kernel-aarch64.cer
install -m 644 %{SOURCE402} %{buildroot}%{_datadir}/pki/sb-certs/secureboot-grub2-aarch64.cer
install -m 644 %{SOURCE403} %{buildroot}%{_datadir}/pki/sb-certs/secureboot-fwupd-aarch64.cer
# Install x86_64 certs
install -m 644 %{SOURCE400} %{buildroot}%{_datadir}/pki/sb-certs/secureboot-ca-x86_64.cer
install -m 644 %{SOURCE401} %{buildroot}%{_datadir}/pki/sb-certs/secureboot-kernel-x86_64.cer
install -m 644 %{SOURCE402} %{buildroot}%{_datadir}/pki/sb-certs/secureboot-grub2-x86_64.cer
install -m 644 %{SOURCE403} %{buildroot}%{_datadir}/pki/sb-certs/secureboot-fwupd-x86_64.cer
# Install ppc64le certs
install -m 644 %{SOURCE400} %{buildroot}%{_datadir}/pki/sb-certs/secureboot-ca-ppc64le.cer
install -m 644 %{SOURCE401} %{buildroot}%{_datadir}/pki/sb-certs/secureboot-kernel-ppc64le.cer
install -m 644 %{SOURCE402} %{buildroot}%{_datadir}/pki/sb-certs/secureboot-grub2-ppc64le.cer
# Install s390x certs
install -m 644 %{SOURCE400} %{buildroot}%{_datadir}/pki/sb-certs/secureboot-ca-s390x.cer
install -m 644 %{SOURCE401} %{buildroot}%{_datadir}/pki/sb-certs/secureboot-kernel-s390x.cer
# Link x86_64 certs
ln -sr %{buildroot}%{_datadir}%{_datadir}/pki/sb-certs/secureboot-ca-x86_64.cer %{buildroot}%{_sysconfdir}/pki/sb-certs/secureboot-ca-x86_64.cer
ln -sr %{buildroot}%{_datadir}%{_datadir}/pki/sb-certs/secureboot-kernel-x86_64.cer %{buildroot}%{_sysconfdir}/pki/sb-certs/secureboot-kernel-x86_64.cer
ln -sr %{buildroot}%{_datadir}%{_datadir}/pki/sb-certs/secureboot-grub2-x86_64.cer %{buildroot}%{_sysconfdir}/pki/sb-certs/secureboot-grub2-x86_64.cer
ln -sr %{buildroot}%{_datadir}%{_datadir}/pki/sb-certs/secureboot-fwupd-x86_64.cer %{buildroot}%{_sysconfdir}/pki/sb-certs/secureboot-fwupd-x86_64.cer
# Link aarch64 certs
ln -sr %{buildroot}%{_datadir}%{_datadir}/pki/sb-certs/secureboot-ca-aarch64.cer %{buildroot}%{_sysconfdir}/pki/sb-certs/secureboot-ca-aarch64.cer
ln -sr %{buildroot}%{_datadir}%{_datadir}/pki/sb-certs/secureboot-kernel-aarch64.cer %{buildroot}%{_sysconfdir}/pki/sb-certs/secureboot-kernel-aarch64.cer
ln -sr %{buildroot}%{_datadir}%{_datadir}/pki/sb-certs/secureboot-grub2-aarch64.cer %{buildroot}%{_sysconfdir}/pki/sb-certs/secureboot-grub2-aarch64.cer
ln -sr %{buildroot}%{_datadir}%{_datadir}/pki/sb-certs/secureboot-fwupd-aarch64.cer %{buildroot}%{_sysconfdir}/pki/sb-certs/secureboot-fwupd-aarch64.cer
# Link ppc64le certs
ln -sr %{buildroot}%{_datadir}%{_datadir}/pki/sb-certs/secureboot-ca-ppc64le.cer %{buildroot}%{_sysconfdir}/pki/sb-certs/secureboot-ca-ppc64le.cer
ln -sr %{buildroot}%{_datadir}%{_datadir}/pki/sb-certs/secureboot-kernel-ppc64le.cer %{buildroot}%{_sysconfdir}/pki/sb-certs/secureboot-kernel-ppc64le.cer
ln -sr %{buildroot}%{_datadir}%{_datadir}/pki/sb-certs/secureboot-grub2-ppc64le.cer %{buildroot}%{_sysconfdir}/pki/sb-certs/secureboot-grub2-ppc64le.cer
# Link s390x certs
ln -sr %{buildroot}%{_datadir}%{_datadir}/pki/sb-certs/secureboot-ca-s390x.cer %{buildroot}%{_sysconfdir}/pki/sb-certs/secureboot-ca-s390x.cer
ln -sr %{buildroot}%{_datadir}%{_datadir}/pki/sb-certs/secureboot-kernel-s390x.cer %{buildroot}%{_sysconfdir}/pki/sb-certs/secureboot-kernel-s390x.cer
# copy yum repos
install -d -m 0755 %{buildroot}%{_sysconfdir}/yum.repos.d
install -p -m 0644 %{SOURCE500} %{buildroot}%{_sysconfdir}/yum.repos.d/
install -p -m 0644 %{SOURCE501} %{buildroot}%{_sysconfdir}/yum.repos.d/
# dnf variables
install -d -m 0755 %{buildroot}%{_sysconfdir}/dnf/vars
# echo "%{major}-stream" > %{buildroot}%{_sysconfdir}/dnf/vars/stream
# copy GPG keys
install -d -m 0755 %{buildroot}%{_sysconfdir}/pki/rpm-gpg
install -p -m 0644 %{SOURCE600} %{buildroot}%{_sysconfdir}/pki/rpm-gpg/
%files
%license docs/LICENSE
%{_sysconfdir}/redhat-release
%{_sysconfdir}/system-release
%{_sysconfdir}/almalinux-release
%config(noreplace) %{_sysconfdir}/os-release
%config %{_sysconfdir}/system-release-cpe
%config(noreplace) %{_sysconfdir}/issue
%config(noreplace) %{_sysconfdir}/issue.net
%dir %{_sysconfdir}/issue.d
%dir %{_sysconfdir}/yum.repos.d
%ghost %{_sysconfdir}/yum.repos.d/redhat.repo
%{_rpmmacrodir}/macros.dist
%{_datadir}/redhat-release
%{_datadir}/almalinux-release
%{_prefix}/lib/os-release
%{_prefix}/lib/systemd/system-preset/*
%{_prefix}/lib/systemd/user-preset/*
%{_prefix}/lib/sysctl.d/50-redhat.conf
%files -n almalinux-sb-certs
# Note to future packagers:
# resetting the symlinks in /etc/pki/sb-certs on upgrade is the intended behavior here
%dir %{_sysconfdir}/pki/sb-certs
%dir %{_datadir}/pki/sb-certs/
%{_sysconfdir}/pki/sb-certs/*.cer
%{_datadir}/pki/sb-certs/*.cer
2022-01-25 13:12:19 +00:00
%files -n almalinux-repos
2022-01-24 09:22:43 +00:00
%config(noreplace) %{_sysconfdir}/yum.repos.d/almalinux.repo
%config(noreplace) %{_sysconfdir}/yum.repos.d/almalinux-addons.repo
# %config(noreplace) %{_sysconfdir}/dnf/vars/stream
%files -n almalinux-gpg-keys
%{_sysconfdir}/pki/rpm-gpg
%changelog
* Mon Jan 24 2022 Andrew Lukoshko <alukoshko@almalinux.org> - 9.0-1
- Initial release for 9.0 beta