rocky-release/SPECS/rocky-release.spec

132 lines
4.0 KiB
RPMSpec
Raw Normal View History

2021-02-01 07:12:25 +00:00
%global distro Rocky Linux
%global major 8
%global minor 3
Name: rocky-release
Version: %{major}.%{minor}
2021-03-09 16:32:09 +00:00
Release: 2%{?dist}
2021-02-01 07:12:25 +00:00
Summary: %{distro} release files
License: GPLv2
URL: https://rockylinux.org
BuildArch: noarch
Requires: rocky-repos(%{major})
Provides: rocky-release = %{version}-%{release}
# required for a lorax run (to generate install media)
Provides: rocky-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
Source202: Contributors
Source300: 85-display-manager.preset
Source301: 90-default.preset
Source302: 99-default-disable.preset
%description
%{distro} release files.
%install
# copy license and contributors doc here for %%license and %%doc macros
cp %{SOURCE201} %{SOURCE202} .
# create /etc/system-release and /etc/redhat-release
install -d -m 0755 %{buildroot}%{_sysconfdir}
echo "%{distro} release %{version}" > %{buildroot}%{_sysconfdir}/rocky-release
echo "Derived from Red Hat Enterprise Linux %{version}" > %{buildroot}%{_sysconfdir}/rocky-release-upstream
ln -s rocky-release %{buildroot}%{_sysconfdir}/system-release
ln -s rocky-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}"
VERSION="%{major}"
ID="rocky"
ID_LIKE="rhel fedora"
VERSION_ID="%{major}"
PLATFORM_ID="platform:el%{major}"
PRETTY_NAME="%{distro} %{major}"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:rocky:rocky:%{major}"
HOME_URL="https://rockylinux.org/"
BUG_REPORT_URL="https://bugs.rockylinux.org/"
CENTOS_MANTISBT_PROJECT="Rocky-%{major}"
CENTOS_MANTISBT_PROJECT_VERSION="%{major}"
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
echo "cpe:/o:rocky:rocky:%{major}" > %{buildroot}%{_sysconfdir}/system-release-cpe
# create /etc/issue and /etc/issue.net
echo '\S' > %{buildroot}%{_sysconfdir}/issue
echo 'Kernel \r on an \m' >> %{buildroot}%{_sysconfdir}/issue
cp %{buildroot}%{_sysconfdir}/issue{,.net}
echo >> %{buildroot}%{_sysconfdir}/issue
# set up the dist tag macros
install -d -m 0755 %{buildroot}%{_sysconfdir}/rpm
cat > %{buildroot}%{_sysconfdir}/rpm/macros.dist << EOF
# dist macros.
%%rocky_ver %{major}
%%rocky %{major}
2021-02-22 06:50:05 +00:00
%%centos %{major}
2021-02-01 07:12:25 +00:00
%%rhel %{major}
%%dist .el%{major}
%%el%{major} 1
EOF
# use unbranded datadir
install -d -m 0755 %{buildroot}%{_datadir}/rocky-release
ln -s rocky-release %{buildroot}%{_datadir}/redhat-release
install -p -m 0644 %{SOURCE200} %{buildroot}%{_datadir}/rocky-release/
# copy systemd presets
install -d -m 0755 %{buildroot}%{_prefix}/lib/systemd/system-preset/
install -p -m 0644 %{_sourcedir}/*.preset %{buildroot}%{_prefix}/lib/systemd/system-preset/
%files
%license LICENSE
%doc Contributors
%{_sysconfdir}/redhat-release
%{_sysconfdir}/system-release
%{_sysconfdir}/rocky-release
%{_sysconfdir}/rocky-release-upstream
%config(noreplace) %{_sysconfdir}/os-release
%config %{_sysconfdir}/system-release-cpe
%config(noreplace) %{_sysconfdir}/issue
%config(noreplace) %{_sysconfdir}/issue.net
%{_sysconfdir}/rpm/macros.dist
%{_datadir}/redhat-release
%{_datadir}/rocky-release
%{_prefix}/lib/os-release
%{_prefix}/lib/systemd/system-preset/*
%ifarch %{arm} aarch64
%attr(0755,root,root) %{_bindir}/rootfs-expand
%endif
%changelog
* Mon Feb 01 2021 Louis Abel <label@rockylinux.org> - 8.3-1
- Initial Rocky Release 8.3 based on CentOS 8.3
2021-02-22 06:50:05 +00:00
- Keep centos rpm macro to reduce package modification burden