Annotation of /trunk/core/systemd/systemd-242-r1.smage2
Parent Directory | Revision Log
Revision 33027 -
(hide annotations)
(download)
Wed Oct 9 17:59:55 2019 UTC (4 years, 11 months ago) by niro
File size: 33032 byte(s)
Wed Oct 9 17:59:55 2019 UTC (4 years, 11 months ago) by niro
File size: 33032 byte(s)
auto added: ver bump to 242-r1
1 | niro | 33026 | # $Id$ |
2 | |||
3 | PNAME="systemd" | ||
4 | PVER="242" | ||
5 | PBUILD="r1" | ||
6 | |||
7 | # 1=enable dev split packages | ||
8 | # 0=disable dev split packages | ||
9 | ENABLE_DEV_PACKAGES="0" | ||
10 | |||
11 | SPLIT_PACKAGES="libsystemd-shared systemd-systemctl libudev udev nss-myhostname libsystemd systemd-coredump systemd systemd-tools" | ||
12 | |||
13 | # dev packages | ||
14 | if [[ ${ENABLE_DEV_PACKAGES} = 1 ]] | ||
15 | then | ||
16 | SPLIT_PACKAGES+=" libudev-dev udev-dev nss-myhostname-dev systemd-dev" | ||
17 | fi | ||
18 | |||
19 | PCAT="sys-apps" | ||
20 | HOMEPAGE="http://www.freedesktop.org/wiki/Software/systemd" | ||
21 | |||
22 | # enable or disable sysvinit support | ||
23 | # 1=yes, 0=no | ||
24 | SYSVINIT_SUPPORT=0 | ||
25 | |||
26 | # enable or disable busybox support | ||
27 | # 1=yes, 0=no | ||
28 | BUSYBOX_SUPPORT=0 | ||
29 | |||
30 | # disable gtk until build with libgee is fixed | ||
31 | # 1=yes, 0=no | ||
32 | ENABLE_GTK=1 | ||
33 | |||
34 | # export this variables for preinstall | ||
35 | SPECIAL_VARS="SYSVINIT_SUPPORT BUSYBOX_SUPPORT" | ||
36 | # and this functions too | ||
37 | SPECIAL_FUNCTIONS="pkg_setup" | ||
38 | |||
39 | GLIB2_DEPEND=">= dev-libs/glib2-2.62" | ||
40 | GLIBC_DEPEND=">= virtual/glibc" | ||
41 | LIBGCC_DEPEND=">= sys-libs/libgcc-9.2" | ||
42 | XZ_DEPEND=">= virtual/xz-utils" | ||
43 | LIBGCRYPT_DEPEND=">= app-crypt/libgcrypt-1.8" | ||
44 | LIBGPGERROR_DEPEND=">= app-crypt/libgpg-error-1.36" | ||
45 | LIBNOTIFY_DEPEND=">= x11-libs/libnotify-0.7" | ||
46 | LIBGEE_DEPEND=">= dev-libs/libgee-0.20" | ||
47 | LIBCAP_DEPEND=">= sys-libs/libcap-2.27" | ||
48 | ELFUTILS_DEPEND=">= dev-libs/elfutils-libs-0.177" | ||
49 | LIBBLKID_DEPEND=">= sys-libs/libblkid-2.34" | ||
50 | LIBIDN_DEPEND=">= net-dns/libidn-1.35" | ||
51 | COMMON_DEPEND="${GLIBC_DEPEND} | ||
52 | ${LIBGCC_DEPEND} | ||
53 | ${LIBCAP_DEPEND}" | ||
54 | |||
55 | DAEMON_DEPEND="${COMMON_DEPEND} | ||
56 | ${GLIB2_DEPEND} | ||
57 | >= sys-apps/acl-2.2 | ||
58 | >= virtual/procps | ||
59 | >= sys-apps/util-linux-2.34 | ||
60 | >= sys-apps/kmod-26" | ||
61 | COREDUMP_DEPEND="${COMMON_DEPEND} | ||
62 | ${LIBGCRYPT_DEPEND} | ||
63 | ${LIBGPGERROR_DEPEND} | ||
64 | ${ELFUTILS_DEPEND}" | ||
65 | SYSTEMCTL_DEPEND="${COMMON_DEPEND} | ||
66 | ${LIBIDN_DEPEND}" | ||
67 | |||
68 | LIBUDEV_DEPEND="${COMMON_DEPEND}" | ||
69 | NSS_DEPEND="${COMMON_DEPEND} | ||
70 | ${LIBGCRYPT_DEPEND} | ||
71 | ${LIBGPGERROR_DEPEND}" | ||
72 | LIBSYSTEMD_DEPEND="${COMMON_DEPEND} | ||
73 | ${LIBGCRYPT_DEPEND} | ||
74 | ${LIBGPGERROR_DEPEND} | ||
75 | ${XZ_DEPEND}" | ||
76 | LIBSYSTEMD_SHARED_DEPEND="${COMMON_DEPEND} | ||
77 | ${LIBGCRYPT_DEPEND} | ||
78 | ${LIBBLKID_DEPEND}" | ||
79 | |||
80 | # only /etc/os-release is supported from now on | ||
81 | SYSTEMD_DEPEND="${DAEMON_DEPEND} | ||
82 | ${XZ_DEPEND} | ||
83 | ${LIBGCRYPT_DEPEND} | ||
84 | ${LIBGPGERROR_DEPEND} | ||
85 | ${LIBIDN_DEPEND} | ||
86 | >= sys-apps/mage-release-1 | ||
87 | >= sys-apps/dbus-1.10 | ||
88 | >= sys-fs/cryptsetup-2.2 | ||
89 | >= dev-libs/dbus-glib-0.110 | ||
90 | >= net-libs/libcurl-7.66 | ||
91 | >= sys-libs/pam-1.3 | ||
92 | >= sys-apps/shadow-4.6" | ||
93 | |||
94 | TOOLS_DEPEND=">= dev-python/python3-dbus-1.2 | ||
95 | >= sys-apps/polkit-0.116" | ||
96 | |||
97 | UDEV_DEPEND="${DAEMON_DEPEND} | ||
98 | >= dev-libs/libusb-compat-0.1.4 | ||
99 | >= virtual/usbutils | ||
100 | >= virtual/pciutils | ||
101 | >= sys-libs/libuuid-2.34 | ||
102 | >= sys-fs/libgudev-234" | ||
103 | |||
104 | PYTHON_DEPEND=">= dev-lang/python3-3.7 | ||
105 | >= dev-python/python3-lxml-4.3" | ||
106 | |||
107 | if [[ ${ENABLE_GTK} = 1 ]] | ||
108 | then | ||
109 | TOOLS_DEPEND="${TOOLS_DEPEND} | ||
110 | >= x11-libs/gtk3+-3.22 | ||
111 | ${LIBGEE_DEPEND} | ||
112 | ${LIBNOTIFY_DEPEND}" | ||
113 | fi | ||
114 | |||
115 | # busybox supports requires sysvinit support | ||
116 | if [[ ${BUSYBOX_SUPPORT} = 1 ]] | ||
117 | then | ||
118 | [[ ${SYSVINIT_SUPPORT} != 1 ]] && SYSVINIT_SUPPORT=1 | ||
119 | fi | ||
120 | |||
121 | if [[ ${SYSVINIT_SUPPORT} = 1 ]] | ||
122 | then | ||
123 | SYSTEMD_DEPEND="${SYSTEMD_DEPEND} | ||
124 | >= sys-apps/sysvinit-2.88" | ||
125 | fi | ||
126 | |||
127 | SDEPEND="${LIBUDEV_DEPEND} | ||
128 | ${NSS_DEPEND} | ||
129 | ${LIBSYSTEMD_DEPEND} | ||
130 | ${LIBSYSTEMD_SHARED_DEPEND} | ||
131 | ${SYSTEMCTL_DEPEND} | ||
132 | ${SYSTEMD_DEPEND} | ||
133 | ${TOOLS_DEPEND} | ||
134 | ${UDEV_DEPEND} | ||
135 | ${PYTHON_DEPEND} | ||
136 | ${COREDUMP_DEPEND} | ||
137 | >= app-text/docbook-xsl-stylesheets-1.76 | ||
138 | >= app-text/docbook-xml-dtd42-4.2 | ||
139 | >= app-text/docbook-xml-dtd45-4.5 | ||
140 | >= dev-libs/libcgroup-0.41 | ||
141 | >= dev-libs/libxslt-1.1.32 | ||
142 | >= dev-lang/vala-0.46 | ||
143 | >= dev-util/intltool-0.51 | ||
144 | >= dev-util/gperf-3.1 | ||
145 | >= virtual/kernel-headers" | ||
146 | |||
147 | SRCFILE="v${PVER}.tar.gz" | ||
148 | SRCDIR="${BUILDDIR}/${PNAME}-${PVER}" | ||
149 | |||
150 | UDEV_CONFIG_PVER="20151110-1" | ||
151 | UDEV_CONFIG_SRCFILE="config-udev-${UDEV_CONFIG_PVER}.tar.bz2" | ||
152 | UDEV_CONFIG_SRCDIR="${BUILDDIR}/config-udev-${UDEV_CONFIG_PVER}" | ||
153 | |||
154 | if [[ ${ENABLE_GTK} = 1 ]] | ||
155 | then | ||
156 | UI_PVER="3" | ||
157 | UI_SRCFILE="${PNAME}-ui-${UI_PVER}.tar.xz" | ||
158 | UI_SRCDIR="${BUILDDIR}/${PNAME}-ui-${UI_PVER}" | ||
159 | fi | ||
160 | |||
161 | sminclude multilib python3 mtools meson cleanutils udev | ||
162 | msetfeature "!check" | ||
163 | |||
164 | SRC_URI=( | ||
165 | https://github.com/${PNAME}/${PNAME}/archive/${SRCFILE} | ||
166 | mirror://${PNAME}/${SRCFILE} | ||
167 | mirror://udev/${UDEV_CONFIG_SRCFILE} | ||
168 | mirror://${PNAME}/${PNAME}-239-magellan-configurable-getty-2.patch | ||
169 | mirror://${PNAME}/${PNAME}-236-uucp-group.patch | ||
170 | mirror://${PNAME}/${PNAME}-233-systemd-user-pam.patch | ||
171 | niro | 33027 | mirror://${PNAME}/${PNAME}-242-socket-util-put-a-limit-on-the-loop-to-flush-connections.patch |
172 | mirror://${PNAME}/${PNAME}-242-network-logs-link-state-change.patch | ||
173 | mirror://${PNAME}/${PNAME}-242-network-drop-invalid-assertion.patch | ||
174 | mirror://${PNAME}/${PNAME}-242-network-fix-assertion-when-link-get-carrier.patch | ||
175 | mirror://${PNAME}/${PNAME}-242-network-do-not-use-ordered_set_printf-for-DOMAINS-or-ROUTE_DOMAINS.patch | ||
176 | mirror://${PNAME}/${PNAME}-242-network-honor-MTUBytes-setting.patch | ||
177 | mirror://${PNAME}/${PNAME}-242-network-bump-MTU-bytes-only-when-MTUBytes-is-not-set.patch | ||
178 | mirror://${PNAME}/${PNAME}-242-network-do-not-send-ipv6-token-to-kernel.patch | ||
179 | mirror://${PNAME}/${PNAME}-242-core-set-fs.file-max-sysctl-to-LONG_MAX-rather-than-ULONG_MAX.patch | ||
180 | mirror://${PNAME}/${PNAME}-242-cgroup-util-kill-also-threads.patch | ||
181 | mirror://${PNAME}/${PNAME}-242-random-util-rename-err-to-success.patch | ||
182 | mirror://${PNAME}/${PNAME}-242-util-lib-fix-a-typo-in-rdrand.patch | ||
183 | mirror://${PNAME}/${PNAME}-242-random-util-eat-up-bad-RDRAND-values-seen-on-amd-cpus.patch | ||
184 | niro | 33026 | mirror://${PNAME}/login-manager.pamd |
185 | mirror://${PNAME}/systemd-user.pamd | ||
186 | ) | ||
187 | |||
188 | if [[ ${ENABLE_GTK} = 1 ]] | ||
189 | then | ||
190 | SRC_URI+=( http://www.freedesktop.org/software/${PNAME}/${UI_SRCFILE} ) | ||
191 | fi | ||
192 | |||
193 | UP2SEPERATOR="v" | ||
194 | UP2DATE="updatecmd https://github.com/systemd/systemd/releases | highesttarball gz" | ||
195 | |||
196 | split_info_libudev() | ||
197 | { | ||
198 | DESCRIPTION="Dynamic library to access udev device information." | ||
199 | DEPEND="${LIBUDEV_DEPEND}" | ||
200 | PCAT="sys-fs" | ||
201 | } | ||
202 | |||
203 | split_info_libudev-dev() | ||
204 | { | ||
205 | DESCRIPTION="Development files for libudev." | ||
206 | DEPEND=">= sys-fs/libudev-${PVER}" | ||
207 | PCAT="sys-fs" | ||
208 | } | ||
209 | |||
210 | split_info_udev() | ||
211 | { | ||
212 | DESCRIPTION="A Userspace Implementation for dynamic /dev nodes." | ||
213 | DEPEND="${UDEV_DEPEND} | ||
214 | == sys-fs/libudev-${PVER} | ||
215 | == sys-libs/libsystemd-shared-${PVER} | ||
216 | == sys-apps/systemd-systemctl-${PVER}" | ||
217 | PCAT="sys-fs" | ||
218 | } | ||
219 | |||
220 | split_info_udev-dev() | ||
221 | { | ||
222 | DESCRIPTION="Development files for udev." | ||
223 | DEPEND=">= sys-fs/udev-${PVER}" | ||
224 | PCAT="sys-fs" | ||
225 | } | ||
226 | |||
227 | split_info_nss-myhostname() | ||
228 | { | ||
229 | DESCRIPTION="glibc plugin for local system host name resolution." | ||
230 | DEPEND="${NSS_DEPEND}" | ||
231 | PCAT="net-dns" | ||
232 | } | ||
233 | |||
234 | split_info_nss-myhostname-dev() | ||
235 | { | ||
236 | DESCRIPTION="Development files for nss-myhostname." | ||
237 | DEPEND=">= net-dns/nss-myhostname-${PVER}" | ||
238 | PCAT="net-dns" | ||
239 | } | ||
240 | |||
241 | split_info_libsystemd() | ||
242 | { | ||
243 | DESCRIPTION="systemd library." | ||
244 | DEPEND="${LIBSYSTEMD_DEPEND}" | ||
245 | PCAT="sys-libs" | ||
246 | } | ||
247 | |||
248 | split_info_libsystemd-shared() | ||
249 | { | ||
250 | DESCRIPTION="systemd shared helper library." | ||
251 | DEPEND="${LIBSYSTEMD_SHARED_DEPEND}" | ||
252 | PCAT="sys-libs" | ||
253 | } | ||
254 | |||
255 | split_info_systemd-systemctl() | ||
256 | { | ||
257 | DESCRIPTION="systemd services control utility." | ||
258 | DEPEND="${SYSTEMCTL_DEPEND} | ||
259 | == sys-libs/libsystemd-shared-${PVER}" | ||
260 | } | ||
261 | |||
262 | split_info_systemd-coredump() | ||
263 | { | ||
264 | DESCRIPTION="systemd coredump utility." | ||
265 | DEPEND="${COREDUMP_DEPEND} | ||
266 | == sys-libs/libsystemd-shared-${PVER}" | ||
267 | } | ||
268 | |||
269 | split_info_systemd() | ||
270 | { | ||
271 | DESCRIPTION="System and Session Manager." | ||
272 | DEPEND="${SYSTEMD_DEPEND} | ||
273 | == sys-libs/libsystemd-${PVER} | ||
274 | == sys-libs/libsystemd-shared-${PVER} | ||
275 | == net-dns/nss-myhostname-${PVER} | ||
276 | == sys-apps/systemd-coredump-${PVER} | ||
277 | == sys-apps/systemd-systemctl-${PVER} | ||
278 | == sys-fs/udev-${PVER}" | ||
279 | # systemd >=195 provides now full syslog facilities | ||
280 | PROVIDE="virtual/syslog" | ||
281 | } | ||
282 | |||
283 | split_info_systemd-dev() | ||
284 | { | ||
285 | DESCRIPTION="Development files for systemd." | ||
286 | DEPEND="== sys-fs/libudev-dev-${PVER} | ||
287 | == net-dns/nss-myhostname-dev-${PVER} | ||
288 | == sys-fs/udev-dev-${PVER} | ||
289 | >= sys-apps/systemd-dev-${PVER}" | ||
290 | } | ||
291 | |||
292 | split_info_systemd-tools() | ||
293 | { | ||
294 | local gtkdesc | ||
295 | [[ ${ENABLE_GTK} = 1 ]] && gtkdesc="for gtk3/gnome and " | ||
296 | |||
297 | DESCRIPTION="Systemd utilites ${gtkdesc}for analysing the boot process." | ||
298 | DEPEND="== sys-apps/systemd-${PVER} | ||
299 | == sys-libs/libsystemd-shared-${PVER} | ||
300 | ${TOOLS_DEPEND}" | ||
301 | } | ||
302 | |||
303 | pkg_setup() | ||
304 | { | ||
305 | # adding lock group | ||
306 | mgroupadd -o "-g 54" lock | ||
307 | # adding journal group/users | ||
308 | mgroupadd -o "-g 190" systemd-journal | ||
309 | mgroupadd -o "-g 191" systemd-journal-gateway | ||
310 | museradd -o "-u 191 -g systemd-journal-gateway -d /var/log/journal -s /bin/false" systemd-journal-gateway | ||
311 | mgroupadd -o "-g 196" systemd-journal-remote | ||
312 | museradd -o "-u 196 -g systemd-journal-remote -d /var/log/journal/remote -s /bin/false" systemd-journal-remote | ||
313 | mgroupadd -o "-g 197" systemd-journal-upload | ||
314 | museradd -o "-u 197 -g systemd-journal-upload -d /var/log/journal/upload -s /bin/false" systemd-journal-upload | ||
315 | # adding other systemd group/users | ||
316 | mgroupadd -o "-g 192" systemd-timesync | ||
317 | museradd -o "-u 192 -g systemd-timesync -l -d / -s /bin/false" systemd-timesync | ||
318 | mgroupadd -o "-g 193" systemd-network | ||
319 | museradd -o "-u 193 -g systemd-network -l -d / -s /bin/false" systemd-network | ||
320 | mgroupadd -o "-g 194" systemd-resolve | ||
321 | museradd -o "-u 194 -g systemd-resolve -l -d / -s /bin/false" systemd-resolve | ||
322 | mgroupadd -o "-g 195" systemd-bus-proxy | ||
323 | museradd -o "-u 195 -g systemd-bus-proxy -l -d / -s /bin/false" systemd-bus-proxy | ||
324 | } | ||
325 | |||
326 | src_prepare() | ||
327 | { | ||
328 | munpack ${SRCFILE} || die | ||
329 | oldmunpack ${UDEV_CONFIG_SRCFILE} || die | ||
330 | if [[ ${ENABLE_GTK} = 1 ]] | ||
331 | then | ||
332 | SRCDIR="${UI_SRCDIR}" munpack ${UI_SRCFILE} || die | ||
333 | fi | ||
334 | |||
335 | niro | 33027 | # upstream patches: |
336 | mpatch ${PNAME}-242-socket-util-put-a-limit-on-the-loop-to-flush-connections.patch || die | ||
337 | mpatch ${PNAME}-242-network-logs-link-state-change.patch || die | ||
338 | mpatch ${PNAME}-242-network-drop-invalid-assertion.patch || die | ||
339 | mpatch ${PNAME}-242-network-fix-assertion-when-link-get-carrier.patch || die | ||
340 | mpatch ${PNAME}-242-network-do-not-use-ordered_set_printf-for-DOMAINS-or-ROUTE_DOMAINS.patch || die | ||
341 | mpatch ${PNAME}-242-network-honor-MTUBytes-setting.patch || die | ||
342 | mpatch ${PNAME}-242-network-bump-MTU-bytes-only-when-MTUBytes-is-not-set.patch || die | ||
343 | #mpatch ${PNAME}-242-network-do-not-send-ipv6-token-to-kernel.patch || die | ||
344 | mpatch ${PNAME}-242-core-set-fs.file-max-sysctl-to-LONG_MAX-rather-than-ULONG_MAX.patch || die | ||
345 | mpatch ${PNAME}-242-cgroup-util-kill-also-threads.patch || die | ||
346 | mpatch ${PNAME}-242-random-util-rename-err-to-success.patch || die | ||
347 | mpatch ${PNAME}-242-util-lib-fix-a-typo-in-rdrand.patch || die | ||
348 | mpatch ${PNAME}-242-random-util-eat-up-bad-RDRAND-values-seen-on-amd-cpus.patch || die | ||
349 | |||
350 | niro | 33026 | # magellan-only: use a configurable getty |
351 | mpatch ${PNAME}-239-magellan-configurable-getty-2.patch || die | ||
352 | |||
353 | # replace dialout group with uucp for ttys | ||
354 | mpatch ${PNAME}-236-uucp-group.patch || die | ||
355 | |||
356 | # honor pam system-auth | ||
357 | mpatch ${PNAME}-233-systemd-user-pam.patch || die | ||
358 | |||
359 | # fix rootlink install location | ||
360 | sed -i "s:^\(udevdir=\).*:\1/usr/lib/udev:" ${UDEV_CONFIG_SRCDIR}/Makefile || die | ||
361 | } | ||
362 | |||
363 | src_compile() | ||
364 | { | ||
365 | local myconf | ||
366 | |||
367 | meson_setup_builddir || die | ||
368 | |||
369 | # fixes build errors, enforce utf-8 | ||
370 | export LC_ALL=en_US.UTF-8 | ||
371 | |||
372 | # disable dnssec | ||
373 | myconf+=" $(meson_opt default-dnssec no)" | ||
374 | |||
375 | # disable kill user processes as this will prevent screen and tmux from working correctly | ||
376 | # see: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=825394 | ||
377 | # https://bugs.freedesktop.org/show_bug.cgi?id=94508 | ||
378 | # https://bbs.archlinux.org/viewtopic.php?id=204307 | ||
379 | # https://github.com/systemd/systemd/issues/2900 | ||
380 | myconf+=" $(meson_opt kill-user-processes false)" | ||
381 | |||
382 | # no rpm macros | ||
383 | myconf+=" $(meson_opt rpmmacrosdir no)" | ||
384 | |||
385 | meson_configure \ | ||
386 | --libexecdir=/usr/lib \ | ||
387 | --localstatedir=/var \ | ||
388 | $(meson_opt pamlibdir /usr/'$(mlibdir)'/security) \ | ||
389 | $(meson_opt ima false) \ | ||
390 | $(meson_opt audit false) \ | ||
391 | $(meson_opt selinux false) \ | ||
392 | $(meson_opt qrencode false) \ | ||
393 | $(meson_opt pam true) \ | ||
394 | $(meson_opt xz true) \ | ||
395 | $(meson_opt acl true) \ | ||
396 | $(meson_opt libcryptsetup true) \ | ||
397 | $(meson_opt sysvinit-path /etc/rc.d/init.d) \ | ||
398 | $(meson_opt sysvrcnd-path /etc/rc.d) \ | ||
399 | $(meson_opt loadkeys-path /usr/bin/loadkeys) \ | ||
400 | $(meson_opt setfont-path /usr/bin/setfont) \ | ||
401 | $(meson_opt tty-gid 4) \ | ||
402 | $(meson_opt sysusers true) \ | ||
403 | ${myconf} \ | ||
404 | || die | ||
405 | |||
406 | mninja || die | ||
407 | |||
408 | if [[ ${ENABLE_GTK} = 1 ]] | ||
409 | then | ||
410 | SRCDIR="${UI_SRCDIR}" mconfigure || die | ||
411 | SRCDIR="${UI_SRCDIR}" mmake || die | ||
412 | fi | ||
413 | } | ||
414 | |||
415 | src_install_systemd() | ||
416 | { | ||
417 | DESTDIR=${BINDIR} mninja install || die | ||
418 | |||
419 | # keep some directories | ||
420 | mkeepdir /run || die | ||
421 | mkeepdir /etc/modules-load.d || die | ||
422 | mkeepdir /etc/sysctl.d || die | ||
423 | mkeepdir /etc/tmpfiles.d || die | ||
424 | mkeepdir /etc/binfmt.d || die | ||
425 | |||
426 | # make sure the shutdown/sleep drop-in dirs exist | ||
427 | mkeepdir /usr/lib/systemd/system-shutdown || die | ||
428 | mkeepdir /usr/lib/systemd/system-sleep || die | ||
429 | |||
430 | # make sure the NTP units dir exists | ||
431 | mkeepdir /usr/lib/systemd/ntp-units.d || die | ||
432 | |||
433 | # make sure directories in /var exist | ||
434 | mkeepdir /var/lib/systemd/coredump || die | ||
435 | mkeepdir /var/lib/systemd/catalog || die | ||
436 | mkeepdir /var/lib/systemd/backlight || die | ||
437 | mkeepdir /var/lib/systemd/rfkill || die | ||
438 | mkeepdir /var/log/journal || die | ||
439 | |||
440 | if [[ ${SYSVINIT_SUPPORT} != 1 ]] | ||
441 | then | ||
442 | echo "Include SysV init Compat symlinks" | ||
443 | # create SysV compatibility symlinks. systemctl/systemd are smart | ||
444 | # enough to detect in which way they are called. | ||
445 | minstalldir /usr/sbin || die | ||
446 | mlink ../lib/systemd/systemd /usr/sbin/init || die | ||
447 | local i | ||
448 | for i in reboot halt poweroff shutdown telinit runlevel | ||
449 | do | ||
450 | mlink ../bin/systemctl /usr/sbin/${i} || die | ||
451 | done | ||
452 | else | ||
453 | echo "Using sysvinit package for SysV compat" | ||
454 | fi | ||
455 | |||
456 | # we create all wants links manually at installation time to make sure | ||
457 | # they are not owned and hence overriden by mage after the user deleted | ||
458 | # them. | ||
459 | rm -r ${BINDIR}/etc/systemd/system/*.target.wants || die | ||
460 | # but make sure these directories are properly owned | ||
461 | mkeepdir /usr/lib/systemd/system/basic.target.wants || die | ||
462 | mkeepdir /usr/lib/systemd/system/default.target.wants || die | ||
463 | mkeepdir /usr/lib/systemd/system/dbus.target.wants || die | ||
464 | mkeepdir /usr/lib/systemd/system/syslog.target.wants || die | ||
465 | # make sure the user generators dir exists too | ||
466 | mkeepdir /usr/lib/systemd/user-generators || die | ||
467 | mkeepdir /usr/lib/systemd/system-generators || die | ||
468 | |||
469 | # login-manager pam policy - force register kdm, gdm etc with pam_systemd | ||
470 | minstallpam login-manager.pamd login-manager || die | ||
471 | minstallpam systemd-user.pamd systemd-user || die | ||
472 | |||
473 | # we have no rpm, remove config macros | ||
474 | #mdelete -r /etc/rpm || die | ||
475 | |||
476 | minstalldocs DISTRO_PORTING LICENSE README TODO || die | ||
477 | |||
478 | # remove files which are owned by other packages | ||
479 | mdelete /etc/systemd/coredump.conf || die | ||
480 | mdelete /usr/bin/coredumpctl || die | ||
481 | mdelete /usr/bin/systemctl || die | ||
482 | mdelete /usr/bin/systemd-analyze || die | ||
483 | mdelete /usr/bin/kernel-install || die | ||
484 | mdelete -r /etc/udev || die | ||
485 | mdelete /usr/bin/udevadm || die | ||
486 | mdelete /usr/include/libudev.h || die | ||
487 | mdelete /usr/lib/sysctl.d/50-coredump.conf || die | ||
488 | mdelete /usr/lib/systemd/systemd-coredump || die | ||
489 | mdelete /usr/lib/systemd/systemd-udevd || die | ||
490 | mdelete /usr/lib/systemd/system/systemd-udevd-control.socket || die | ||
491 | mdelete /usr/lib/systemd/system/systemd-udevd-kernel.socket || die | ||
492 | mdelete /usr/lib/systemd/system/systemd-udevd.service || die | ||
493 | mdelete /usr/lib/systemd/system/systemd-udev-settle.service || die | ||
494 | mdelete /usr/lib/systemd/system/systemd-udev-trigger.service || die | ||
495 | mdelete /usr/lib/systemd/libsystemd-shared-\*.so || die | ||
496 | mdelete -r /usr/lib/udev || die | ||
497 | mdelete /usr/$(mlibdir)/libudev\* || die | ||
498 | mdelete /usr/$(mlibdir)/libnss_myhostname\* || die | ||
499 | mdelete /usr/$(mlibdir)/libsystemd.\* || die | ||
500 | mdelete /usr/$(mlibdir)/pkgconfig/libudev.pc || die | ||
501 | if [[ $(mlibdir) != lib ]] | ||
502 | then | ||
503 | mdelete /usr/lib/libudev\* || die | ||
504 | mdelete /usr/lib/libnss_myhostname\* || die | ||
505 | mdelete /usr/lib/libsystemd.\* || die | ||
506 | mdelete /usr/lib/pkgconfig/libudev.pc || die | ||
507 | fi | ||
508 | mdelete /usr/share/man/man1/coredumpctl.1 || die | ||
509 | mdelete /usr/share/man/man1/systemctl.1 || die | ||
510 | mdelete /usr/share/man/man5/coredump.conf.5 || die | ||
511 | mdelete /usr/share/man/man5/coredump.conf.d.5 || die | ||
512 | mdelete /usr/share/man/man8/systemd-coredump.8 || die | ||
513 | mdelete /usr/share/man/man7/udev.7 || die | ||
514 | mdelete /usr/share/man/man8/systemd-udevd.8 || die | ||
515 | mdelete /usr/share/man/man8/udevadm.8 || die | ||
516 | mdelete /usr/share/man/man8/nss-myhostname.8 || die | ||
517 | mdelete /usr/share/pkgconfig/udev.pc || die | ||
518 | |||
519 | # install udev rule for systemd | ||
520 | all-abis minstalludevrule ${BUILDDIR}/build-$(mabi)/rules/99-systemd.rules || die | ||
521 | |||
522 | # ghost own runtime generated config files | ||
523 | minstalldir /etc/X11/xorg.conf.d || die | ||
524 | memptyfile /etc/X11/xorg.conf.d/00-keyboard.conf || die | ||
525 | memptyfile /etc/machine-id || die | ||
526 | memptyfile /etc/machine-info || die | ||
527 | # and set CONFIG_PROTECT_MASK for them | ||
528 | minstalldir /etc/env.d || die | ||
529 | MCONFIG=/etc/env.d/02systemd | ||
530 | mclearconfig || die | ||
531 | maddconfig 'CONFIG_PROTECT_IGNORE="/etc/machine-id /etc/machine-info /etc/X11/xorg.conf.d/00-keyboard.conf"' || die | ||
532 | |||
533 | if [[ ${ENABLE_DEV_PACKAGES} = 1 ]] | ||
534 | then | ||
535 | mdelete -r /usr/include || die | ||
536 | mdelete -r /usr/share/bash-completion || die | ||
537 | mdelete -r /usr/share/doc || die | ||
538 | mdelete -r /usr/share/man || die | ||
539 | mdelete -r /usr/share/pkgconfig || die | ||
540 | mdelete -r /usr/share/zsh || die | ||
541 | #mdelete -r /usr/$(mlibdir)/rpm || die | ||
542 | mdelete -r /usr/$(mlibdir)/pkgconfig || die | ||
543 | if [[ $(mlibdir) != lib ]] | ||
544 | then | ||
545 | #mdelete -r /usr/$(mlibdir)/rpm || die | ||
546 | mdelete -r /usr/$(mlibdir)/pkgconfig || die | ||
547 | fi | ||
548 | fi | ||
549 | } | ||
550 | |||
551 | src_install_systemd-dev() | ||
552 | { | ||
553 | DESTDIR=${BINDIR} mninja install || die | ||
554 | minstalldocs DISTRO_PORTING LICENSE README TODO || die | ||
555 | |||
556 | # remove files which are owned by other packages | ||
557 | mdelete /usr/include/libudev.h || die | ||
558 | mdelete /usr/$(mlibdir)/pkgconfig/libudev.pc || die | ||
559 | if [[ $(mlibdir) != lib ]] | ||
560 | then | ||
561 | mdelete /usr/lib/pkgconfig/libudev.pc || die | ||
562 | fi | ||
563 | mdelete /usr/share/man/man1/coredumpctl.1 || die | ||
564 | mdelete /usr/share/man/man5/coredump.conf.5 || die | ||
565 | mdelete /usr/share/man/man5/coredump.conf.d.5 || die | ||
566 | mdelete /usr/share/man/man8/systemd-coredump.8 || die | ||
567 | mdelete /usr/share/man/man7/udev.7 || die | ||
568 | mdelete /usr/share/man/man8/systemd-udevd.8 || die | ||
569 | mdelete /usr/share/man/man8/udevadm.8 || die | ||
570 | mdelete /usr/share/man/man8/nss-myhostname.8 || die | ||
571 | mdelete /usr/share/pkgconfig/udev.pc || die | ||
572 | |||
573 | # usr/$(mlibdir)/rpm | ||
574 | # $([[ $(mlibdir) != lib ]] && echo 'usr/lib/rpm') | ||
575 | zapmost ${BINDIR} \ | ||
576 | usr/include \ | ||
577 | usr/share/bash-completion \ | ||
578 | usr/share/doc \ | ||
579 | usr/share/man \ | ||
580 | usr/share/pkgconfig \ | ||
581 | usr/share/zsh \ | ||
582 | usr/$(mlibdir)/pkgconfig \ | ||
583 | $([[ $(mlibdir) != lib ]] && echo 'usr/lib/pkgconfig') \ | ||
584 | || die | ||
585 | } | ||
586 | |||
587 | src_install_systemd-coredump() | ||
588 | { | ||
589 | DESTDIR=${BINDIR} mninja install || die | ||
590 | |||
591 | zapmost ${BINDIR} \ | ||
592 | etc/systemd/coredump.conf \ | ||
593 | usr/bin/coredumpctl \ | ||
594 | usr/lib/sysctl.d/50-coredump.conf \ | ||
595 | usr/lib/systemd/systemd-coredump \ | ||
596 | usr/share/man/man1/coredumpctl.1 \ | ||
597 | usr/share/man/man5/coredump.conf.5 \ | ||
598 | usr/share/man/man5/coredump.conf.d.5 \ | ||
599 | usr/share/man/man8/systemd-coredump.8 \ | ||
600 | || die | ||
601 | } | ||
602 | |||
603 | src_install_systemd-systemctl() | ||
604 | { | ||
605 | DESTDIR=${BINDIR} mninja install || die | ||
606 | |||
607 | zapmost ${BINDIR} \ | ||
608 | usr/bin/systemctl \ | ||
609 | usr/share/man/man1/systemctl.1 \ | ||
610 | || die | ||
611 | } | ||
612 | |||
613 | src_install_systemd-tools() | ||
614 | { | ||
615 | if [[ ${ENABLE_GTK} = 1 ]] | ||
616 | then | ||
617 | SRCDIR="${UI_SRCDIR}" mmake DESTDIR=${BINDIR} install || die | ||
618 | fi | ||
619 | |||
620 | all-abis minstallexec ${BUILDDIR}/build-$(mabi)/systemd-analyze || die | ||
621 | all-abis minstallexec ${SRCDIR}-$(mabi)/src/kernel-install/kernel-install || die | ||
622 | } | ||
623 | |||
624 | src_install_libudev() | ||
625 | { | ||
626 | DESTDIR=${BINDIR} mninja install || die | ||
627 | |||
628 | # cleanup all files but the libudev owned ones | ||
629 | zapmost ${BINDIR} \ | ||
630 | usr/include/libudev.h \ | ||
631 | usr/$(mlibdir)/libudev\* \ | ||
632 | usr/$(mlibdir)/pkgconfig/libudev.pc \ | ||
633 | $([[ $(mlibdir) != lib ]] && echo 'usr/lib/libudev*') \ | ||
634 | $([[ $(mlibdir) != lib ]] && echo 'usr/lib/pkgconfig/libudev.pc') \ | ||
635 | || die | ||
636 | |||
637 | if [[ ${ENABLE_DEV_PACKAGES} = 1 ]] | ||
638 | then | ||
639 | mdelete -r /usr/include || die | ||
640 | mdelete -r /usr/$(mlibdir)/pkgconfig || die | ||
641 | fi | ||
642 | } | ||
643 | |||
644 | src_install_libudev-dev() | ||
645 | { | ||
646 | DESTDIR=${BINDIR} mninja install || die | ||
647 | |||
648 | # cleanup all files but the libudev owned ones | ||
649 | zapmost ${BINDIR} \ | ||
650 | usr/include/libudev.h \ | ||
651 | usr/$(mlibdir)/pkgconfig/libudev.pc \ | ||
652 | $([[ $(mlibdir) != lib ]] && echo 'usr/lib/pkgconfig/libudev.pc') \ | ||
653 | || die | ||
654 | } | ||
655 | |||
656 | src_install_udev() | ||
657 | { | ||
658 | DESTDIR=${BINDIR} mninja install || die | ||
659 | |||
660 | # cleanup all files but the udev owned ones | ||
661 | zapmost ${BINDIR} \ | ||
662 | etc/udev \ | ||
663 | usr/bin/udevadm \ | ||
664 | usr/lib/systemd/systemd-udevd \ | ||
665 | usr/lib/systemd/system/systemd-udevd-control.socket \ | ||
666 | usr/lib/systemd/system/systemd-udevd-kernel.socket \ | ||
667 | usr/lib/systemd/system/systemd-udevd.service \ | ||
668 | usr/lib/systemd/system/systemd-udev-settle.service \ | ||
669 | usr/lib/systemd/system/systemd-udev-trigger.service \ | ||
670 | usr/lib/udev \ | ||
671 | usr/share/man/man7/udev.7 \ | ||
672 | usr/share/man/man8/systemd-udevd.8 \ | ||
673 | usr/share/man/man8/udevadm.8 \ | ||
674 | usr/share/pkgconfig/udev.pc \ | ||
675 | || die | ||
676 | |||
677 | # remove udev rule for systemd | ||
678 | mdelete /usr/lib/udev/rules.d/99-systemd.rules || die | ||
679 | |||
680 | minstalldocs LICENSE* NEWS README TODO || die | ||
681 | |||
682 | # install our config | ||
683 | cd ${UDEV_CONFIG_SRCDIR} | ||
684 | make DESTDIR=${BINDIR} install || die | ||
685 | if [[ ${SYSVINIT_SUPPORT} = 1 ]] | ||
686 | then | ||
687 | # install sysvinit rc. script | ||
688 | make DESTDIR=${BINDIR} install-sysvinit || die | ||
689 | fi | ||
690 | |||
691 | # create symlinks for these utilities to /sbin | ||
692 | minstalldir /usr/sbin || die | ||
693 | # where multipath-tools expect them to be | ||
694 | mlink ../lib/udev/scsi_id /usr/sbin/ || die | ||
695 | |||
696 | # mark some dirs undeletable | ||
697 | mkeepdir /etc/udev/rules.d || die | ||
698 | mkeepdir /usr/lib/udev/state || die | ||
699 | |||
700 | # CONFIG_PROTECT_MASK for /etc/udev/rules.d | ||
701 | minstalldir /etc/env.d || die | ||
702 | MCONFIG="/etc/env.d/02udev" | ||
703 | mclearconfig || die | ||
704 | maddconfig 'CONFIG_PROTECT_MASK="/etc/udev/rules.d"' || die | ||
705 | |||
706 | if [[ ${ENABLE_DEV_PACKAGES} = 1 ]] | ||
707 | then | ||
708 | mdelete -r /usr/share || die | ||
709 | fi | ||
710 | } | ||
711 | |||
712 | src_install_udev-dev() | ||
713 | { | ||
714 | DESTDIR=${BINDIR} mninja install || die | ||
715 | |||
716 | # cleanup all files but the udev owned ones | ||
717 | zapmost ${BINDIR} \ | ||
718 | usr/share/man/man7/udev.7 \ | ||
719 | usr/share/man/man8/systemd-udevd.8 \ | ||
720 | usr/share/man/man8/udevadm.8 \ | ||
721 | usr/share/pkgconfig/udev.pc \ | ||
722 | || die | ||
723 | |||
724 | minstalldocs LICENSE* NEWS README TODO || die | ||
725 | } | ||
726 | |||
727 | src_install_nss-myhostname() | ||
728 | { | ||
729 | DESTDIR=${BINDIR} mninja install || die | ||
730 | |||
731 | # cleanup all files but the nss-myhostname owned ones | ||
732 | zapmost ${BINDIR} \ | ||
733 | usr/$(mlibdir)/libnss_myhostname\* \ | ||
734 | $([[ $(mlibdir) != lib ]] && echo 'usr/lib/libnss_myhostname*') \ | ||
735 | usr/share/man/man8/nss-myhostname.8 \ | ||
736 | || die | ||
737 | |||
738 | if [[ ${ENABLE_DEV_PACKAGES} = 1 ]] | ||
739 | then | ||
740 | mdelete -r /usr/share || die | ||
741 | fi | ||
742 | } | ||
743 | |||
744 | src_install_nss-myhostname-dev() | ||
745 | { | ||
746 | DESTDIR=${BINDIR} mninja install || die | ||
747 | |||
748 | # cleanup all files but the nss-myhostname owned ones | ||
749 | zapmost ${BINDIR} \ | ||
750 | usr/share/man/man8/nss-myhostname.8 \ | ||
751 | || die | ||
752 | } | ||
753 | |||
754 | src_install_libsystemd() | ||
755 | { | ||
756 | DESTDIR=${BINDIR} mninja install || die | ||
757 | |||
758 | # cleanup all files but the libsystem owned ones | ||
759 | zapmost ${BINDIR} \ | ||
760 | usr/$(mlibdir)/libsystemd.\* \ | ||
761 | $([[ $(mlibdir) != lib ]] && echo 'usr/lib/libsystemd.*') \ | ||
762 | || die | ||
763 | } | ||
764 | |||
765 | src_install_libsystemd-shared() | ||
766 | { | ||
767 | DESTDIR=${BINDIR} mninja install || die | ||
768 | |||
769 | # cleanup all files but the libsystem-shared owned ones | ||
770 | zapmost ${BINDIR} \ | ||
771 | usr/lib/systemd/libsystemd-shared-\*.so \ | ||
772 | || die | ||
773 | } | ||
774 | |||
775 | preinstall_udev() | ||
776 | { | ||
777 | if [[ ! -z $(magequery -n hotplug) ]] | ||
778 | then | ||
779 | echo -e ${COLRED} | ||
780 | echo -e "Error: sys-apps/hotplug is installed!!" | ||
781 | echo -e "hotplug is now fully provided by udev itself and it is not recommend to use this anymore." | ||
782 | echo -e "Please uninstall sys-apps/hotplug first!" | ||
783 | echo -e ${COLDEFAULT} | ||
784 | die "sys-apps/hotplug found!" | ||
785 | fi | ||
786 | |||
787 | # move udev state | ||
788 | if [ ! -L ${MROOT}/lib ] | ||
789 | then | ||
790 | if [[ -d ${MROOT}/lib/udev-state ]] | ||
791 | then | ||
792 | mv -f ${MROOT}/lib/udev-state/* ${MROOT}/usr/lib/udev/state/ | ||
793 | rm -r ${MROOT}/lib/udev-state | ||
794 | fi | ||
795 | if [[ -d ${MROOT}/lib/udev/state ]] | ||
796 | then | ||
797 | mv -f ${MROOT}/lib/udev/state/* ${MROOT}/usr/lib/udev/state/ | ||
798 | rm -r ${MROOT}/lib/udev/state | ||
799 | fi | ||
800 | fi | ||
801 | |||
802 | # remove deprecated udev devices dir | ||
803 | if [[ -d ${MROOT}/lib/udev/devices ]] | ||
804 | then | ||
805 | rm -r ${MROOT}/lib/udev/devices | ||
806 | fi | ||
807 | if [[ -d ${MROOT}/usr/lib/udev/devices ]] | ||
808 | then | ||
809 | rm -r ${MROOT}/usr/lib/udev/devices | ||
810 | fi | ||
811 | |||
812 | if [[ -f ${MROOT}/etc/udev/udev.config ]] && | ||
813 | [[ ! -f ${MROOT}/etc/udev/udev.rules ]] | ||
814 | then | ||
815 | mv -f ${MROOT}/etc/udev/udev.config ${MROOT}/etc/udev/udev.rules | ||
816 | fi | ||
817 | |||
818 | # delete the old udev.hotplug symlink if it is present | ||
819 | if [[ -h ${MROOT}/etc/hotplug.d/default/udev.hotplug ]] | ||
820 | then | ||
821 | rm -f ${MROOT}/etc/hotplug.d/default/udev.hotplug | ||
822 | fi | ||
823 | |||
824 | # delete the old wait_for_sysfs.hotplug symlink if it is present | ||
825 | if [[ -h ${MROOT}/etc/hotplug.d/default/05-wait_for_sysfs.hotplug ]] | ||
826 | then | ||
827 | rm -f ${MROOT}/etc/hotplug.d/default/05-wait_for_sysfs.hotplug | ||
828 | fi | ||
829 | |||
830 | # delete the old 10-udev.hotplug symlink if it is present | ||
831 | if [[ -h ${MROOT}/etc/hotplug.d/default/10-udev.hotplug ]] | ||
832 | then | ||
833 | rm -f ${MROOT}/etc/hotplug.d/default/10-udev.hotplug | ||
834 | fi | ||
835 | |||
836 | # delete the deprectated udev-late rc-script | ||
837 | [[ -x ${MROOT}/sbin/rc-config ]] && ${MROOT}/sbin/rc-config del udev-late | ||
838 | |||
839 | # delete obsolete hotplug.dev script | ||
840 | if [[ -f ${MROOT}/etc/dev.d/net/hotplug.dev ]] | ||
841 | then | ||
842 | rm -f ${MROOT}/etc/dev.d/net/hotplug.dev | ||
843 | fi | ||
844 | |||
845 | # delete deprecated pnp-aliases | ||
846 | if [[ -f ${MROOT}/etc/modprobe.d/pnp-aliases ]] | ||
847 | then | ||
848 | rm -f ${MROOT}/etc/modprobe.d/pnp-aliases | ||
849 | fi | ||
850 | |||
851 | # delete deprecated blacklist | ||
852 | if [[ -f ${MROOT}/etc/udev/blacklist ]] | ||
853 | then | ||
854 | rm -f ${MROOT}/etc/udev/blacklist | ||
855 | fi | ||
856 | |||
857 | # delete all udev.rules which are moved from /etc/udev to /lib/udev | ||
858 | local rule | ||
859 | for rule in 40-arch-s390.rules \ | ||
860 | 61-persistent-storage-edd.rules \ | ||
861 | 75-persistent-net-generator.rules \ | ||
862 | 64-md-raid.rules \ | ||
863 | 65-permissions.rules \ | ||
864 | 64-device-mapper.rules \ | ||
865 | 40-alsa.rules \ | ||
866 | 40-zaptel.rules \ | ||
867 | 60-persistent-input.rules \ | ||
868 | 40-arch-ia64.rules \ | ||
869 | 05-udev-early.rules \ | ||
870 | 40-arch-ppc.rules \ | ||
871 | 60-cdrom_id.rules \ | ||
872 | 40-pilot-links.rules \ | ||
873 | 95-udev-late.rules \ | ||
874 | 40-magellan.rules \ | ||
875 | 50-udev-default.rules \ | ||
876 | 80-drivers.rules \ | ||
877 | 30-kernel-compat.rules \ | ||
878 | 40-video.rules \ | ||
879 | 60-persistent-storage-tape.rules \ | ||
880 | 75-cd-aliases-generator.rules \ | ||
881 | 60-persistent-storage.rules | ||
882 | do | ||
883 | # delete obsolete hotplug.dev script | ||
884 | if [[ -f ${MROOT}/etc/udev/rules.d/${rule} ]] | ||
885 | then | ||
886 | rm -f ${MROOT}/etc/udev/rules.d/${rule} | ||
887 | fi | ||
888 | done | ||
889 | |||
890 | echo "Network device naming is now controlled by udev's net_setup_link" | ||
891 | echo "builtin. Refer to the NETWORK LINK CONFIGURATION section of the" | ||
892 | echo "udev manpage for a full description." | ||
893 | if [ -e ${MROOT}/etc/udev/rules.d/80-net-name-slot.rules ] | ||
894 | then | ||
895 | echo | ||
896 | echo "Renaming old 80-net-name-slot.rules to 80-net-setup-link.rules in order" | ||
897 | echo "to preserve existing network naming behavior." | ||
898 | mv -v ${MROOT}/etc/udev/rules.d/80-net-name-slot.rules \ | ||
899 | ${MROOT}/etc/udev/rules.d/80-net-setup-link.rules | ||
900 | fi | ||
901 | } | ||
902 | |||
903 | postinstall_udev() | ||
904 | { | ||
905 | [[ ! -d ${MROOT}/run ]] && install -d ${MROOT}/run | ||
906 | |||
907 | # systemd | ||
908 | if [[ -x /usr/bin/systemctl ]] && [[ -z ${MROOT} ]] && [[ ${MROOT} != / ]] | ||
909 | then | ||
910 | # reload config | ||
911 | systemctl daemon-reload | ||
912 | |||
913 | # try to kill | ||
914 | if ! systemctl stop systemd-udevd.service systemd-udevd-control.socket systemd-udevd-kernel.socket >/dev/null 2>&1 | ||
915 | then | ||
916 | # kill daemon if we are not in a chroot | ||
917 | if [[ /proc/1/exe ]] && [[ -d /proc/1/root ]] | ||
918 | then | ||
919 | if [[ $(stat -Lc '%%D-%%i' /) = $(stat -Lc '%%D-%%i' /proc/1/root) ]] | ||
920 | then | ||
921 | udevadm control --exit 2>&1 | ||
922 | fi | ||
923 | fi | ||
924 | fi | ||
925 | # start the daemon | ||
926 | if ! systemctl start systemd-udevd.service >/dev/null 2>&1 | ||
927 | then | ||
928 | # start daemon if we are not in a chroot | ||
929 | if [[ -f /proc/1/exe ]] && [[ -d /proc/1/root ]] | ||
930 | then | ||
931 | if [[ $(stat -Lc '%%D-%%i' /) = $(stat -Lc '%%D-%%i' /proc/1/root) ]] | ||
932 | then | ||
933 | /usr/lib/systemd/systemd-udevd --daemon | ||
934 | fi | ||
935 | fi | ||
936 | fi | ||
937 | |||
938 | # sysV | ||
939 | else | ||
940 | # after install/uprade, udev *must* be reloaded if already running | ||
941 | if [[ -z ${MROOT} ]] || [[ ${MROOT} = / ]] && | ||
942 | [[ -n $(pidof systemd-udevd) ]] && [[ ${MAGE_BOOTSTRAP} != true ]] | ||
943 | then | ||
944 | echo "MROOT=/; restarting udev daemon ..." | ||
945 | # support old installations too | ||
946 | killall -15 udevd &> /dev/null | ||
947 | killall -15 systemd-udevd &> /dev/null | ||
948 | sleep 1 | ||
949 | killall -9 systemd-udevd &> /dev/null | ||
950 | killall -9 udevd &> /dev/null | ||
951 | /usr/lib/systemd/systemd-udevd --daemon | ||
952 | fi | ||
953 | fi | ||
954 | |||
955 | if [[ -z ${MROOT} ]] || [[ ${MROOT} = / ]] | ||
956 | then | ||
957 | # update hwdb | ||
958 | udevadm hwdb --update > /dev/null 2>&1 | ||
959 | fi | ||
960 | } | ||
961 | |||
962 | postinstall_nss-myhostname() | ||
963 | { | ||
964 | # add myhostname to the hosts line of /etc/nsswitch.conf | ||
965 | if [ -f ${MROOT}/etc/nsswitch.conf ] | ||
966 | then | ||
967 | sed -i -e ' | ||
968 | /^hosts:/ !b | ||
969 | /\<myhostname\>/ b | ||
970 | s/[[:blank:]]*$/ myhostname/ | ||
971 | ' ${MROOT}/etc/nsswitch.conf | ||
972 | fi | ||
973 | } | ||
974 | |||
975 | postremove_nss-myhostname() | ||
976 | { | ||
977 | # remove myhostname from the hosts line of /etc/nsswitch.conf | ||
978 | if [ ! -e ${MROOT}/usr/$(mlibdir)/libnss_myhostname.so.* ] | ||
979 | then | ||
980 | if [ -f ${MROOT}/etc/nsswitch.conf ] | ||
981 | then | ||
982 | sed -i -e ' | ||
983 | /^hosts:/ !b | ||
984 | s/[[:blank:]]\+myhostname\>// | ||
985 | ' ${MROOT}/etc/nsswitch.conf | ||
986 | fi | ||
987 | fi | ||
988 | } | ||
989 | |||
990 | preinstall_systemd() | ||
991 | { | ||
992 | if [[ ${SYSVINIT_SUPPORT} != 1 ]] | ||
993 | then | ||
994 | if [[ ! -z $(magequery -n sysvinit) ]] | ||
995 | then | ||
996 | echo -e ${COLRED} | ||
997 | echo -e "Error: sys-apps/sysvinit is installed!!" | ||
998 | echo -e "sysvinit is now replaced by systemd which is the new default init system." | ||
999 | echo -e "Please uninstall sys-apps/sysvinit first!" | ||
1000 | echo -e ${COLDEFAULT} | ||
1001 | die "sys-apps/sysvinit found!" | ||
1002 | fi | ||
1003 | fi | ||
1004 | |||
1005 | # adding users | ||
1006 | pkg_setup | ||
1007 | |||
1008 | # fix broken systemd installations, where | ||
1009 | # /usr/lib/systemd/systemd is a directory and not the daemon-exec | ||
1010 | if [ -d ${MROOT}/usr/lib/systemd/systemd ] | ||
1011 | then | ||
1012 | rm -r ${MROOT}/usr/lib/systemd/systemd | ||
1013 | fi | ||
1014 | |||
1015 | # rename configuration files that changed their names | ||
1016 | if [ -f ${MROOT}/etc/systemd/systemd-logind.conf ] | ||
1017 | then | ||
1018 | mv -n ${MROOT}/etc/systemd/{systemd-,}logind.conf | ||
1019 | fi | ||
1020 | if [ -f ${MROOT}/etc/systemd/systemd-journald.conf ] | ||
1021 | then | ||
1022 | mv -n ${MROOT}/etc/systemd/{systemd-,}journald.conf | ||
1023 | fi | ||
1024 | |||
1025 | # move old stuff around in /var/lib | ||
1026 | if [ -f ${MROOT}/var/lib/random-seed ] | ||
1027 | then | ||
1028 | [ -d ${MROOT}/var/lib/systemd ] || install -d ${MROOT}/var/lib/systemd | ||
1029 | mv -n ${MROOT}/var/lib/random-seed ${MROOT}/var/lib/systemd/random-seed | ||
1030 | fi | ||
1031 | if [ -f ${MROOT}/var/lib/backlight ] | ||
1032 | then | ||
1033 | [ -d ${MROOT}/var/lib/systemd ] || install -d ${MROOT}/var/lib/systemd | ||
1034 | mv -n ${MROOT}/var/lib/backlight ${MROOT}/var/lib/systemd/backlight | ||
1035 | fi | ||
1036 | } | ||
1037 | |||
1038 | postinstall_systemd() | ||
1039 | { | ||
1040 | # remove deprecated compat libraries | ||
1041 | local lib | ||
1042 | for lib in daemon id128 journal login | ||
1043 | do | ||
1044 | if [[ -n $(magequery -n libsystemd-${lib}) ]] | ||
1045 | then | ||
1046 | echo "Uninstalling deprecated 'libsystemd-${lib}'" | ||
1047 | mage uninstall libsystemd-${lib} | ||
1048 | fi | ||
1049 | done | ||
1050 | |||
1051 | # try to read default runlevel from the old inittab if it exists | ||
1052 | local runlevel | ||
1053 | runlevel=$(awk -F ':' '$3 == "initdefault" && $1 !~ "^#" { print $2 }' ${MROOT}/etc/inittab 2> /dev/null) | ||
1054 | local target | ||
1055 | if [[ -z ${runlevel} ]] | ||
1056 | then | ||
1057 | target="/usr/lib/systemd/system/graphical.target" | ||
1058 | else | ||
1059 | target="/usr/lib/systemd/system/runlevel${runlevel}.target" | ||
1060 | fi | ||
1061 | # and symlink what we found to the new-style default.target | ||
1062 | ln -snf ${target} ${MROOT}/etc/systemd/system/default.target | ||
1063 | |||
1064 | # convert modules.autoload | ||
1065 | if [ -f ${MROOT}/etc/modules.autoload ] | ||
1066 | then | ||
1067 | local modules | ||
1068 | # get only lines which are not commented or empty; | ||
1069 | # if we get any items than the modules.autoload is in use | ||
1070 | modules=$(sed -e '/^#/d' -e '/^$/d' ${MROOT}/etc/modules.autoload) | ||
1071 | if [[ ! -z ${modules} ]] | ||
1072 | then | ||
1073 | [ ! -d ${MROOT}/etc/modules-load.d ] && install -d ${MROOT}/etc/modules-load.d | ||
1074 | echo -e "# Converted by systemd install from /etc/modules.autoload\n#\n#" \ | ||
1075 | > ${MROOT}/etc/modules-load.d/modules.autoload.conf | ||
1076 | cat ${MROOT}/etc/modules.autoload \ | ||
1077 | >> ${MROOT}/etc/modules-load.d/modules.autoload.conf | ||
1078 | fi | ||
1079 | fi | ||
1080 | |||
1081 | # check mtab and replace with a symlink if required | ||
1082 | if [[ ! -L ${MROOT}/etc/mtab ]] || \ | ||
1083 | [[ $(readlink ${MROOT}/etc/mtab) != /proc/self/mounts ]] | ||
1084 | then | ||
1085 | ln -snf /proc/self/mounts ${MROOT}/etc/mtab | ||
1086 | fi | ||
1087 | |||
1088 | # check for timesync symlink and remove it, must be a directory from now on | ||
1089 | if [[ -L ${MROOT}/var/lib/systemd/timesync ]] | ||
1090 | then | ||
1091 | rm ${MROOT}/var/lib/systemd/timesync | ||
1092 | fi | ||
1093 | |||
1094 | if [[ -z ${MROOT} ]] || [[ ${MROOT} = / ]] | ||
1095 | then | ||
1096 | # create machine-id | ||
1097 | if [ ! -s /etc/machine-id ] | ||
1098 | then | ||
1099 | systemd-machine-id-setup | ||
1100 | fi | ||
1101 | # create a random-seed | ||
1102 | /usr/lib/systemd/systemd-random-seed save | ||
1103 | |||
1104 | # allow detect-virt to be run by unprivileged code | ||
1105 | setcap cap_dac_override,cap_sys_ptrace+ep /usr/bin/systemd-detect-virt | ||
1106 | |||
1107 | # restart systemd daemon | ||
1108 | systemctl daemon-reexec | ||
1109 | |||
1110 | # restart systemd-logind daemon | ||
1111 | systemctl try-restart systemd-logind.service | ||
1112 | |||
1113 | # update journal catalog | ||
1114 | journalctl --update-catalog > /dev/null 2>&1 | ||
1115 | |||
1116 | # create missing tmpfiles | ||
1117 | systemd-tmpfiles --create > /dev/null 2>&1 | ||
1118 | |||
1119 | # set acls for wheel and adm group | ||
1120 | if [ -x /usr/bin/setfacl ] | ||
1121 | then | ||
1122 | /usr/bin/setfacl -Rnm g:wheel:rx,d:g:wheel:rx,g:adm:rx,d:g:adm:rx /var/log/journal/ > /dev/null 2>&1 | ||
1123 | fi | ||
1124 | |||
1125 | # enable the services we install by default. | ||
1126 | systemctl enable \ | ||
1127 | getty@tty1.service \ | ||
1128 | remote-fs.target \ | ||
1129 | systemd-timesyncd.service | ||
1130 | #systemd-readahead-replay.service | ||
1131 | #systemd-readahead-collect.service | ||
1132 | #console-getty.service | ||
1133 | #console-shell.service | ||
1134 | #debug-shell.service | ||
1135 | #systemd-networkd.service | ||
1136 | fi | ||
1137 | |||
1138 | echo | ||
1139 | echo "with >=systemd-216 coredumps are no longer sent to the journal by default." | ||
1140 | echo "To re-enable:" | ||
1141 | echo ' echo >/etc/sysctl.d/50-coredump.conf \' | ||
1142 | echo ' "kernel.core_pattern=|/usr/lib/systemd/systemd-coredump %p %u %g %s %t %e"' | ||
1143 | echo | ||
1144 | |||
1145 | if [[ ${SYSVINIT_SUPPORT} = 1 ]] | ||
1146 | then | ||
1147 | echo | ||
1148 | echo "systemd has been installed to /usr/lib/systemd/systemd. Please ensure you append" | ||
1149 | echo "init=/usr/lib/systemd/systemd to your kernel command line in your bootloader." | ||
1150 | echo | ||
1151 | fi | ||
1152 | } |