1 |
commit: 21bf005cd5ebd9245ee07c183a93b0deae574a66 |
2 |
Author: Pacho Ramos <pacho <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Mar 26 21:12:29 2018 +0000 |
4 |
Commit: Pacho Ramos <pacho <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Mar 26 21:12:29 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=21bf005c |
7 |
|
8 |
sys-apps/systemd: Apply upstream patch to fix check for address to keep interface names stable (also fixing bug #651414 affecting NM failing to reconnect properly after suspend). |
9 |
|
10 |
Package-Manager: Portage-2.3.24, Repoman-2.3.6 |
11 |
|
12 |
...-check-for-address-to-keep-interface-8458.patch | 37 ++ |
13 |
sys-apps/systemd/systemd-238-r2.ebuild | 437 +++++++++++++++++++++ |
14 |
2 files changed, 474 insertions(+) |
15 |
|
16 |
diff --git a/sys-apps/systemd/files/238-0003-udev-net-id-Fix-check-for-address-to-keep-interface-8458.patch b/sys-apps/systemd/files/238-0003-udev-net-id-Fix-check-for-address-to-keep-interface-8458.patch |
17 |
new file mode 100644 |
18 |
index 00000000000..693d67152ea |
19 |
--- /dev/null |
20 |
+++ b/sys-apps/systemd/files/238-0003-udev-net-id-Fix-check-for-address-to-keep-interface-8458.patch |
21 |
@@ -0,0 +1,37 @@ |
22 |
+From 8eebb6a9e5e74ec0ef40902e2da53d24559b94a4 Mon Sep 17 00:00:00 2001 |
23 |
+From: Filipe Brandenburger <filbranden@××××××.com> |
24 |
+Date: Thu, 15 Mar 2018 10:42:38 -0700 |
25 |
+Subject: [PATCH] udev/net-id: Fix check for address to keep interface names |
26 |
+ stable (#8458) |
27 |
+ |
28 |
+This was a bug inadvertently added by commit 73fc96c8ac0aa9. |
29 |
+ |
30 |
+The intent of the check is to "match slot address with device by |
31 |
+stripping the function" (as the comment above states it), for example |
32 |
+match network device PCI address 0000:05:00.0 (including a .0 for |
33 |
+function) to PCI slot address 0000:05:00, but changing that to a streq() |
34 |
+call prevented the match. |
35 |
+ |
36 |
+Change that to startswith(), which should both fix the bug and make the |
37 |
+intent of the check more clear and prevent unintentional bugs from being |
38 |
+introduced by future refactorings. |
39 |
+--- |
40 |
+ src/udev/udev-builtin-net_id.c | 2 +- |
41 |
+ 1 file changed, 1 insertion(+), 1 deletion(-) |
42 |
+ |
43 |
+diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c |
44 |
+index 36994360c7..6efa712930 100644 |
45 |
+--- a/src/udev/udev-builtin-net_id.c |
46 |
++++ b/src/udev/udev-builtin-net_id.c |
47 |
+@@ -297,7 +297,7 @@ static int dev_pci_slot(struct udev_device *dev, struct netnames *names) { |
48 |
+ if (snprintf_ok(str, sizeof str, "%s/%s/address", slots, dent->d_name) && |
49 |
+ read_one_line_file(str, &address) >= 0) |
50 |
+ /* match slot address with device by stripping the function */ |
51 |
+- if (streq(address, udev_device_get_sysname(names->pcidev))) |
52 |
++ if (startswith(udev_device_get_sysname(names->pcidev), address)) |
53 |
+ hotplug_slot = i; |
54 |
+ |
55 |
+ if (hotplug_slot > 0) |
56 |
+-- |
57 |
+2.16.2 |
58 |
+ |
59 |
|
60 |
diff --git a/sys-apps/systemd/systemd-238-r2.ebuild b/sys-apps/systemd/systemd-238-r2.ebuild |
61 |
new file mode 100644 |
62 |
index 00000000000..c4951b63a00 |
63 |
--- /dev/null |
64 |
+++ b/sys-apps/systemd/systemd-238-r2.ebuild |
65 |
@@ -0,0 +1,437 @@ |
66 |
+# Copyright 1999-2018 Gentoo Foundation |
67 |
+# Distributed under the terms of the GNU General Public License v2 |
68 |
+ |
69 |
+EAPI=6 |
70 |
+ |
71 |
+if [[ ${PV} == 9999 ]]; then |
72 |
+ EGIT_REPO_URI="https://github.com/systemd/systemd.git" |
73 |
+ inherit git-r3 |
74 |
+else |
75 |
+ SRC_URI="https://github.com/systemd/systemd/archive/v${PV}/${P}.tar.gz" |
76 |
+ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~ia64 ~mips ~ppc ~ppc64 ~x86" |
77 |
+fi |
78 |
+ |
79 |
+PYTHON_COMPAT=( python{3_4,3_5,3_6} ) |
80 |
+ |
81 |
+inherit bash-completion-r1 linux-info meson multilib-minimal ninja-utils pam python-any-r1 systemd toolchain-funcs udev user |
82 |
+ |
83 |
+DESCRIPTION="System and service manager for Linux" |
84 |
+HOMEPAGE="https://www.freedesktop.org/wiki/Software/systemd" |
85 |
+ |
86 |
+LICENSE="GPL-2 LGPL-2.1 MIT public-domain" |
87 |
+SLOT="0/2" |
88 |
+IUSE="acl apparmor audit build cryptsetup curl elfutils +gcrypt gnuefi http idn importd +kmod libidn2 +lz4 lzma nat pam pcre policykit qrcode +seccomp selinux ssl +sysv-utils test usrmerge vanilla xkb" |
89 |
+ |
90 |
+REQUIRED_USE="importd? ( curl gcrypt lzma )" |
91 |
+RESTRICT="!test? ( test )" |
92 |
+ |
93 |
+MINKV="3.11" |
94 |
+ |
95 |
+COMMON_DEPEND=">=sys-apps/util-linux-2.30:0=[${MULTILIB_USEDEP}] |
96 |
+ sys-libs/libcap:0=[${MULTILIB_USEDEP}] |
97 |
+ !<sys-libs/glibc-2.16 |
98 |
+ acl? ( sys-apps/acl:0= ) |
99 |
+ apparmor? ( sys-libs/libapparmor:0= ) |
100 |
+ audit? ( >=sys-process/audit-2:0= ) |
101 |
+ cryptsetup? ( >=sys-fs/cryptsetup-1.6:0= ) |
102 |
+ curl? ( net-misc/curl:0= ) |
103 |
+ elfutils? ( >=dev-libs/elfutils-0.158:0= ) |
104 |
+ gcrypt? ( >=dev-libs/libgcrypt-1.4.5:0=[${MULTILIB_USEDEP}] ) |
105 |
+ http? ( |
106 |
+ >=net-libs/libmicrohttpd-0.9.33:0= |
107 |
+ ssl? ( >=net-libs/gnutls-3.1.4:0= ) |
108 |
+ ) |
109 |
+ idn? ( |
110 |
+ libidn2? ( net-dns/libidn2 ) |
111 |
+ !libidn2? ( net-dns/libidn ) |
112 |
+ ) |
113 |
+ importd? ( |
114 |
+ app-arch/bzip2:0= |
115 |
+ sys-libs/zlib:0= |
116 |
+ ) |
117 |
+ kmod? ( >=sys-apps/kmod-15:0= ) |
118 |
+ lz4? ( >=app-arch/lz4-0_p131:0=[${MULTILIB_USEDEP}] ) |
119 |
+ lzma? ( >=app-arch/xz-utils-5.0.5-r1:0=[${MULTILIB_USEDEP}] ) |
120 |
+ nat? ( net-firewall/iptables:0= ) |
121 |
+ pam? ( virtual/pam:=[${MULTILIB_USEDEP}] ) |
122 |
+ pcre? ( dev-libs/libpcre2 ) |
123 |
+ qrcode? ( media-gfx/qrencode:0= ) |
124 |
+ seccomp? ( >=sys-libs/libseccomp-2.3.3:0= ) |
125 |
+ selinux? ( sys-libs/libselinux:0= ) |
126 |
+ xkb? ( >=x11-libs/libxkbcommon-0.4.1:0= ) |
127 |
+ abi_x86_32? ( !<=app-emulation/emul-linux-x86-baselibs-20130224-r9 |
128 |
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)] )" |
129 |
+ |
130 |
+# baselayout-2.2 has /run |
131 |
+RDEPEND="${COMMON_DEPEND} |
132 |
+ >=sys-apps/baselayout-2.2 |
133 |
+ selinux? ( sec-policy/selinux-base-policy[systemd] ) |
134 |
+ sysv-utils? ( !sys-apps/sysvinit ) |
135 |
+ !sysv-utils? ( sys-apps/sysvinit ) |
136 |
+ !build? ( || ( |
137 |
+ sys-apps/util-linux[kill(-)] |
138 |
+ sys-process/procps[kill(+)] |
139 |
+ sys-apps/coreutils[kill(-)] |
140 |
+ ) ) |
141 |
+ !sys-auth/nss-myhostname |
142 |
+ !<sys-kernel/dracut-044 |
143 |
+ !sys-fs/eudev |
144 |
+ !sys-fs/udev" |
145 |
+ |
146 |
+# sys-apps/dbus: the daemon only (+ build-time lib dep for tests) |
147 |
+PDEPEND=">=sys-apps/dbus-1.9.8[systemd] |
148 |
+ >=sys-apps/hwids-20150417[udev] |
149 |
+ >=sys-fs/udev-init-scripts-25 |
150 |
+ policykit? ( sys-auth/polkit ) |
151 |
+ !vanilla? ( sys-apps/gentoo-systemd-integration )" |
152 |
+ |
153 |
+# Newer linux-headers needed by ia64, bug #480218 |
154 |
+DEPEND="${COMMON_DEPEND} |
155 |
+ app-arch/xz-utils:0 |
156 |
+ dev-util/gperf |
157 |
+ >=dev-util/intltool-0.50 |
158 |
+ >=sys-apps/coreutils-8.16 |
159 |
+ >=sys-kernel/linux-headers-${MINKV} |
160 |
+ virtual/pkgconfig |
161 |
+ gnuefi? ( >=sys-boot/gnu-efi-3.0.2 ) |
162 |
+ test? ( sys-apps/dbus ) |
163 |
+ app-text/docbook-xml-dtd:4.2 |
164 |
+ app-text/docbook-xml-dtd:4.5 |
165 |
+ app-text/docbook-xsl-stylesheets |
166 |
+ dev-libs/libxslt:0 |
167 |
+ $(python_gen_any_dep 'dev-python/lxml[${PYTHON_USEDEP}]') |
168 |
+" |
169 |
+ |
170 |
+pkg_pretend() { |
171 |
+ if [[ ${MERGE_TYPE} != buildonly ]]; then |
172 |
+ local CONFIG_CHECK="~AUTOFS4_FS ~BLK_DEV_BSG ~CGROUPS |
173 |
+ ~CHECKPOINT_RESTORE ~DEVTMPFS ~EPOLL ~FANOTIFY ~FHANDLE |
174 |
+ ~INOTIFY_USER ~IPV6 ~NET ~NET_NS ~PROC_FS ~SIGNALFD ~SYSFS |
175 |
+ ~TIMERFD ~TMPFS_XATTR ~UNIX |
176 |
+ ~CRYPTO_HMAC ~CRYPTO_SHA256 ~CRYPTO_USER_API_HASH |
177 |
+ ~!FW_LOADER_USER_HELPER_FALLBACK ~!GRKERNSEC_PROC ~!IDE ~!SYSFS_DEPRECATED |
178 |
+ ~!SYSFS_DEPRECATED_V2" |
179 |
+ |
180 |
+ use acl && CONFIG_CHECK+=" ~TMPFS_POSIX_ACL" |
181 |
+ use seccomp && CONFIG_CHECK+=" ~SECCOMP ~SECCOMP_FILTER" |
182 |
+ kernel_is -lt 3 7 && CONFIG_CHECK+=" ~HOTPLUG" |
183 |
+ kernel_is -lt 4 7 && CONFIG_CHECK+=" ~DEVPTS_MULTIPLE_INSTANCES" |
184 |
+ kernel_is -ge 4 10 && CONFIG_CHECK+=" ~CGROUP_BPF" |
185 |
+ |
186 |
+ if linux_config_exists; then |
187 |
+ local uevent_helper_path=$(linux_chkconfig_string UEVENT_HELPER_PATH) |
188 |
+ if [[ -n ${uevent_helper_path} ]] && [[ ${uevent_helper_path} != '""' ]]; then |
189 |
+ ewarn "It's recommended to set an empty value to the following kernel config option:" |
190 |
+ ewarn "CONFIG_UEVENT_HELPER_PATH=${uevent_helper_path}" |
191 |
+ fi |
192 |
+ if linux_chkconfig_present X86; then |
193 |
+ CONFIG_CHECK+=" ~DMIID" |
194 |
+ fi |
195 |
+ fi |
196 |
+ |
197 |
+ if kernel_is -lt ${MINKV//./ }; then |
198 |
+ ewarn "Kernel version at least ${MINKV} required" |
199 |
+ fi |
200 |
+ |
201 |
+ check_extra_config |
202 |
+ fi |
203 |
+} |
204 |
+ |
205 |
+pkg_setup() { |
206 |
+ : |
207 |
+} |
208 |
+ |
209 |
+src_unpack() { |
210 |
+ default |
211 |
+ [[ ${PV} != 9999 ]] || git-r3_src_unpack |
212 |
+} |
213 |
+ |
214 |
+src_prepare() { |
215 |
+ local PATCHES=( |
216 |
+ "${FILESDIR}/238-0001-sd-bus-do-not-try-to-close-already-closed-fd-8392.patch" |
217 |
+ "${FILESDIR}/238-0002-core-do-not-free-heap-allocated-strings-8391.patch" |
218 |
+ "${FILESDIR}/238-0003-udev-net-id-Fix-check-for-address-to-keep-interface-8458.patch" |
219 |
+ ) |
220 |
+ |
221 |
+ [[ -d "${WORKDIR}"/patches ]] && PATCHES+=( "${WORKDIR}"/patches ) |
222 |
+ |
223 |
+ if ! use vanilla; then |
224 |
+ PATCHES+=( |
225 |
+ "${FILESDIR}/gentoo-Dont-enable-audit-by-default.patch" |
226 |
+ "${FILESDIR}/gentoo-systemd-user-pam.patch" |
227 |
+ "${FILESDIR}/gentoo-uucp-group-r1.patch" |
228 |
+ "${FILESDIR}/gentoo-generator-path.patch" |
229 |
+ ) |
230 |
+ fi |
231 |
+ |
232 |
+ default |
233 |
+} |
234 |
+ |
235 |
+src_configure() { |
236 |
+ # Prevent conflicts with i686 cross toolchain, bug 559726 |
237 |
+ tc-export AR CC NM OBJCOPY RANLIB |
238 |
+ |
239 |
+ python_setup |
240 |
+ |
241 |
+ multilib-minimal_src_configure |
242 |
+} |
243 |
+ |
244 |
+meson_use() { |
245 |
+ usex "$1" true false |
246 |
+} |
247 |
+ |
248 |
+meson_multilib() { |
249 |
+ if multilib_is_native_abi; then |
250 |
+ echo true |
251 |
+ else |
252 |
+ echo false |
253 |
+ fi |
254 |
+} |
255 |
+ |
256 |
+meson_multilib_native_use() { |
257 |
+ if multilib_is_native_abi && use "$1"; then |
258 |
+ echo true |
259 |
+ else |
260 |
+ echo false |
261 |
+ fi |
262 |
+} |
263 |
+ |
264 |
+multilib_src_configure() { |
265 |
+ local myconf=( |
266 |
+ --localstatedir="${EPREFIX}/var" |
267 |
+ -Dpamlibdir="$(getpam_mod_dir)" |
268 |
+ # avoid bash-completion dep |
269 |
+ -Dbashcompletiondir="$(get_bashcompdir)" |
270 |
+ # make sure we get /bin:/sbin in PATH |
271 |
+ -Dsplit-usr=$(usex usrmerge false true) |
272 |
+ -Drootprefix="$(usex usrmerge "${EPREFIX}/usr" "${EPREFIX:-/}")" |
273 |
+ -Dsysvinit-path= |
274 |
+ -Dsysvrcnd-path= |
275 |
+ # Avoid infinite exec recursion, bug 642724 |
276 |
+ -Dtelinit-path="${EPREFIX}/lib/sysvinit/telinit" |
277 |
+ # no deps |
278 |
+ -Defi=$(meson_multilib) |
279 |
+ -Dima=true |
280 |
+ # Optional components/dependencies |
281 |
+ -Dacl=$(meson_multilib_native_use acl) |
282 |
+ -Dapparmor=$(meson_multilib_native_use apparmor) |
283 |
+ -Daudit=$(meson_multilib_native_use audit) |
284 |
+ -Dlibcryptsetup=$(meson_multilib_native_use cryptsetup) |
285 |
+ -Dlibcurl=$(meson_multilib_native_use curl) |
286 |
+ -Delfutils=$(meson_multilib_native_use elfutils) |
287 |
+ -Dgcrypt=$(meson_use gcrypt) |
288 |
+ -Dgnu-efi=$(meson_multilib_native_use gnuefi) |
289 |
+ -Defi-libdir="${EPREFIX}/usr/$(get_libdir)" |
290 |
+ -Dmicrohttpd=$(meson_multilib_native_use http) |
291 |
+ $(usex http -Dgnutls=$(meson_multilib_native_use ssl) -Dgnutls=false) |
292 |
+ -Dimportd=$(meson_multilib_native_use importd) |
293 |
+ -Dbzip2=$(meson_multilib_native_use importd) |
294 |
+ -Dzlib=$(meson_multilib_native_use importd) |
295 |
+ -Dkmod=$(meson_multilib_native_use kmod) |
296 |
+ -Dlz4=$(meson_use lz4) |
297 |
+ -Dxz=$(meson_use lzma) |
298 |
+ -Dlibiptc=$(meson_multilib_native_use nat) |
299 |
+ -Dpam=$(meson_use pam) |
300 |
+ -Dpcre2=$(meson_multilib_native_use pcre) |
301 |
+ -Dpolkit=$(meson_multilib_native_use policykit) |
302 |
+ -Dqrencode=$(meson_multilib_native_use qrcode) |
303 |
+ -Dseccomp=$(meson_multilib_native_use seccomp) |
304 |
+ -Dselinux=$(meson_multilib_native_use selinux) |
305 |
+ #-Dtests=$(meson_multilib_native_use test) |
306 |
+ -Ddbus=$(meson_multilib_native_use test) |
307 |
+ -Dxkbcommon=$(meson_multilib_native_use xkb) |
308 |
+ # hardcode a few paths to spare some deps |
309 |
+ -Dkill-path=/bin/kill |
310 |
+ -Dntp-servers="0.gentoo.pool.ntp.org 1.gentoo.pool.ntp.org 2.gentoo.pool.ntp.org 3.gentoo.pool.ntp.org" |
311 |
+ # Breaks screen, tmux, etc. |
312 |
+ -Ddefault-kill-user-processes=false |
313 |
+ |
314 |
+ # multilib options |
315 |
+ -Dbacklight=$(meson_multilib) |
316 |
+ -Dbinfmt=$(meson_multilib) |
317 |
+ -Dcoredump=$(meson_multilib) |
318 |
+ -Denvironment-d=$(meson_multilib) |
319 |
+ -Dfirstboot=$(meson_multilib) |
320 |
+ -Dhibernate=$(meson_multilib) |
321 |
+ -Dhostnamed=$(meson_multilib) |
322 |
+ -Dhwdb=$(meson_multilib) |
323 |
+ -Dldconfig=$(meson_multilib) |
324 |
+ -Dlocaled=$(meson_multilib) |
325 |
+ -Dman=$(meson_multilib) |
326 |
+ -Dnetworkd=$(meson_multilib) |
327 |
+ -Dquotacheck=$(meson_multilib) |
328 |
+ -Drandomseed=$(meson_multilib) |
329 |
+ -Drfkill=$(meson_multilib) |
330 |
+ -Dsysusers=$(meson_multilib) |
331 |
+ -Dtimedated=$(meson_multilib) |
332 |
+ -Dtimesyncd=$(meson_multilib) |
333 |
+ -Dtmpfiles=$(meson_multilib) |
334 |
+ -Dvconsole=$(meson_multilib) |
335 |
+ ) |
336 |
+ |
337 |
+ if multilib_is_native_abi && use idn; then |
338 |
+ myconf+=( |
339 |
+ -Dlibidn2=$(usex libidn2 true false) |
340 |
+ -Dlibidn=$(usex libidn2 false true) |
341 |
+ ) |
342 |
+ else |
343 |
+ myconf+=( |
344 |
+ -Dlibidn2=false |
345 |
+ -Dlibidn=false |
346 |
+ ) |
347 |
+ fi |
348 |
+ |
349 |
+ meson_src_configure "${myconf[@]}" |
350 |
+} |
351 |
+ |
352 |
+multilib_src_compile() { |
353 |
+ eninja |
354 |
+} |
355 |
+ |
356 |
+multilib_src_test() { |
357 |
+ eninja test |
358 |
+} |
359 |
+ |
360 |
+multilib_src_install() { |
361 |
+ DESTDIR="${D}" eninja install |
362 |
+} |
363 |
+ |
364 |
+multilib_src_install_all() { |
365 |
+ # meson doesn't know about docdir |
366 |
+ mv "${ED%/}"/usr/share/doc/{systemd,${PF}} || die |
367 |
+ |
368 |
+ einstalldocs |
369 |
+ dodoc "${FILESDIR}"/nsswitch.conf |
370 |
+ |
371 |
+ if ! use sysv-utils; then |
372 |
+ local rootprefix=$(usex usrmerge /usr '') |
373 |
+ rm "${ED%/}${rootprefix}"/sbin/{halt,init,poweroff,reboot,runlevel,shutdown,telinit} || die |
374 |
+ rmdir "${ED%/}${rootprefix}"/sbin || die |
375 |
+ rm "${ED%/}"/usr/share/man/man1/init.1 || die |
376 |
+ rm "${ED%/}"/usr/share/man/man8/{halt,poweroff,reboot,runlevel,shutdown,telinit}.8 || die |
377 |
+ fi |
378 |
+ |
379 |
+ # Preserve empty dirs in /etc & /var, bug #437008 |
380 |
+ keepdir /etc/{binfmt.d,modules-load.d,tmpfiles.d} |
381 |
+ keepdir /etc/systemd/{ntp-units.d,user} /var/lib/systemd |
382 |
+ keepdir /etc/udev/{hwdb.d,rules.d} |
383 |
+ keepdir /var/log/journal/remote |
384 |
+ |
385 |
+ # Symlink /etc/sysctl.conf for easy migration. |
386 |
+ dosym ../sysctl.conf /etc/sysctl.d/99-sysctl.conf |
387 |
+ |
388 |
+ # If we install these symlinks, there is no way for the sysadmin to remove them |
389 |
+ # permanently. |
390 |
+ rm -f "${ED%/}"/etc/systemd/system/multi-user.target.wants/systemd-networkd.service || die |
391 |
+ rm -f "${ED%/}"/etc/systemd/system/dbus-org.freedesktop.network1.service || die |
392 |
+ rm -f "${ED%/}"/etc/systemd/system/multi-user.target.wants/systemd-resolved.service || die |
393 |
+ rm -f "${ED%/}"/etc/systemd/system/dbus-org.freedesktop.resolve1.service || die |
394 |
+ rm -fr "${ED%/}"/etc/systemd/system/network-online.target.wants || die |
395 |
+ rm -fr "${ED%/}"/etc/systemd/system/sockets.target.wants || die |
396 |
+ rm -fr "${ED%/}"/etc/systemd/system/sysinit.target.wants || die |
397 |
+ |
398 |
+ local udevdir=/lib/udev |
399 |
+ use usrmerge && udevdir=/usr/lib/udev |
400 |
+ |
401 |
+ rm -r "${ED%/}${udevdir}/hwdb.d" || die |
402 |
+ |
403 |
+ if ! use usrmerge; then |
404 |
+ # Avoid breaking boot/reboot |
405 |
+ dosym ../../../lib/systemd/systemd /usr/lib/systemd/systemd |
406 |
+ dosym ../../../lib/systemd/systemd-shutdown /usr/lib/systemd/systemd-shutdown |
407 |
+ fi |
408 |
+} |
409 |
+ |
410 |
+migrate_locale() { |
411 |
+ local envd_locale_def="${EROOT%/}/etc/env.d/02locale" |
412 |
+ local envd_locale=( "${EROOT%/}"/etc/env.d/??locale ) |
413 |
+ local locale_conf="${EROOT%/}/etc/locale.conf" |
414 |
+ |
415 |
+ if [[ ! -L ${locale_conf} && ! -e ${locale_conf} ]]; then |
416 |
+ # If locale.conf does not exist... |
417 |
+ if [[ -e ${envd_locale} ]]; then |
418 |
+ # ...either copy env.d/??locale if there's one |
419 |
+ ebegin "Moving ${envd_locale} to ${locale_conf}" |
420 |
+ mv "${envd_locale}" "${locale_conf}" |
421 |
+ eend ${?} || FAIL=1 |
422 |
+ else |
423 |
+ # ...or create a dummy default |
424 |
+ ebegin "Creating ${locale_conf}" |
425 |
+ cat > "${locale_conf}" <<-EOF |
426 |
+ # This file has been created by the sys-apps/systemd ebuild. |
427 |
+ # See locale.conf(5) and localectl(1). |
428 |
+ |
429 |
+ # LANG=${LANG} |
430 |
+ EOF |
431 |
+ eend ${?} || FAIL=1 |
432 |
+ fi |
433 |
+ fi |
434 |
+ |
435 |
+ if [[ ! -L ${envd_locale} ]]; then |
436 |
+ # now, if env.d/??locale is not a symlink (to locale.conf)... |
437 |
+ if [[ -e ${envd_locale} ]]; then |
438 |
+ # ...warn the user that he has duplicate locale settings |
439 |
+ ewarn |
440 |
+ ewarn "To ensure consistent behavior, you should replace ${envd_locale}" |
441 |
+ ewarn "with a symlink to ${locale_conf}. Please migrate your settings" |
442 |
+ ewarn "and create the symlink with the following command:" |
443 |
+ ewarn "ln -s -n -f ../locale.conf ${envd_locale}" |
444 |
+ ewarn |
445 |
+ else |
446 |
+ # ...or just create the symlink if there's nothing here |
447 |
+ ebegin "Creating ${envd_locale_def} -> ../locale.conf symlink" |
448 |
+ ln -n -s ../locale.conf "${envd_locale_def}" |
449 |
+ eend ${?} || FAIL=1 |
450 |
+ fi |
451 |
+ fi |
452 |
+} |
453 |
+ |
454 |
+pkg_postinst() { |
455 |
+ newusergroup() { |
456 |
+ enewgroup "$1" |
457 |
+ enewuser "$1" -1 -1 -1 "$1" |
458 |
+ } |
459 |
+ |
460 |
+ enewgroup input |
461 |
+ enewgroup kvm 78 |
462 |
+ enewgroup render |
463 |
+ enewgroup systemd-journal |
464 |
+ newusergroup systemd-bus-proxy |
465 |
+ newusergroup systemd-coredump |
466 |
+ newusergroup systemd-journal-gateway |
467 |
+ newusergroup systemd-journal-remote |
468 |
+ newusergroup systemd-journal-upload |
469 |
+ newusergroup systemd-network |
470 |
+ newusergroup systemd-resolve |
471 |
+ newusergroup systemd-timesync |
472 |
+ |
473 |
+ systemd_update_catalog |
474 |
+ |
475 |
+ # Keep this here in case the database format changes so it gets updated |
476 |
+ # when required. Despite that this file is owned by sys-apps/hwids. |
477 |
+ if has_version "sys-apps/hwids[udev]"; then |
478 |
+ udevadm hwdb --update --root="${EROOT%/}" |
479 |
+ fi |
480 |
+ |
481 |
+ udev_reload || FAIL=1 |
482 |
+ |
483 |
+ # Bug 465468, make sure locales are respect, and ensure consistency |
484 |
+ # between OpenRC & systemd |
485 |
+ migrate_locale |
486 |
+ |
487 |
+ systemd_reenable systemd-networkd.service systemd-resolved.service |
488 |
+ |
489 |
+ if [[ ${FAIL} ]]; then |
490 |
+ eerror "One of the postinst commands failed. Please check the postinst output" |
491 |
+ eerror "for errors. You may need to clean up your system and/or try installing" |
492 |
+ eerror "systemd again." |
493 |
+ eerror |
494 |
+ fi |
495 |
+} |
496 |
+ |
497 |
+pkg_prerm() { |
498 |
+ # If removing systemd completely, remove the catalog database. |
499 |
+ if [[ ! ${REPLACED_BY_VERSION} ]]; then |
500 |
+ rm -f -v "${EROOT}"/var/lib/systemd/catalog/database |
501 |
+ fi |
502 |
+} |