Magellan Linux

Contents of /trunk/core/systemd/systemd-238-r3.smage2

Parent Directory Parent Directory | Revision Log Revision Log


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