218 lines
6.4 KiB
RPMSpec
218 lines
6.4 KiB
RPMSpec
|
|
%define debug_package %{nil}
|
||
|
|
%define product_family {os_name}
|
||
|
|
%define variant_titlecase Server
|
||
|
|
%define variant_lowercase server
|
||
|
|
%define dist_release_version 8
|
||
|
|
%define generic_version {os_version}
|
||
|
|
%define generic_release 1
|
||
|
|
%define builtin_release_version 1.0
|
||
|
|
|
||
|
|
%define current_arch %{_arch}
|
||
|
|
%ifarch i386
|
||
|
|
%define current_arch x86
|
||
|
|
%endif
|
||
|
|
|
||
|
|
%global boot_args fpi_to_tail=off
|
||
|
|
|
||
|
|
Name: %{product_family}-release
|
||
|
|
Version: {rpm_version}
|
||
|
|
Release: %{generic_release}
|
||
|
|
Summary: %{product_family} release file
|
||
|
|
License: Mulan PSL v2
|
||
|
|
Provides: %{product_family}-release
|
||
|
|
Provides: %{_vendor}-release
|
||
|
|
Provides: generic-release
|
||
|
|
Provides: system-release = {rpm_version}
|
||
|
|
Source0: generic-release-%{builtin_release_version}.tar.gz
|
||
|
|
Source1: 85-display-manager.preset
|
||
|
|
Source2: 90-default.preset
|
||
|
|
Source3: 99-default-disable.preset
|
||
|
|
|
||
|
|
%if "%{product_family}" != "openEuler"
|
||
|
|
Provides: openEuler-release
|
||
|
|
Obsoletes: openEuler-release
|
||
|
|
Provides: openEuler-latest-release
|
||
|
|
Obsoletes: openEuler-latest-release
|
||
|
|
Provides: openEuler-rootfiles
|
||
|
|
Obsoletes: openEuler-rootfiles
|
||
|
|
Provides: openEuler-release-custom
|
||
|
|
Obsoletes: openEuler-release-custom
|
||
|
|
%endif
|
||
|
|
|
||
|
|
Source4: dot-bashrc
|
||
|
|
Source5: dot-bash_profile
|
||
|
|
Source6: dot-bash_logout
|
||
|
|
Source7: dot-tcshrc
|
||
|
|
Source8: dot-cshrc
|
||
|
|
|
||
|
|
BuildRequires: python3
|
||
|
|
Requires: %{product_family}-repos
|
||
|
|
Requires: %{product_family}-release-custom
|
||
|
|
Obsoletes: yum-utils yum-utils-help yum-utils-plugins
|
||
|
|
|
||
|
|
%description
|
||
|
|
%{product_family} release files
|
||
|
|
|
||
|
|
%package -n %{product_family}-performance
|
||
|
|
Requires: coreutils systemd setup
|
||
|
|
|
||
|
|
Summary: performance script
|
||
|
|
%description -n %{product_family}-performance
|
||
|
|
performance script
|
||
|
|
|
||
|
|
%package -n %{product_family}-rootfiles
|
||
|
|
Summary: Basic required files for the root user's account
|
||
|
|
BuildArch: noarch
|
||
|
|
Conflicts: rootfiles
|
||
|
|
|
||
|
|
%description -n %{product_family}-rootfiles
|
||
|
|
The rootfiles package contains basic required files that are placed
|
||
|
|
in the root user's account. These files are basically the same as
|
||
|
|
those in /etc/skel, which are placed in regular users' home directories.
|
||
|
|
|
||
|
|
%package -n %{product_family}-release-custom
|
||
|
|
Summary: {os_name}-release-custom
|
||
|
|
BuildArch: noarch
|
||
|
|
|
||
|
|
%description -n %{product_family}-release-custom
|
||
|
|
{os_name}-release-custom
|
||
|
|
|
||
|
|
%prep
|
||
|
|
%setup -q -n generic-release-%{builtin_release_version}
|
||
|
|
|
||
|
|
%postun -n %{product_family}-release-custom
|
||
|
|
vendorid=`lscpu | grep "Vendor ID:" | awk '{print $3}'`
|
||
|
|
model=`lscpu | grep "Model:" | awk '{print $2}'`
|
||
|
|
|
||
|
|
if [ "0x70" == "${vendorid}" -a "3" == "${model}" ]; then
|
||
|
|
grep "%{boot_args}" /etc/grub.d/10_linux > /dev/null 2>&1
|
||
|
|
if [ $? -ne 0 ]; then
|
||
|
|
echo "ERROR: failed to clean up boot args in /etc/grub.d/10_linux because they have been modified"
|
||
|
|
exit 1
|
||
|
|
fi
|
||
|
|
sed -i "s/%{boot_args} //g" /etc/grub.d/10_linux
|
||
|
|
fi
|
||
|
|
|
||
|
|
%posttrans -n %{product_family}-release-custom
|
||
|
|
|
||
|
|
# parameters for grub2
|
||
|
|
|
||
|
|
vendorid=`lscpu | grep "Vendor ID:" | awk '{print $3}'`
|
||
|
|
model=`lscpu | grep "Model:" | awk '{print $2}'`
|
||
|
|
|
||
|
|
if [ "0x70" == "${vendorid}" -a "3" == "${model}" ]; then
|
||
|
|
sed -i "s/ ro .*args/ ro %{boot_args} \$\{args/g" /etc/grub.d/10_linux
|
||
|
|
fi
|
||
|
|
|
||
|
|
%build
|
||
|
|
echo OK
|
||
|
|
|
||
|
|
%install
|
||
|
|
rm -rf $RPM_BUILD_ROOT
|
||
|
|
mkdir -p $RPM_BUILD_ROOT/etc
|
||
|
|
echo "%{product_family} release %{generic_version}" > $RPM_BUILD_ROOT/etc/%{product_family}-release
|
||
|
|
ln -sf %{product_family}-release $RPM_BUILD_ROOT/etc/system-release
|
||
|
|
|
||
|
|
# create /etc/os-release
|
||
|
|
cat << EOF >>$RPM_BUILD_ROOT/etc/os-release
|
||
|
|
NAME="%{product_family}"
|
||
|
|
VERSION="%{generic_version}"
|
||
|
|
ID="%{product_family}"
|
||
|
|
VERSION_ID="%{generic_version}"
|
||
|
|
PRETTY_NAME="%{product_family} %{generic_version}"
|
||
|
|
ANSI_COLOR="0;31"
|
||
|
|
|
||
|
|
EOF
|
||
|
|
|
||
|
|
mkdir -p -m 755 $RPM_BUILD_ROOT/etc/profile.d
|
||
|
|
cp -a color.sh $RPM_BUILD_ROOT/etc/profile.d/
|
||
|
|
cp -a system-info.sh $RPM_BUILD_ROOT/etc/profile.d/
|
||
|
|
cp -a performance.sh $RPM_BUILD_ROOT/etc/profile.d/
|
||
|
|
|
||
|
|
# write cpe to /etc/system/release-cpe
|
||
|
|
echo "cpe:/o:%{product_family}:%{product_family}:%{generic_version}:ga:server" > $RPM_BUILD_ROOT/etc/system-release-cpe
|
||
|
|
|
||
|
|
# create /etc/issue and /etc/issue.net
|
||
|
|
echo '\S' > $RPM_BUILD_ROOT/etc/issue
|
||
|
|
echo 'Kernel \r on an \m' >> $RPM_BUILD_ROOT/etc/issue
|
||
|
|
cp $RPM_BUILD_ROOT/etc/issue $RPM_BUILD_ROOT/etc/issue.net
|
||
|
|
echo >> $RPM_BUILD_ROOT/etc/issue
|
||
|
|
|
||
|
|
mkdir -p $RPM_BUILD_ROOT/usr/share/eula
|
||
|
|
cp eula.[!py]* $RPM_BUILD_ROOT/usr/share/eula
|
||
|
|
|
||
|
|
mkdir -p $RPM_BUILD_ROOT/var/lib
|
||
|
|
cp supportinfo $RPM_BUILD_ROOT/var/lib/supportinfo
|
||
|
|
|
||
|
|
# set up the dist tag macros
|
||
|
|
install -d -m 755 $RPM_BUILD_ROOT/etc/rpm
|
||
|
|
cat >> $RPM_BUILD_ROOT/etc/rpm/macros.dist << EOF
|
||
|
|
# dist macros.
|
||
|
|
|
||
|
|
%%dist %%{nil}
|
||
|
|
%%%{product_family} 2
|
||
|
|
EOF
|
||
|
|
|
||
|
|
# use unbranded datadir
|
||
|
|
mkdir -p -m 755 $RPM_BUILD_ROOT/%{_datadir}/%{product_family}-release
|
||
|
|
install -m 644 EULA $RPM_BUILD_ROOT/%{_datadir}/%{product_family}-release
|
||
|
|
|
||
|
|
# use unbranded docdir
|
||
|
|
mkdir -p -m 755 $RPM_BUILD_ROOT/%{_docdir}/%{product_family}-release
|
||
|
|
cp -p License/LICENSE $RPM_BUILD_ROOT/%{_docdir}/%{product_family}-release
|
||
|
|
|
||
|
|
# copy systemd presets
|
||
|
|
mkdir -p %{buildroot}%{_prefix}/lib/systemd/system-preset/
|
||
|
|
install -m 0644 %{SOURCE1} %{buildroot}%{_prefix}/lib/systemd/system-preset/
|
||
|
|
install -m 0644 %{SOURCE2} %{buildroot}%{_prefix}/lib/systemd/system-preset/
|
||
|
|
install -m 0644 %{SOURCE3} %{buildroot}%{_prefix}/lib/systemd/system-preset/
|
||
|
|
|
||
|
|
# set root's bash profile
|
||
|
|
mkdir -p %{buildroot}/root
|
||
|
|
|
||
|
|
install -p -m 644 %{SOURCE4} %{buildroot}/root/.bashrc
|
||
|
|
install -p -m 644 %{SOURCE5} %{buildroot}/root/.bash_profile
|
||
|
|
install -p -m 644 %{SOURCE6} %{buildroot}/root/.bash_logout
|
||
|
|
install -p -m 644 %{SOURCE7} %{buildroot}/root/.tcshrc
|
||
|
|
install -p -m 644 %{SOURCE8} %{buildroot}/root/.cshrc
|
||
|
|
|
||
|
|
%posttrans -n %{product_family}-rootfiles
|
||
|
|
if [ $1 -eq 0 ] ; then
|
||
|
|
cp -ndr --preserve=ownership,timestamps /etc/skel/. /root/ || :
|
||
|
|
fi
|
||
|
|
|
||
|
|
%clean
|
||
|
|
rm -rf $RPM_BUILD_ROOT
|
||
|
|
|
||
|
|
%files
|
||
|
|
%defattr(0644,root,root,0755)
|
||
|
|
/etc/system-release
|
||
|
|
/etc/profile.d/color.sh
|
||
|
|
/etc/profile.d/system-info.sh
|
||
|
|
/etc/%{product_family}-release
|
||
|
|
%config(noreplace) /etc/os-release
|
||
|
|
%config /etc/system-release-cpe
|
||
|
|
%config(noreplace) /etc/issue
|
||
|
|
%config(noreplace) /etc/issue.net
|
||
|
|
/etc/rpm/macros.dist
|
||
|
|
%{_docdir}/%{product_family}-release/*
|
||
|
|
%{_datadir}/%{product_family}-release/*
|
||
|
|
%{_prefix}/lib/systemd/system-preset/*
|
||
|
|
/var/lib/supportinfo
|
||
|
|
/usr/share/eula/eula.*
|
||
|
|
|
||
|
|
%files -n %{product_family}-performance
|
||
|
|
%defattr(0644,root,root,0755)
|
||
|
|
/etc/profile.d/performance.sh
|
||
|
|
|
||
|
|
%files -n %{product_family}-rootfiles
|
||
|
|
%config(noreplace) /root/.bashrc
|
||
|
|
%config(noreplace) /root/.bash_profile
|
||
|
|
%config(noreplace) /root/.bash_logout
|
||
|
|
%config(noreplace) /root/.tcshrc
|
||
|
|
%config(noreplace) /root/.cshrc
|
||
|
|
|
||
|
|
%files -n %{product_family}-release-custom
|
||
|
|
|
||
|
|
%changelog
|