Contents of /trunk/core/systemd/systemd-188-r1.smage2
Parent Directory | Revision Log
Revision 12982 -
(show annotations)
(download)
Wed Aug 15 13:23:38 2012 UTC (12 years, 1 month ago) by niro
File size: 19189 byte(s)
Wed Aug 15 13:23:38 2012 UTC (12 years, 1 month ago) by niro
File size: 19189 byte(s)
-some services were renamed from udev* to udevd* by upstream
1 | # $Id$ |
2 | |
3 | PNAME="systemd" |
4 | PVER="188" |
5 | PBUILD="r1" |
6 | |
7 | SPLIT_PACKAGES="libudev libgudev udev systemd systemd-tools" |
8 | |
9 | PCAT="sys-apps" |
10 | HOMEPAGE="http://www.freedesktop.org/wiki/Software/systemd" |
11 | |
12 | # enable or disable sysvinit support |
13 | # 1=yes, 0=no |
14 | SYSVINIT_SUPPORT=0 |
15 | |
16 | # enable or disable busybox support |
17 | # 1=yes, 0=no |
18 | BUSYBOX_SUPPORT=0 |
19 | |
20 | # disable gtk until build with libgee is fixed |
21 | # 1=yes, 0=no |
22 | ENABLE_GTK=0 |
23 | |
24 | # export this variables for preinstall |
25 | SPECIAL_VARS="SYSVINIT_SUPPORT BUSYBOX_SUPPORT" |
26 | |
27 | GLIB2_DEPEND=">= dev-libs/glib2-2.32" |
28 | GLIBC_DEPEND=">= virtual/glibc" |
29 | COMMON_DEPEND="${GLIBC_DEPEND} |
30 | ${GLIB2_DEPEND} |
31 | >= sys-apps/util-linux-2.21 |
32 | >= sys-apps/acl-2.2 |
33 | >= sys-apps/sysvinit-tools-2.88 |
34 | >= sys-apps/kmod-9" |
35 | |
36 | LIBUDEV_DEPEND="${GLIBC_DEPEND}" |
37 | LIBGUDEV_DEPEND="${GLIBC_DEPEND} |
38 | ${GLIB2_DEPEND}" |
39 | |
40 | # only /etc/os-release is supported from now on |
41 | SYSTEMD_DEPEND="${COMMON_DEPEND} |
42 | >= sys-apps/mage-release-1 |
43 | >= sys-apps/dbus-1.6 |
44 | >= sys-fs/cryptsetup-1.4 |
45 | >= dev-libs/dbus-glib-0.100 |
46 | >= dev-libs/libgee-0.7 |
47 | >= net-dns/nss-myhostname-0.3 |
48 | >= app-arch/xz-utils-5 |
49 | >= sys-apps/tcp-wrappers-7.6 |
50 | >= sys-libs/pam-1.1 |
51 | >= sys-libs/libcap-2.22 |
52 | >= sys-apps/shadow-4.1" |
53 | |
54 | TOOLS_DEPEND=">= dev-python/dbus-python-0.84 |
55 | >= sys-apps/polkit-0.104" |
56 | |
57 | UDEV_DEPEND="${COMMON_DEPEND} |
58 | >= dev-libs/libusb-compat-0.1.4 |
59 | >= sys-apps/usbutils-005 |
60 | >= sys-apps/pciutils-3.1" |
61 | |
62 | if [[ ${ENABLE_GTK} = 1 ]] |
63 | then |
64 | TOOLS_DEPEND="${TOOLS_DEPEND} |
65 | >= x11-libs/gtk2+-2.24 |
66 | >= dev-libs/libgee-0.7" |
67 | fi |
68 | |
69 | # busybox supports requires sysvinit support |
70 | if [[ ${BUSYBOX_SUPPORT} = 1 ]] |
71 | then |
72 | [[ ${SYSVINIT_SUPPORT} != 1 ]] && SYSVINIT_SUPPORT=1 |
73 | fi |
74 | |
75 | if [[ ${SYSVINIT_SUPPORT} = 1 ]] |
76 | then |
77 | SYSTEMD_DEPEND="${SYSTEMD_DEPEND} |
78 | >= sys-apps/sysvinit-2.88" |
79 | fi |
80 | |
81 | SDEPEND="${LIBUDEV_DEPEND} |
82 | ${LIBGUDEV_DEPEND} |
83 | ${SYSTEMD_DEPEND} |
84 | ${TOOLS_DEPEND} |
85 | ${UDEV_DEPEND} |
86 | >= app-text/docbook-xsl-stylesheets-1.76 |
87 | >= dev-libs/libcgroup-0.38 |
88 | >= dev-libs/libxslt-1.1.26 |
89 | >= dev-lang/vala-0.16 |
90 | >= dev-util/intltool-0.50 |
91 | >= dev-util/gperf-3 |
92 | >= virtual/kernel-headers |
93 | >= x11-libs/libnotify-0.7" |
94 | |
95 | SRCFILE="${PNAME}-${PVER}.tar.xz" |
96 | SRCDIR="${BUILDDIR}/${PNAME}-${PVER}" |
97 | |
98 | UDEV_CONFIG_PVER="185-r4" |
99 | UDEV_CONFIG_SRCFILE="config-udev-${UDEV_CONFIG_PVER}.tar.bz2" |
100 | UDEV_CONFIG_SRCDIR="${BUILDDIR}/config-udev-${UDEV_CONFIG_PVER}" |
101 | |
102 | if [[ ${ENABLE_GTK} = 1 ]] |
103 | then |
104 | UI_PVER="1" |
105 | UI_SRCFILE="${PNAME}-ui-${UI_PVER}.tar.xz" |
106 | UI_SRCDIR="${BUILDDIR}/${PNAME}-ui-${PVER}" |
107 | fi |
108 | |
109 | sminclude mtools multilib cleanutils |
110 | msetfeature "!check" |
111 | |
112 | SRC_URI=( |
113 | http://www.freedesktop.org/software/${PNAME}/${SRCFILE} |
114 | mirror://${PNAME}/${SRCFILE} |
115 | mirror://udev/${UDEV_CONFIG_SRCFILE} |
116 | mirror://${PNAME}/${PNAME}-188-magellan.patch |
117 | mirror://${PNAME}/${PNAME}-188-magellan-configurable-getty.patch |
118 | mirror://${PNAME}/login-manager.pamd |
119 | ) |
120 | |
121 | if [[ ${ENABLE_GTK} = 1 ]] |
122 | then |
123 | SRC_URI+=( http://www.freedesktop.org/software/${PNAME}/${UI_SRCFILE} ) |
124 | fi |
125 | |
126 | UP2DATE="updatecmd http://www.freedesktop.org/software/systemd/ | grep ${PNAME}-[0-9] | lasttarball xz" |
127 | |
128 | split_info_libudev() |
129 | { |
130 | DESCRIPTION="Dynamic library to access udev device information." |
131 | DEPEND="${LIBUDEV_DEPEND}" |
132 | PCAT="sys-fs" |
133 | } |
134 | |
135 | split_info_libgudev() |
136 | { |
137 | DESCRIPTION="Libraries for adding libudev support to applications that use glib2." |
138 | DEPEND="${LIBGUDEV_DEPEND} |
139 | == sys-fs/libudev-${PVER}" |
140 | PCAT="sys-fs" |
141 | } |
142 | |
143 | split_info_udev() |
144 | { |
145 | DESCRIPTION="A Userspace Implementation for dynamic /dev nodes." |
146 | DEPEND="${UDEV_DEPEND} |
147 | == sys-fs/libudev-${PVER} |
148 | == sys-fs/libgudev-${PVER}" |
149 | PCAT="sys-fs" |
150 | } |
151 | |
152 | split_info_systemd() |
153 | { |
154 | DESCRIPTION="System and Session Manager." |
155 | DEPEND="${SYSTEMD_DEPEND} |
156 | == sys-fs/udev-${PVER}" |
157 | } |
158 | |
159 | split_info_systemd-tools() |
160 | { |
161 | local gtkdesc |
162 | [[ ${ENABLE_GTK} = 1 ]] && gtkdesc="for gtk2/gnome and " |
163 | |
164 | DESCRIPTION="Systemd utilites ${gtkdesc}for analysing the boot process." |
165 | DEPEND="== sys-apps/systemd-${PVER} |
166 | ${TOOLS_DEPEND}" |
167 | } |
168 | |
169 | src_prepare() |
170 | { |
171 | munpack ${SRCFILE} || die |
172 | oldmunpack ${UDEV_CONFIG_SRCFILE} || die |
173 | if [[ ${ENABLE_GTK} = 1 ]] |
174 | then |
175 | SRCDIR="${UI_SRCDIR}" munpack ${UI_SRCFILE} || die |
176 | fi |
177 | |
178 | # apply our magellan patch |
179 | mpatch ${PNAME}-188-magellan.patch || die |
180 | |
181 | # magellan-only: use a configurable getty |
182 | mpatch ${PNAME}-188-magellan-configurable-getty.patch || die |
183 | |
184 | # let rsyslog read from /proc/kmsg for now |
185 | all-abis sed -i "s:#ImportKernel=yes:ImportKernel=no:" src/journal/journald.conf || die |
186 | |
187 | # fix rootlink install location |
188 | sed -i "s:^\(udevdir=\).*:\1/usr/lib/udev:" ${UDEV_CONFIG_SRCDIR}/Makefile || die |
189 | |
190 | # regen configure |
191 | mautoreconf || die |
192 | } |
193 | |
194 | src_compile() |
195 | { |
196 | # disable plymouth in configure, to drop the .wants/ symlinks |
197 | # which are provided now by the plymouth package itself (>=plymouth-0.8.5.1) |
198 | mconfigure \ |
199 | --with-distro=magellan \ |
200 | --libexecdir=/usr/lib \ |
201 | --localstatedir=/var \ |
202 | --with-pamlibdir=/usr/'$(mlibdir)'/security \ |
203 | --disable-ima \ |
204 | --disable-audit \ |
205 | --disable-selinux \ |
206 | --disable-plymouth \ |
207 | --enable-pam \ |
208 | --enable-tcpwrap \ |
209 | --enable-xz \ |
210 | --enable-acl \ |
211 | --enable-libcryptsetup \ |
212 | --enable-gudev \ |
213 | --enable-introspection \ |
214 | --with-pci-ids-path=/usr/share/misc/pci.ids \ |
215 | --with-usb-ids-path=/usr/share/misc/usb.ids \ |
216 | --with-firmware-path=/usr/lib/firmware/updates:/usr/lib/firmware:/lib/firmware/updates:/lib/firmware \ |
217 | || die |
218 | |
219 | mmake || die |
220 | |
221 | if [[ ${ENABLE_GTK} = 1 ]] |
222 | then |
223 | SRCDIR="${UI_SRCDIR}" mconfigure || die |
224 | SRCDIR="${UI_SRCDIR}" mmake || die |
225 | fi |
226 | } |
227 | |
228 | src_install_systemd() |
229 | { |
230 | mmake DESTDIR=${BINDIR} install || die |
231 | if [[ ${ENABLE_GTK} = 1 ]] |
232 | then |
233 | SRCDIR="${UI_SRCDIR}" mmake DESTDIR=${BINDIR} install || die |
234 | fi |
235 | |
236 | # keep some directories |
237 | mkeepdir /run || die |
238 | mkeepdir /etc/modules-load.d || die |
239 | mkeepdir /etc/sysctl.d || die |
240 | mkeepdir /etc/tmpfiles.d || die |
241 | mkeepdir /etc/binfmt.d || die |
242 | |
243 | if [[ ${SYSVINIT_SUPPORT} != 1 ]] |
244 | then |
245 | echo "Include SysV init Compat symlinks" |
246 | # create SysV compatibility symlinks. systemctl/systemd are smart |
247 | # enough to detect in which way they are called. |
248 | minstalldir /usr/sbin || die |
249 | mlink ../lib/systemd/systemd /usr/sbin/init || die |
250 | local i |
251 | for i in reboot halt poweroff shutdown telinit runlevel |
252 | do |
253 | mlink ../bin/systemctl /usr/sbin/${i} || die |
254 | done |
255 | else |
256 | echo "Using sysvinit package for SysV compat" |
257 | fi |
258 | |
259 | # do not package the kernel.core_pattern setting until systemd-coredump |
260 | # is a part of an actual systemd release and it's made clear how to get |
261 | # the core dumps out of the journal |
262 | rm ${BINDIR}/usr/lib/sysctl.d/coredump.conf || die |
263 | rm -r ${BINDIR}/usr/lib/sysctl.d || die |
264 | |
265 | # we create all wants links manually at installation time to make sure |
266 | # they are not owned and hence overriden by mage after the user deleted |
267 | # them. |
268 | rm -r ${BINDIR}/etc/systemd/system/*.target.wants || die |
269 | # but make sure these directories are properly owned |
270 | mkeepdir /usr/lib/systemd/system/basic.target.wants || die |
271 | mkeepdir /usr/lib/systemd/system/default.target.wants || die |
272 | mkeepdir /usr/lib/systemd/system/dbus.target.wants || die |
273 | mkeepdir /usr/lib/systemd/system/syslog.target.wants || die |
274 | # make sure the user generators dir exists too |
275 | mkeepdir /usr/lib/systemd/user-generators || die |
276 | |
277 | # login-manager pam policy - force register kdm, gdm etc with pam_systemd |
278 | all-abis minstallpam login-manager.pamd login-manager || die |
279 | |
280 | # do not bother with non-existend services, mask them |
281 | mlink /dev/null /etc/systemd/system/syslog.service || die |
282 | mlink /dev/null /etc/systemd/system/rc-local.service || die |
283 | mlink /dev/null /etc/systemd/system/auditd.service || die |
284 | |
285 | minstalldocs DISTRO_PORTING LICENSE README TODO || die |
286 | |
287 | # remove files which are owned by other packages |
288 | if [[ ${ENABLE_GTK} = 1 ]] |
289 | then |
290 | mdelete /usr/bin/systemadm || die |
291 | mdelete /usr/bin/systemd-gnome-ask-password-agent || die |
292 | mdelete /usr/share/man/man1/systemadm.\* || die |
293 | fi |
294 | mdelete /usr/bin/systemd-analyze || die |
295 | mdelete -r /etc/udev || die |
296 | mdelete /usr/bin/udevadm || die |
297 | mdelete /usr/include/libudev.h || die |
298 | mdelete -r /usr/include/gudev-1.0 || die |
299 | mdelete /usr/lib/systemd/systemd-udevd || die |
300 | mdelete /usr/lib/systemd/system/systemd-udevd-control.socket || die |
301 | mdelete /usr/lib/systemd/system/systemd-udevd-kernel.socket || die |
302 | mdelete /usr/lib/systemd/system/systemd-udevd.service || die |
303 | mdelete /usr/lib/systemd/system/systemd-udev-settle.service || die |
304 | mdelete /usr/lib/systemd/system/systemd-udev-trigger.service || die |
305 | mdelete -r /usr/lib/udev || die |
306 | rm ${BINDIR}/usr/$(mlibdir)/libgudev* || die |
307 | rm ${BINDIR}/usr/$(mlibdir)/libudev* || die |
308 | mdelete -r /usr/$(mlibdir)/girepository-1.0 || die |
309 | mdelete /usr/$(mlibdir)/pkgconfig/gudev-1.0.pc || die |
310 | mdelete /usr/$(mlibdir)/pkgconfig/libudev.pc || die |
311 | if [[ $(mlibdir) != lib ]] |
312 | then |
313 | rm ${BINDIR}/usr/lib/libgudev* || die |
314 | rm ${BINDIR}/usr/lib/libudev* || die |
315 | mdelete -r /usr/lib/girepository-1.0 || die |
316 | mdelete /usr/lib/pkgconfig/gudev-1.0.pc || die |
317 | mdelete /usr/lib/pkgconfig/libudev.pc || die |
318 | fi |
319 | mdelete -r /usr/share/gir-1.0 || die |
320 | mdelete /usr/share/man/man7/udev.7 || die |
321 | mdelete /usr/share/man/man8/systemd-udevd.8 || die |
322 | mdelete /usr/share/man/man8/udevadm.8 || die |
323 | mdelete /usr/share/pkgconfig/udev.pc || die |
324 | |
325 | # install udev rule for systemd |
326 | minstalludevrule rules/99-systemd.rules || die |
327 | } |
328 | |
329 | src_install_systemd-tools() |
330 | { |
331 | cd ${SRCDIR} |
332 | if [[ ${ENABLE_GTK} = 1 ]] |
333 | then |
334 | all-abis minstallexec systemadm || die |
335 | all-abis minstallexec systemd-gnome-ask-password-agent || die |
336 | all-abis minstallman man/systemadm.1 || die |
337 | fi |
338 | all-abis minstallexec src/analyze/systemd-analyze || die |
339 | } |
340 | |
341 | src_install_libudev() |
342 | { |
343 | mmake DESTDIR=${BINDIR} install || die |
344 | |
345 | # cleanup all files but the libudev owned ones |
346 | zapmost ${BINDIR} \ |
347 | usr/include/libudev.h \ |
348 | usr/$(mlibdir)/libudev\* \ |
349 | usr/$(mlibdir)/pkgconfig/libudev.pc \ |
350 | $([[ $(mlibdir) != lib ]] && echo 'usr/lib/libudev*') \ |
351 | $([[ $(mlibdir) != lib ]] && echo 'usr/lib/pkgconfig/libudev.pc') \ |
352 | || die |
353 | } |
354 | |
355 | src_install_libgudev() |
356 | { |
357 | mmake DESTDIR=${BINDIR} install || die |
358 | |
359 | # cleanup all files but the libgudev owned ones |
360 | zapmost ${BINDIR} \ |
361 | usr/include/gudev-1.0 \ |
362 | usr/$(mlibdir)/libgudev\* \ |
363 | usr/$(mlibdir)/girepository-1.0 \ |
364 | usr/$(mlibdir)/pkgconfig/gudev-1.0.pc \ |
365 | $([[ $(mlibdir) != lib ]] && echo 'usr/lib/libgudev*') \ |
366 | $([[ $(mlibdir) != lib ]] && echo 'usr/lib/girepository-1.0') \ |
367 | $([[ $(mlibdir) != lib ]] && echo 'usr/lib/pkgconfig/gudev-1.0.pc') \ |
368 | usr/share/gir-1.0 \ |
369 | || die |
370 | |
371 | } |
372 | |
373 | src_install_udev() |
374 | { |
375 | mmake DESTDIR=${BINDIR} install || die |
376 | |
377 | # cleanup all files but the udev owned ones |
378 | zapmost ${BINDIR} \ |
379 | usr/bin/udevadm \ |
380 | usr/lib/systemd/systemd-udevd \ |
381 | usr/lib/systemd/system/systemd-udevd-control.socket \ |
382 | usr/lib/systemd/system/systemd-udevd-kernel.socket \ |
383 | usr/lib/systemd/system/systemd-udevd.service \ |
384 | usr/lib/systemd/system/systemd-udev-settle.service \ |
385 | usr/lib/systemd/system/systemd-udev-trigger.service \ |
386 | usr/lib/udev \ |
387 | usr/share/man/man7/udev.7 \ |
388 | usr/share/man/man8/systemd-udevd.8 \ |
389 | usr/share/man/man8/udevadm.8 \ |
390 | usr/share/pkgconfig/udev.pc \ |
391 | || die |
392 | |
393 | # remove udev rule for systemd |
394 | mdelete /usr/lib/udev/rules.d/99-systemd.rules || die |
395 | |
396 | minstalldocs LICENSE* NEWS README TODO || die |
397 | |
398 | # install our config |
399 | cd ${UDEV_CONFIG_SRCDIR} |
400 | make DESTDIR=${BINDIR} install || die |
401 | if [[ ${SYSVINIT_SUPPORT} = 1 ]] |
402 | then |
403 | # install sysvinit rc. script |
404 | make DESTDIR=${BINDIR} install-sysvinit || die |
405 | fi |
406 | |
407 | # create symlinks for these utilities to /sbin |
408 | minstalldir /usr/sbin || die |
409 | # where multipath-tools expect them to be |
410 | mlink ../lib/udev/scsi_id /usr/sbin/ || die |
411 | |
412 | # mark some dirs undeletable |
413 | mkeepdir /etc/udev/rules.d || die |
414 | mkeepdir /usr/lib/udev/state || die |
415 | |
416 | # CONFIG_PROTECT_MASK for /etc/udev/rules.d |
417 | minstalldir /etc/env.d || die |
418 | echo "CONFIG_PROTECT_MASK=\"/etc/udev/rules.d\"" > ${BINDIR}/etc/env.d/02udev || die |
419 | } |
420 | |
421 | preinstall_udev() |
422 | { |
423 | if [[ ! -z $(magequery -n hotplug) ]] |
424 | then |
425 | echo -e ${COLRED} |
426 | echo -e "Error: sys-apps/hotplug is installed!!" |
427 | echo -e "hotplug is now fully provided by udev itself and it is not recommend to use this anymore." |
428 | echo -e "Please uninstall sys-apps/hotplug first!" |
429 | echo -e ${COLDEFAULT} |
430 | die "sys-apps/hotplug found!" |
431 | fi |
432 | |
433 | # move udev state |
434 | if [ ! -L ${MROOT}/lib ] |
435 | then |
436 | if [[ -d ${MROOT}/lib/udev-state ]] |
437 | then |
438 | mv -f ${MROOT}/lib/udev-state/* ${MROOT}/usr/lib/udev/state/ |
439 | rm -r ${MROOT}/lib/udev-state |
440 | fi |
441 | if [[ -d ${MROOT}/lib/udev/state ]] |
442 | then |
443 | mv -f ${MROOT}/lib/udev/state/* ${MROOT}/usr/lib/udev/state/ |
444 | rm -r ${MROOT}/lib/udev/state |
445 | fi |
446 | fi |
447 | |
448 | # remove deprecated udev devices dir |
449 | if [[ -d ${MROOT}/lib/udev/devices ]] |
450 | then |
451 | rm -r ${MROOT}/lib/udev/devices |
452 | fi |
453 | if [[ -d ${MROOT}/usr/lib/udev/devices ]] |
454 | then |
455 | rm -r ${MROOT}/usr/lib/udev/devices |
456 | fi |
457 | |
458 | if [[ -f ${MROOT}/etc/udev/udev.config ]] && |
459 | [[ ! -f ${MROOT}/etc/udev/udev.rules ]] |
460 | then |
461 | mv -f ${MROOT}/etc/udev/udev.config ${MROOT}/etc/udev/udev.rules |
462 | fi |
463 | |
464 | # delete the old udev.hotplug symlink if it is present |
465 | if [[ -h ${MROOT}/etc/hotplug.d/default/udev.hotplug ]] |
466 | then |
467 | rm -f ${MROOT}/etc/hotplug.d/default/udev.hotplug |
468 | fi |
469 | |
470 | # delete the old wait_for_sysfs.hotplug symlink if it is present |
471 | if [[ -h ${MROOT}/etc/hotplug.d/default/05-wait_for_sysfs.hotplug ]] |
472 | then |
473 | rm -f ${MROOT}/etc/hotplug.d/default/05-wait_for_sysfs.hotplug |
474 | fi |
475 | |
476 | # delete the old 10-udev.hotplug symlink if it is present |
477 | if [[ -h ${MROOT}/etc/hotplug.d/default/10-udev.hotplug ]] |
478 | then |
479 | rm -f ${MROOT}/etc/hotplug.d/default/10-udev.hotplug |
480 | fi |
481 | |
482 | # delete the deprectated udev-late rc-script |
483 | [[ -x ${MROOT}/sbin/rc-config ]] && ${MROOT}/sbin/rc-config del udev-late |
484 | |
485 | # delete obsolete hotplug.dev script |
486 | if [[ -f ${MROOT}/etc/dev.d/net/hotplug.dev ]] |
487 | then |
488 | rm -f ${MROOT}/etc/dev.d/net/hotplug.dev |
489 | fi |
490 | |
491 | # delete deprecated pnp-aliases |
492 | if [[ -f ${MROOT}/etc/modprobe.d/pnp-aliases ]] |
493 | then |
494 | rm -f ${MROOT}/etc/modprobe.d/pnp-aliases |
495 | fi |
496 | |
497 | # delete deprecated blacklist |
498 | if [[ -f ${MROOT}/etc/udev/blacklist ]] |
499 | then |
500 | rm -f ${MROOT}/etc/udev/blacklist |
501 | fi |
502 | |
503 | # delete all udev.rules which are moved from /etc/udev to /lib/udev |
504 | local rule |
505 | for rule in 40-arch-s390.rules \ |
506 | 61-persistent-storage-edd.rules \ |
507 | 75-persistent-net-generator.rules \ |
508 | 64-md-raid.rules \ |
509 | 65-permissions.rules \ |
510 | 64-device-mapper.rules \ |
511 | 40-alsa.rules \ |
512 | 40-zaptel.rules \ |
513 | 60-persistent-input.rules \ |
514 | 40-arch-ia64.rules \ |
515 | 05-udev-early.rules \ |
516 | 40-arch-ppc.rules \ |
517 | 60-cdrom_id.rules \ |
518 | 40-pilot-links.rules \ |
519 | 95-udev-late.rules \ |
520 | 40-magellan.rules \ |
521 | 50-udev-default.rules \ |
522 | 80-drivers.rules \ |
523 | 30-kernel-compat.rules \ |
524 | 40-video.rules \ |
525 | 60-persistent-storage-tape.rules \ |
526 | 75-cd-aliases-generator.rules \ |
527 | 60-persistent-storage.rules |
528 | do |
529 | # delete obsolete hotplug.dev script |
530 | if [[ -f ${MROOT}/etc/udev/rules.d/${rule} ]] |
531 | then |
532 | rm -f ${MROOT}/etc/udev/rules.d/${rule} |
533 | fi |
534 | done |
535 | } |
536 | |
537 | postinstall_udev() |
538 | { |
539 | [[ ! -d ${MROOT}/run ]] && install -d ${MROOT}/run |
540 | |
541 | # systemd |
542 | if [[ -x /usr/bin/systemctl ]] && [[ -z ${MROOT} ]] && [[ ${MROOT} != / ]] |
543 | then |
544 | # reload config |
545 | systemctl daemon-reload |
546 | |
547 | # try to kill |
548 | if ! systemctl stop systemd-udevd.service systemd-udevd-control.socket systemd-udevd-kernel.socket >/dev/null 2>&1 |
549 | then |
550 | # kill daemon if we are not in a chroot |
551 | if [[ /proc/1/exe ]] && [[ -d /proc/1/root ]] |
552 | then |
553 | if [[ $(stat -Lc '%%D-%%i' /) = $(stat -Lc '%%D-%%i' /proc/1/root) ]] |
554 | then |
555 | udevadm control --exit 2>&1 |
556 | fi |
557 | fi |
558 | fi |
559 | # start the daemon |
560 | if ! systemctl start systemd-udevd.service >/dev/null 2>&1 |
561 | then |
562 | # start daemon if we are not in a chroot |
563 | if [[ -f /proc/1/exe ]] && [[ -d /proc/1/root ]] |
564 | then |
565 | if [[ $(stat -Lc '%%D-%%i' /) = $(stat -Lc '%%D-%%i' /proc/1/root) ]] |
566 | then |
567 | /usr/lib/systemd/systemd-udevd --daemon |
568 | fi |
569 | fi |
570 | fi |
571 | |
572 | # sysV |
573 | else |
574 | # after install/uprade, udev *must* be reloaded if already running |
575 | if [[ -z ${MROOT} ]] || [[ ${MROOT} = / ]] && |
576 | [[ -n $(pidof systemd-udevd) ]] && [[ ${MAGE_BOOTSTRAP} != true ]] |
577 | then |
578 | echo "MROOT=/; restarting udev daemon ..." |
579 | # support old installations too |
580 | killall -15 udevd &> /dev/null |
581 | killall -15 systemd-udevd &> /dev/null |
582 | sleep 1 |
583 | killall -9 systemd-udevd &> /dev/null |
584 | killall -9 udevd &> /dev/null |
585 | /usr/lib/systemd/systemd-udevd --daemon |
586 | fi |
587 | fi |
588 | } |
589 | |
590 | preinstall_systemd() |
591 | { |
592 | if [[ ${SYSVINIT_SUPPORT} != 1 ]] |
593 | then |
594 | if [[ ! -z $(magequery -n sysvinit) ]] |
595 | then |
596 | echo -e ${COLRED} |
597 | echo -e "Error: sys-apps/sysvinit is installed!!" |
598 | echo -e "sysvinit is now replaced by systemd which is the new default init system." |
599 | echo -e "Please uninstall sys-apps/sysvinit first!" |
600 | echo -e ${COLDEFAULT} |
601 | die "sys-apps/sysvinit found!" |
602 | fi |
603 | fi |
604 | |
605 | # adding lock group |
606 | ${MLIBDIR}/mgroupadd -o "-g 54" lock |
607 | |
608 | # fix broken systemd installations, where |
609 | # /usr/lib/systemd/systemd is a directory and not the daemon-exec |
610 | if [[ -d ${MROOT}/usr/lib/systemd/systemd ]] |
611 | then |
612 | rm -r ${MROOT}/usr/lib/systemd/systemd |
613 | fi |
614 | |
615 | # rename configuration files that changed their names |
616 | if [[ -f ${MROOT}/etc/systemd/systemd-logind.conf ]] |
617 | then |
618 | mv -n ${MROOT}/etc/systemd/{systemd-,}logind.conf |
619 | fi |
620 | if [[ -f ${MROOT}/etc/systemd/systemd-journald.conf ]] |
621 | then |
622 | mv -n ${MROOT}/etc/systemd/{systemd-,}journald.conf |
623 | fi |
624 | } |
625 | |
626 | postinstall_systemd() |
627 | { |
628 | # try to read default runlevel from the old inittab if it exists |
629 | local runlevel |
630 | runlevel=$(awk -F ':' '$3 == "initdefault" && $1 !~ "^#" { print $2 }' ${MROOT}/etc/inittab 2> /dev/null) |
631 | local target |
632 | if [[ -z ${runlevel} ]] |
633 | then |
634 | target="/usr/lib/systemd/system/graphical.target" |
635 | else |
636 | target="/usr/lib/systemd/system/runlevel${runlevel}.target" |
637 | fi |
638 | # and symlink what we found to the new-style default.target |
639 | ln -snf ${target} ${MROOT}/etc/systemd/system/default.target |
640 | |
641 | # convert modules.autoload |
642 | if [ -f ${MROOT}/etc/modules.autoload ] |
643 | then |
644 | local modules |
645 | # get only lines which are not commented or empty; |
646 | # if we get any items than the modules.autoload is in use |
647 | modules=$(sed -e '/^#/d' -e '/^$/d' ${MROOT}/etc/modules.autoload) |
648 | if [[ ! -z ${modules} ]] |
649 | then |
650 | [ ! -d ${MROOT}/etc/modules-load.d ] && install -d ${MROOT}/etc/modules-load.d |
651 | echo -e "# Converted by systemd install from /etc/modules.autoload\n#\n#" \ |
652 | > ${MROOT}/etc/modules-load.d/modules.autoload.conf |
653 | cat ${MROOT}/etc/modules.autoload \ |
654 | >> ${MROOT}/etc/modules-load.d/modules.autoload.conf |
655 | fi |
656 | fi |
657 | |
658 | # check mtab, and replace with a symlink if required |
659 | if [[ ! -L ${MROOT}/etc/mtab ]] || \ |
660 | [[ $(readlink ${MROOT}/etc/mtab) != /proc/self/mounts ]] |
661 | then |
662 | ln -snf /proc/self/mounts ${MROOT}/etc/mtab |
663 | fi |
664 | |
665 | if [[ -z ${MROOT} ]] || [[ ${MROOT} = / ]] |
666 | then |
667 | # create machine-id |
668 | if [ ! -f /etc/machine-id ] |
669 | then |
670 | systemd-machine-id-setup |
671 | fi |
672 | # create a random-seed |
673 | /usr/lib/systemd/systemd-random-seed save |
674 | |
675 | # restart systemd daemon |
676 | systemctl daemon-reexec |
677 | |
678 | # restart systemd-logind daemon |
679 | systemctl try-restart systemd-logind.service |
680 | |
681 | # enable the services we install by default. |
682 | systemctl enable \ |
683 | getty@.service \ |
684 | remote-fs.target \ |
685 | systemd-readahead-replay.service \ |
686 | systemd-readahead-collect.service |
687 | fi |
688 | |
689 | if [[ ${SYSVINIT_SUPPORT} = 1 ]] |
690 | then |
691 | echo |
692 | echo "systemd has been installed to /usr/lib/systemd/systemd. Please ensure you append" |
693 | echo "init=/usr/lib/systemd/systemd to your kernel command line in your bootloader." |
694 | echo |
695 | fi |
696 | } |