Magellan Linux

Annotation of /smage/trunk/core/systemd/systemd-208-r3.smage2

Parent Directory Parent Directory | Revision Log Revision Log


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