mirror of
https://abf.rosa.ru/djam/limits.git
synced 2025-02-23 03:52:48 +00:00
74 lines
1.9 KiB
RPMSpec
74 lines
1.9 KiB
RPMSpec
%define _systemd_confdir /usr/lib/systemd/system.conf.d
|
|
%define _systemd_user_confdir /usr/lib/systemd/user.conf.d
|
|
|
|
Summary: Set kernel limits
|
|
Name: limits
|
|
Version: 2
|
|
Release: 1
|
|
License: BSD
|
|
Group: System/Configuration/Boot and Init
|
|
Url: https://abf.io/import/limits
|
|
BuildArch: noarch
|
|
|
|
%description
|
|
Set kernel limits
|
|
|
|
#------------------------------------------------------------------
|
|
|
|
%package big
|
|
Summary: Set big enough kernel limits
|
|
|
|
%description big
|
|
Set big enough kernel limits
|
|
|
|
%files big
|
|
%config(noreplace) %{_sysconfdir}/security/limits.d/95-%{name}-big.conf
|
|
# no %%config(noreplace), it can be overriden in /etc/systemd/system.conf.d/
|
|
%{_systemd_confdir}/10-%{name}-big.conf
|
|
%{_systemd_user_confdir}/10-%{name}-big.conf
|
|
|
|
#------------------------------------------------------------------
|
|
|
|
%prep
|
|
|
|
%install
|
|
set -e
|
|
set -u
|
|
|
|
mkdir -p %{buildroot}
|
|
mkdir -p %{buildroot}%{_sysconfdir}/security/limits.d
|
|
mkdir -p %{buildroot}%{_systemd_confdir}
|
|
mkdir -p %{buildroot}%{_systemd_user_confdir}
|
|
|
|
# took some ideas from https://packages.altlinux.org/ru/sisyphus/srpms/pam-limits-desktop/
|
|
|
|
# the same as default config in the "pam" package
|
|
NPROC_SOFT=4096
|
|
# 2^16
|
|
NOFILE_SOFT=65536
|
|
# 512*1024, as default @HIGH_RLIMIT_NOFILE@ in systemd
|
|
NOFILE_HARD=524288
|
|
|
|
cat > %{buildroot}%{_sysconfdir}/security/limits.d/95-%{name}-big.conf << EOF
|
|
# limits.conf(5)
|
|
* soft nproc $NPROC_SOFT
|
|
* hard nproc unlimited
|
|
* soft nofile $NOFILE_SOFT
|
|
* hard nofile $NOFILE_HARD
|
|
EOF
|
|
|
|
# https://github.com/systemd/systemd/issues/25478
|
|
cat > %{buildroot}%{_systemd_confdir}/10-%{name}-big.conf << EOF
|
|
# system.conf.d(5), systemd.exec(5)
|
|
# Example commands to read current values:
|
|
# systemd-analyze cat-config systemd/system.conf
|
|
# systemctl show -p DefaultLimitNOFILESoft
|
|
# cat /proc/PID/limits
|
|
[Manager]
|
|
DefaultLimitNPROC=$NPROC_SOFT:infinity
|
|
DefaultLimitNOFILE=$NOFILE_SOFT:$NOFILE_HARD
|
|
EOF
|
|
|
|
cp %{buildroot}%{_systemd_confdir}/10-%{name}-big.conf %{buildroot}%{_systemd_user_confdir}
|
|
|
|
set +u
|