mirror of
https://abf.rosa.ru/djam/limits.git
synced 2025-02-23 09:42:48 +00:00
init
This commit is contained in:
commit
f9de6a3d6e
1 changed files with 69 additions and 0 deletions
69
limits.spec
Normal file
69
limits.spec
Normal file
|
@ -0,0 +1,69 @@
|
|||
%define _systemd_confdir /usr/lib/systemd/system.conf.d
|
||||
|
||||
Summary: Set kernel limits
|
||||
Name: limits
|
||||
Version: 1
|
||||
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
|
||||
|
||||
#------------------------------------------------------------------
|
||||
|
||||
%prep
|
||||
|
||||
%install
|
||||
set -e
|
||||
set -u
|
||||
|
||||
mkdir -p %{buildroot}
|
||||
mkdir -p %{buildroot}%{_sysconfdir}/security/limits.d
|
||||
mkdir -p %{buildroot}%{_systemd_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
|
||||
|
||||
set +u
|
Loading…
Add table
Reference in a new issue