Magellan Linux

Contents of /trunk/core/systemd/systemd-233-r4.smage2

Parent Directory Parent Directory | Revision Log Revision Log


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