File libcontainers-common.spec of Package libcontainers-common
xxxxxxxxxx
1
#
2
# spec file for package libcontainers-common
3
#
4
# Copyright (c) 2021 SUSE LLC
5
#
6
# All modifications and additions to the file contributed by third parties
7
# remain the property of their copyright owners, unless otherwise agreed
8
# upon. The license for this file, and modifications and additions to the
9
# file, is the same license as for the pristine package itself (unless the
10
# license for the pristine package is not an Open Source License, in which
11
# case the license is the MIT License). An "Open Source License" is a
12
# license that conforms to the Open Source Definition (Version 1.9)
13
# published by the Open Source Initiative.
14
15
# Please submit bugfixes or comments via https://bugs.opensuse.org/
16
#
17
18
19
# commonver - version from containers/common
20
%define commonver 0.44.0
21
22
# podman - version from containers/podman
23
%define podmanver 3.3.1
24
25
# storagever - version from containers/storage
26
%define storagever 1.36.0
27
28
# imagever - version from containers/image
29
%define imagever 5.16.0
30
31
Name: libcontainers-common
32
Version: 20210626
33
Release: 0
34
Summary: Configuration files common to github.com/containers
35
License: Apache-2.0 AND GPL-3.0-or-later
36
Group: System/Management
37
URL: https://github.com/containers
38
Source0: image-%{imagever}.tar.xz
39
Source1: storage-%{storagever}.tar.xz
40
Source2: LICENSE
41
Source3: policy.json
42
Source4: storage.conf
43
Source5: mounts.conf
44
Source6: registries.conf
45
Source7: podman-%{podmanver}.tar.xz
46
Source8: default.yaml
47
Source9: common-%{commonver}.tar.xz
48
Source10: containers.conf
49
Source11: %{name}.rpmlintrc
50
BuildRequires: go-go-md2man
51
Provides: libcontainers-image = %{version}
52
Provides: libcontainers-storage = %{version}
53
Obsoletes: libcontainers-image < %{version}
54
Obsoletes: libcontainers-storage < %{version}
55
Requires(post): util-linux-systemd
56
Requires(post): grep
57
BuildArch: noarch
58
59
%description
60
Configuration files and manpages shared by tools that are based on the
61
github.com/containers libraries, such as Buildah, CRI-O, Podman and Skopeo.
62
63
%prep
64
%setup -Tcq -b0 -b1 -b7 -b9
65
# copy the LICENSE file in the build root
66
cp %{SOURCE2} .
67
68
%build
69
cd ..
70
pwd
71
# compile containers/image manpages
72
cd image-%{imagever}
73
for md in docs/*.md
74
do
75
go-md2man -in $md -out $md
76
done
77
rename '.5.md' '.5' docs/*
78
rename '.md' '.1' docs/*
79
cd ..
80
# compile containers/storage manpages
81
cd storage-%{storagever}
82
for md in docs/*.md
83
do
84
go-md2man -in $md -out $md
85
done
86
rename '.5.md' '.5' docs/*
87
rename '.md' '.1' docs/*
88
cd ..
89
# compile subset of containers/podman manpages
90
cd podman-%{podmanver}
91
go-md2man -in pkg/hooks/docs/oci-hooks.5.md -out pkg/hooks/docs/oci-hooks.5
92
cd ..
93
94
%if 0%{?is_opensuse}
95
# no default mounts
96
%else
97
cat >>%{SOURCE5} <<EOL
98
/etc/SUSEConnect:/etc/SUSEConnect
99
/etc/zypp/credentials.d/SCCcredentials:/etc/zypp/credentials.d/SCCcredentials
100
EOL
101
%endif
102
103
cd common-%{commonver}
104
make docs
105
cd ..
106
107
%install
108
cd ..
109
install -d -m 0755 %{buildroot}/%{_sysconfdir}/containers
110
install -d -m 0755 %{buildroot}/%{_sysconfdir}/containers/oci/hooks.d
111
install -d -m 0755 %{buildroot}/%{_datadir}/containers/oci/hooks.d
112
install -d -m 0755 %{buildroot}/%{_sysconfdir}/containers/registries.d
113
114
install -D -m 0644 %{SOURCE3} %{buildroot}/%{_sysconfdir}/containers/policy.json
115
install -D -m 0644 %{SOURCE4} %{buildroot}/%{_sysconfdir}/containers/storage.conf
116
install -D -m 0644 %{SOURCE5} %{buildroot}/%{_datadir}/containers/mounts.conf
117
install -D -m 0644 %{SOURCE5} %{buildroot}/%{_sysconfdir}/containers/mounts.conf
118
install -D -m 0644 %{SOURCE6} %{buildroot}/%{_sysconfdir}/containers/registries.conf
119
install -D -m 0644 %{SOURCE8} %{buildroot}/%{_sysconfdir}/containers/registries.d/default.yaml
120
sed -e 's-@LIBEXECDIR@-%{_libexecdir}-g' -i %{SOURCE10}
121
install -D -m 0644 %{SOURCE10} %{buildroot}/%{_datadir}/containers/containers.conf
122
install -D -m 0644 common-%{commonver}/pkg/seccomp/seccomp.json %{buildroot}/%{_datadir}/containers/seccomp.json
123
install -D -m 0644 common-%{commonver}/pkg/seccomp/seccomp.json %{buildroot}/%{_sysconfdir}/containers/seccomp.json
124
125
install -d %{buildroot}/%{_mandir}/man1
126
install -d %{buildroot}/%{_mandir}/man5
127
install -D -m 0644 image-%{imagever}/docs/*.1 %{buildroot}/%{_mandir}/man1/
128
install -D -m 0644 image-%{imagever}/docs/*.5 %{buildroot}/%{_mandir}/man5/
129
install -D -m 0644 storage-%{storagever}/docs/*.1 %{buildroot}/%{_mandir}/man1/
130
install -D -m 0644 storage-%{storagever}/docs/*.5 %{buildroot}/%{_mandir}/man5/
131
install -D -m 0644 podman-%{podmanver}/pkg/hooks/docs/oci-hooks.5 %{buildroot}/%{_mandir}/man5/
132
install -D -m 0644 common-%{commonver}/docs/containers-mounts.conf.5 %{buildroot}/%{_mandir}/man5/
133
install -D -m 0644 common-%{commonver}/docs/containers.conf.5 %{buildroot}/%{_mandir}/man5/
134
135
%post
136
# Comment out ostree_repo if it's blank [boo#1189893]
137
sed -i 's/ostree_repo = ""/\#ostree_repo = ""/g' /etc/containers/storage.conf
138
# If installing, check if /var/lib/containers (or /var/lib in its defect) is btrfs and set driver
139
# to "btrfs" if true
140
if [ $1 -eq 1 ] ; then
141
fstype=$((findmnt -o FSTYPE -l --target /var/lib/containers || findmnt -o FSTYPE -l --target /var/lib) | grep -v FSTYPE)
142
if [ "$fstype" = "btrfs" ]; then
143
sed -i 's/driver = "overlay"/driver = "btrfs"/g' %{_sysconfdir}/containers/storage.conf
144
fi
145
fi
146
147
%files
148
%dir %{_sysconfdir}/containers
149
%dir %{_sysconfdir}/containers/oci
150
%dir %{_sysconfdir}/containers/oci/hooks.d
151
%dir %{_sysconfdir}/containers/registries.d
152
%dir %{_datadir}/containers
153
%dir %{_datadir}/containers/oci
154
%dir %{_datadir}/containers/oci/hooks.d
155
156
%config(noreplace) %{_sysconfdir}/containers/policy.json
157
%config(noreplace) %{_sysconfdir}/containers/storage.conf
158
%config(noreplace) %{_sysconfdir}/containers/mounts.conf
159
%{_datadir}/containers/mounts.conf
160
%config(noreplace) %{_sysconfdir}/containers/registries.conf
161
%config(noreplace) %{_sysconfdir}/containers/seccomp.json
162
%config(noreplace) %{_sysconfdir}/containers/registries.d/default.yaml
163
%{_datadir}/containers/seccomp.json
164
%{_datadir}/containers/containers.conf
165
166
%{_mandir}/man1/*.1%{?ext_man}
167
%{_mandir}/man5/*.5%{?ext_man}
168
%license LICENSE
169
170
%changelog
171