-
Notifications
You must be signed in to change notification settings - Fork 45
/
aaa_base.spec
294 lines (256 loc) · 8.91 KB
/
aaa_base.spec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
#
# spec file for package aaa_base
#
# Copyright (c) 2022 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
# icecream 0
#Compat macro for new _fillupdir macro introduced in Nov 2017
%if ! %{defined _fillupdir}
%define _fillupdir /var/adm/fillup-templates
%endif
%if 0%{?_build_in_place}
%define git_version %(git log '-n1' '--date=format:%Y%m%d' '--no-show-signature' "--pretty=format:+git%cd.%h")
BuildRequires: git-core
%else
# this is required for obs' source validator. It's
# 20-files-present-and-referenced ignores all conditionals. So the
# definition of git_version actually happens always.
%define git_version %{nil}
%endif
Name: aaa_base
Version: 84.87%{git_version}
Release: 0
Summary: openSUSE Base Package
License: GPL-2.0-or-later
Group: System/Fhs
URL: https://github.com/openSUSE/aaa_base
Source: aaa_base-%{version}.tar
Source1: README.packaging.txt
Source99: aaa_base-rpmlintrc
Requires: /bin/mktemp
Requires: /usr/bin/cat
Requires: /usr/bin/date
Requires: /usr/bin/grep
Requires: /usr/bin/mv
Requires: /usr/bin/sed
Requires: /usr/bin/tput
Requires: /usr/bin/xz
Requires: distribution-release
Requires: filesystem
# required for nsswitch.conf usrfiles fixes in post script
Requires(post): (glibc >= 2.30 if glibc)
Requires(post): fillup
Recommends: aaa_base-extras
Recommends: iproute2
Recommends: iputils
Recommends: logrotate
Recommends: netcfg
Recommends: udev
# do not require systemd - aaa_base is in the build environment and we don't
# want to pull in tons of dependencies
Conflicts: sysvinit-init
# run osc service mr to recreate
%description
This package installs several important configuration files and central scripts.
%package extras
Summary: SUSE Linux Base Package (recommended part)
Group: System/Fhs
Requires: %{name} = %{version}
Requires: /usr/bin/find
Requires: cpio
Requires(post): fillup
Provides: aaa_base:/etc/DIR_COLORS
%description extras
The parts of aaa_base that should be installed by default but are not
strictly required to run a system. (bash completions and convenience hacks).
%package malloccheck
Summary: SUSE Linux Base Package (malloc checking)
Group: System/Fhs
Requires: %{name} = %{version}
%description malloccheck
This package sets environment variables that enable stricter
malloc checks to catch potential heap corruptions. It's not
installed by default as it may degrade performance.
%package wsl
Summary: SUSE Linux Base Package (Windows Subsystem for Linux)
Group: System/Fhs
Requires: %{name} = %{version}
%description wsl
This package includes some special settings needed on Windows Subsystem
for Linux. It should only be installed on WSL and not on regular Linux
systems.
%package yama-enable-ptrace
Summary: sysctl setting to allow ptrace with the YAMA LSM enabled
Group: System/Fhs
Requires: %{name} = %{version}
%description yama-enable-ptrace
When the YAMA LSM is enabled, ptrace is restriced by default. On
developer systems this has an impact on e.g. strace and gdb. So
this package contains a setting that allows ptrace again.
See https://docs.kernel.org/admin-guide/LSM/Yama.html
%prep
%setup -q
%build
%make_build CFLAGS="%{optflags}" CC="%{__cc}"
%install
%make_install
mkdir -p %{buildroot}/etc/sysctl.d
#
# make sure it does not creep in again
test -d %{buildroot}/root/.gnupg && exit 1
# TODO: get rid of that at some point in the future
mkdir -p %{buildroot}/etc/init.d
for i in boot.local after.local ; do
install -m 755 /dev/null %{buildroot}/etc/init.d/$i
done
# keep as ghost for migration
touch %buildroot/etc/inittab
# Backup directories
install -d -m 755 %{buildroot}/var/adm/backup/{rpmdb,sysconfig}
mkdir -p %{buildroot}%{_fillupdir}
%if "%{_fillupdir}" != "/var/adm/fillup-templates"
for f in %{buildroot}/var/adm/fillup-templates/* ; do
test -e "$f" || continue
mv $f %{buildroot}%{_fillupdir}/
done
rm -vrf %{buildroot}/var/adm/fillup-templates
%endif
%if "%{_fillupdir}" != "/usr/share/fillup-templates"
for f in %{buildroot}/usr/share/fillup-templates/* ; do
test -e "$f" || continue
mv $f %{buildroot}%{_fillupdir}/
done
rm -vrf %{buildroot}/usr/share/fillup-templates
%endif
%pre
%service_add_pre soft-reboot-cleanup.service
%preun
%service_del_preun soft-reboot-cleanup.service
%post
export LC_ALL=C
#XXX Fix /etc/nsswitch.conf to include usrfiles [bsc#1162916]
if [ -e /etc/nsswitch.conf ]; then
for key in services protocols rpc ; do
if ! grep -q ^${key}.*usrfiles /etc/nsswitch.conf ; then
cp /etc/nsswitch.conf /etc/nsswitch.conf.pre-usrfiles.${key}
sed -i -e "s|^\(${key}:.*[[:space:]]\)files\([[:space:]].*\)*$|\1files usrfiles\2|" /etc/nsswitch.conf
fi
done
fi
%{fillup_only -n language}
%{fillup_only -n proxy}
%service_add_post soft-reboot-cleanup.service
%postun
%service_del_postun_without_restart soft-reboot-cleanup.service
%pre extras
%service_add_pre backup-rpmdb.service backup-rpmdb.timer backup-sysconfig.service backup-sysconfig.timer check-battery.service check-battery.timer
%post extras
%fillup_only -n backup
%service_add_post backup-rpmdb.service backup-rpmdb.timer backup-sysconfig.service backup-sysconfig.timer check-battery.service check-battery.timer
%preun extras
%service_del_preun backup-rpmdb.service backup-rpmdb.timer backup-sysconfig.service backup-sysconfig.timer check-battery.service check-battery.timer
%postun extras
%service_del_postun backup-rpmdb.service backup-rpmdb.timer backup-sysconfig.service backup-sysconfig.timer check-battery.service check-battery.timer
%post yama-enable-ptrace
# check if yama is active
if [ -f /proc/sys/kernel/yama/ptrace_scope ]; then
# automatically disable ptrace protection upon install if systemd is not
# available. Usually system will automatically apply the setting
if ! type -p systemd-notify > /dev/null || ! systemd-notify --booted; then
# don't do it on transactional systems to avoid altering the state of the
# system before reboot
if [ -z "${TRANSACTIONAL_UPDATE}" ]; then
# can't use sysctl since that would cause us to require procps, which is
# bad for container size
echo 0 > /proc/sys/kernel/yama/ptrace_scope || :
fi
fi
fi
%files
%license COPYING
%ghost %config(noreplace) /etc/sysctl.conf
%config /etc/bash.bashrc
%config /etc/csh.cshrc
%config /etc/csh.login
%config /etc/inputrc
%config /etc/mime.types
%config /etc/profile
/usr/etc/DIR_COLORS
/usr/etc/csh.cshrc
/usr/etc/csh.login
/usr/etc/bash.bashrc
/usr/etc/profile
/usr/etc/inputrc
/usr/etc/inputrc.keys
/usr/etc/profile.d/alljava.csh
/usr/etc/profile.d/alljava.sh
/usr/etc/profile.d/lang.csh
/usr/etc/profile.d/lang.sh
/usr/etc/profile.d/profile.csh
/usr/etc/profile.d/profile.sh
/usr/etc/profile.d/xdg-environment.csh
/usr/etc/profile.d/xdg-environment.sh
/usr/etc/profile.d/alias.ash
/usr/etc/profile.d/alias.bash
/usr/etc/profile.d/alias.tcsh
/usr/etc/profile.d/ls.tcsh
/usr/etc/profile.d/ls.bash
/usr/etc/profile.d/ls.zsh
/usr/etc/profile.d/terminal.sh
/usr/etc/profile.d/terminal.csh
%dir /usr/lib/environment.d
/usr/lib/environment.d/50-xdg.conf
/usr/lib/systemd/system/soft-reboot-cleanup.service
/usr/libexec/soft-reboot-cleanup
%{_tmpfilesdir}/soft-reboot-cleanup.conf
%config /etc/shells
%ghost %dir /etc/init.d
%ghost %config(noreplace) /etc/init.d/boot.local
%ghost %config(noreplace) /etc/init.d/after.local
%ghost %config /etc/inittab
/usr/bin/get_kernel_version
/usr/sbin/service
/usr/sbin/smart_agetty
/usr/bin/filesize
/usr/bin/old
/usr/bin/rpmlocate
/usr/sbin/sysconf_addword
/usr/share/man/man1/smart_agetty.1*
/usr/share/man/man8/service.8*
/usr/lib/sysctl.d/50-default.conf
%ifnarch %ix86 %arm
/usr/lib/sysctl.d/50-pid-max.conf
%endif
/usr/lib/sysctl.d/51-network.conf
%{_fillupdir}/sysconfig.language
%{_fillupdir}/sysconfig.proxy
%files extras
/usr/etc/skel/.emacs
/usr/etc/skel/.inputrc
%dir /usr/lib/base-scripts
/usr/lib/base-scripts/backup-rpmdb
/usr/lib/base-scripts/backup-sysconfig
/usr/lib/base-scripts/check-battery
/usr/lib/systemd/system/[bc]*
/var/adm/backup/rpmdb
/var/adm/backup/sysconfig
%{_fillupdir}/sysconfig.backup
%files malloccheck
/usr/etc/profile.d/malloc-debug.sh
/usr/etc/profile.d/malloc-debug.csh
%files wsl
/usr/etc/profile.d/wsl.csh
/usr/etc/profile.d/wsl.sh
%files yama-enable-ptrace
/usr/lib/sysctl.d/52-yama.conf
%changelog