From 4ce5da80a6681f7db89db17cbc033a3a6e9a1e8000bf2575bed35f598934d834 Mon Sep 17 00:00:00 2001 From: Aleksa Sarai Date: Mon, 11 Oct 2021 02:19:21 +0000 Subject: [PATCH] Accepting request 922511 from home:dancermak:branches:Virtualization:containers Install systemd service file as well (fixes bsc#1190826) OBS-URL: https://build.opensuse.org/request/show/922511 OBS-URL: https://build.opensuse.org/package/show/Virtualization:containers/containerd?expand=0&rev=125 --- containerd.changes | 5 +++++ containerd.service | 43 +++++++++++++++++++++++++++++++++++++++++++ containerd.spec | 17 +++++++++++++++++ 3 files changed, 65 insertions(+) create mode 100644 containerd.service diff --git a/containerd.changes b/containerd.changes index 3a4eafb..3fa0ca6 100644 --- a/containerd.changes +++ b/containerd.changes @@ -4,6 +4,11 @@ Wed Oct 6 02:54:49 UTC 2021 - Aleksa Sarai - Update to containerd v1.4.11, to fix CVE-2021-41103 bsc#1191121. bsc#1191355 - Switch to Go 1.16.x compiler, in line with upstream. +------------------------------------------------------------------- +Fri Oct 1 06:59:50 UTC 2021 - Dan Čermák + +- Install systemd service file as well (fixes bsc#1190826) + ------------------------------------------------------------------- Tue Jul 20 09:30:30 UTC 2021 - Aleksa Sarai diff --git a/containerd.service b/containerd.service new file mode 100644 index 0000000..3fcb16e --- /dev/null +++ b/containerd.service @@ -0,0 +1,43 @@ +# Copyright The containerd Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Modifications by SUSE LLC under the same license + +[Unit] +Description=containerd container runtime +Documentation=https://containerd.io +After=network.target local-fs.target +Conflicts=docker.service + +[Service] +ExecStartPre=-/sbin/modprobe overlay +ExecStart=/usr/sbin/containerd + +Type=notify +Delegate=yes +KillMode=process +Restart=always +RestartSec=5 +# Having non-zero Limit*s causes performance problems due to accounting overhead +# in the kernel. We recommend using cgroups to do container-local accounting. +LimitNPROC=infinity +LimitCORE=infinity +LimitNOFILE=1048576 +# Comment TasksMax if your systemd version does not supports it. +# Only systemd 226 and above support this version. +TasksMax=infinity +OOMScoreAdjust=-999 + +[Install] +WantedBy=multi-user.target diff --git a/containerd.spec b/containerd.spec index 5ef00dc..6e2ef78 100644 --- a/containerd.spec +++ b/containerd.spec @@ -35,6 +35,7 @@ Group: System/Management URL: https://containerd.tools Source: %{name}-%{version}_%{git_short}.tar.xz Source1: %{name}-rpmlintrc +Source2: %{name}.service BuildRequires: fdupes BuildRequires: glibc-devel-static BuildRequires: go-go-md2man @@ -121,6 +122,9 @@ popd install -d -m755 %{buildroot}/%{_sysconfdir}/%{name} echo "# See containerd-config.toml(5) for documentation." >%{buildroot}/%{_sysconfdir}/%{name}/config.toml +# Install system service +install -Dp -m644 %{SOURCE2} %{buildroot}%{_unitdir}/%{name}.service + # Man pages. # TODO: Fix man page generation. #for file in man/* @@ -132,6 +136,18 @@ echo "# See containerd-config.toml(5) for documentation." >%{buildroot}/%{_sysco %fdupes %{buildroot} +%pre +%service_add_pre %{name}.service + +%post +%service_add_post %{name}.service + +%preun +%service_del_preun %{name}.service + +%postun +%service_del_postun %{name}.service + %files %defattr(-,root,root) %doc README.md @@ -140,6 +156,7 @@ echo "# See containerd-config.toml(5) for documentation." >%{buildroot}/%{_sysco %config %{_sysconfdir}/%{name}/config.toml %{_sbindir}/containerd %{_sbindir}/containerd-shim* +%{_unitdir}/%{name}.service # TODO: Fix man page generation. #%{_mandir}/man*/%{name}* #%exclude %{_mandir}/man1/*ctr.1*