Contents of /trunk/core/systemd/systemd-194-r2.smage2
Parent Directory | Revision Log
Revision 13355 -
(show annotations)
(download)
Fri Oct 5 08:37:22 2012 UTC (11 years, 8 months ago) by niro
File size: 19459 byte(s)
Fri Oct 5 08:37:22 2012 UTC (11 years, 8 months ago) by niro
File size: 19459 byte(s)
-do not include rpm macros in the package
1 | # $Id$ |
2 | |
3 | PNAME="systemd" |
4 | PVER="194" |
5 | PBUILD="r2" |
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.34" |
28 | GLIBC_DEPEND=">= virtual/glibc" |
29 | COMMON_DEPEND="${GLIBC_DEPEND} |
30 | ${GLIB2_DEPEND} |
31 | >= sys-apps/acl-2.2 |
32 | >= virtual/sysvinit-tools |
33 | >= sys-apps/kmod-9" |
34 | |
35 | LIBUDEV_DEPEND="${GLIBC_DEPEND}" |
36 | LIBGUDEV_DEPEND="${GLIBC_DEPEND} |
37 | ${GLIB2_DEPEND}" |
38 | |
39 | # only /etc/os-release is supported from now on |
40 | SYSTEMD_DEPEND="${COMMON_DEPEND} |
41 | >= sys-apps/mage-release-1 |
42 | >= sys-apps/dbus-1.6 |
43 | >= sys-fs/cryptsetup-1.5 |
44 | >= dev-libs/dbus-glib-0.100 |
45 | >= dev-libs/libgee-0.8 |
46 | >= net-dns/nss-myhostname-0.3 |
47 | >= virtual/xz-utils |
48 | >= sys-apps/tcp-wrappers-7.6 |
49 | >= sys-libs/pam-1.1 |
50 | >= sys-libs/libcap-2.22 |
51 | >= sys-apps/shadow-4.1" |
52 | |
53 | TOOLS_DEPEND=">= dev-python/dbus-python-1.1 |
54 | >= sys-apps/polkit-0.107" |
55 | |
56 | UDEV_DEPEND="${COMMON_DEPEND} |
57 | >= dev-libs/libusb-compat-0.1.4 |
58 | >= virtual/usbutils |
59 | >= virtual/pciutils |
60 | >= sys-libs/libuuid-2.22" |
61 | |
62 | if [[ ${ENABLE_GTK} = 1 ]] |
63 | then |
64 | TOOLS_DEPEND="${TOOLS_DEPEND} |
65 | >= x11-libs/gtk2+-2.24 |
66 | >= dev-libs/libgee-0.8" |
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.18 |
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 | --disable-qrencode \ |
208 | --enable-pam \ |
209 | --enable-tcpwrap \ |
210 | --enable-xz \ |
211 | --enable-acl \ |
212 | --enable-libcryptsetup \ |
213 | --enable-gudev \ |
214 | --enable-introspection \ |
215 | --with-pci-ids-path=/usr/share/misc/pci.ids \ |
216 | --with-usb-ids-path=/usr/share/misc/usb.ids \ |
217 | --with-firmware-path=/usr/lib/firmware/updates:/usr/lib/firmware:/lib/firmware/updates:/lib/firmware \ |
218 | || die |
219 | |
220 | mmake || die |
221 | |
222 | if [[ ${ENABLE_GTK} = 1 ]] |
223 | then |
224 | SRCDIR="${UI_SRCDIR}" mconfigure || die |
225 | SRCDIR="${UI_SRCDIR}" mmake || die |
226 | fi |
227 | } |
228 | |
229 | src_install_systemd() |
230 | { |
231 | mmake DESTDIR=${BINDIR} install || die |
232 | if [[ ${ENABLE_GTK} = 1 ]] |
233 | then |
234 | SRCDIR="${UI_SRCDIR}" mmake DESTDIR=${BINDIR} install || die |
235 | fi |
236 | |
237 | # keep some directories |
238 | mkeepdir /run || die |
239 | mkeepdir /etc/modules-load.d || die |
240 | mkeepdir /etc/sysctl.d || die |
241 | mkeepdir /etc/tmpfiles.d || die |
242 | mkeepdir /etc/binfmt.d || die |
243 | |
244 | # make sure the shutdown/sleep drop-in dirs exist |
245 | mkeepdir /usr/lib/systemd/system-shutdown || die |
246 | mkeepdir /usr/lib/systemd/system-sleep || die |
247 | |
248 | if [[ ${SYSVINIT_SUPPORT} != 1 ]] |
249 | then |
250 | echo "Include SysV init Compat symlinks" |
251 | # create SysV compatibility symlinks. systemctl/systemd are smart |
252 | # enough to detect in which way they are called. |
253 | minstalldir /usr/sbin || die |
254 | mlink ../lib/systemd/systemd /usr/sbin/init || die |
255 | local i |
256 | for i in reboot halt poweroff shutdown telinit runlevel |
257 | do |
258 | mlink ../bin/systemctl /usr/sbin/${i} || die |
259 | done |
260 | else |
261 | echo "Using sysvinit package for SysV compat" |
262 | fi |
263 | |
264 | # do not package the kernel.core_pattern setting until systemd-coredump |
265 | # is a part of an actual systemd release and it's made clear how to get |
266 | # the core dumps out of the journal |
267 | rm ${BINDIR}/usr/lib/sysctl.d/coredump.conf || die |
268 | rm -r ${BINDIR}/usr/lib/sysctl.d || die |
269 | |
270 | # we create all wants links manually at installation time to make sure |
271 | # they are not owned and hence overriden by mage after the user deleted |
272 | # them. |
273 | rm -r ${BINDIR}/etc/systemd/system/*.target.wants || die |
274 | # but make sure these directories are properly owned |
275 | mkeepdir /usr/lib/systemd/system/basic.target.wants || die |
276 | mkeepdir /usr/lib/systemd/system/default.target.wants || die |
277 | mkeepdir /usr/lib/systemd/system/dbus.target.wants || die |
278 | mkeepdir /usr/lib/systemd/system/syslog.target.wants || die |
279 | # make sure the user generators dir exists too |
280 | mkeepdir /usr/lib/systemd/user-generators || die |
281 | mkeepdir /usr/lib/systemd/system-generators || die |
282 | |
283 | # login-manager pam policy - force register kdm, gdm etc with pam_systemd |
284 | all-abis minstallpam login-manager.pamd login-manager || die |
285 | |
286 | # do not bother with non-existend services, mask them |
287 | mlink /dev/null /etc/systemd/system/syslog.service || die |
288 | mlink /dev/null /etc/systemd/system/rc-local.service || die |
289 | mlink /dev/null /etc/systemd/system/auditd.service || die |
290 | |
291 | # we have no rpm, remove config macros |
292 | mdelete -r /etc/rpm || die |
293 | |
294 | minstalldocs DISTRO_PORTING LICENSE README TODO || die |
295 | |
296 | # remove files which are owned by other packages |
297 | if [[ ${ENABLE_GTK} = 1 ]] |
298 | then |
299 | mdelete /usr/bin/systemadm || die |
300 | mdelete /usr/bin/systemd-gnome-ask-password-agent || die |
301 | mdelete /usr/share/man/man1/systemadm.\* || die |
302 | fi |
303 | mdelete /usr/bin/systemd-analyze || die |
304 | mdelete -r /etc/udev || die |
305 | mdelete /usr/bin/udevadm || die |
306 | mdelete /usr/include/libudev.h || die |
307 | mdelete -r /usr/include/gudev-1.0 || die |
308 | mdelete /usr/lib/systemd/systemd-udevd || die |
309 | mdelete /usr/lib/systemd/system/systemd-udevd-control.socket || die |
310 | mdelete /usr/lib/systemd/system/systemd-udevd-kernel.socket || die |
311 | mdelete /usr/lib/systemd/system/systemd-udevd.service || die |
312 | mdelete /usr/lib/systemd/system/systemd-udev-settle.service || die |
313 | mdelete /usr/lib/systemd/system/systemd-udev-trigger.service || die |
314 | mdelete -r /usr/lib/udev || die |
315 | rm ${BINDIR}/usr/$(mlibdir)/libgudev* || die |
316 | rm ${BINDIR}/usr/$(mlibdir)/libudev* || die |
317 | mdelete -r /usr/$(mlibdir)/girepository-1.0 || die |
318 | mdelete /usr/$(mlibdir)/pkgconfig/gudev-1.0.pc || die |
319 | mdelete /usr/$(mlibdir)/pkgconfig/libudev.pc || die |
320 | if [[ $(mlibdir) != lib ]] |
321 | then |
322 | rm ${BINDIR}/usr/lib/libgudev* || die |
323 | rm ${BINDIR}/usr/lib/libudev* || die |
324 | mdelete -r /usr/lib/girepository-1.0 || die |
325 | mdelete /usr/lib/pkgconfig/gudev-1.0.pc || die |
326 | mdelete /usr/lib/pkgconfig/libudev.pc || die |
327 | fi |
328 | mdelete -r /usr/share/gir-1.0 || die |
329 | mdelete /usr/share/man/man7/udev.7 || die |
330 | mdelete /usr/share/man/man8/systemd-udevd.8 || die |
331 | mdelete /usr/share/man/man8/udevadm.8 || die |
332 | mdelete /usr/share/pkgconfig/udev.pc || die |
333 | |
334 | # install udev rule for systemd |
335 | minstalludevrule rules/99-systemd.rules || die |
336 | } |
337 | |
338 | src_install_systemd-tools() |
339 | { |
340 | cd ${SRCDIR} |
341 | if [[ ${ENABLE_GTK} = 1 ]] |
342 | then |
343 | all-abis minstallexec systemadm || die |
344 | all-abis minstallexec systemd-gnome-ask-password-agent || die |
345 | all-abis minstallman man/systemadm.1 || die |
346 | fi |
347 | all-abis minstallexec src/analyze/systemd-analyze || die |
348 | } |
349 | |
350 | src_install_libudev() |
351 | { |
352 | mmake DESTDIR=${BINDIR} install || die |
353 | |
354 | # cleanup all files but the libudev owned ones |
355 | zapmost ${BINDIR} \ |
356 | usr/include/libudev.h \ |
357 | usr/$(mlibdir)/libudev\* \ |
358 | usr/$(mlibdir)/pkgconfig/libudev.pc \ |
359 | $([[ $(mlibdir) != lib ]] && echo 'usr/lib/libudev*') \ |
360 | $([[ $(mlibdir) != lib ]] && echo 'usr/lib/pkgconfig/libudev.pc') \ |
361 | || die |
362 | } |
363 | |
364 | src_install_libgudev() |
365 | { |
366 | mmake DESTDIR=${BINDIR} install || die |
367 | |
368 | # cleanup all files but the libgudev owned ones |
369 | zapmost ${BINDIR} \ |
370 | usr/include/gudev-1.0 \ |
371 | usr/$(mlibdir)/libgudev\* \ |
372 | usr/$(mlibdir)/girepository-1.0 \ |
373 | usr/$(mlibdir)/pkgconfig/gudev-1.0.pc \ |
374 | $([[ $(mlibdir) != lib ]] && echo 'usr/lib/libgudev*') \ |
375 | $([[ $(mlibdir) != lib ]] && echo 'usr/lib/girepository-1.0') \ |
376 | $([[ $(mlibdir) != lib ]] && echo 'usr/lib/pkgconfig/gudev-1.0.pc') \ |
377 | usr/share/gir-1.0 \ |
378 | || die |
379 | |
380 | } |
381 | |
382 | src_install_udev() |
383 | { |
384 | mmake DESTDIR=${BINDIR} install || die |
385 | |
386 | # cleanup all files but the udev owned ones |
387 | zapmost ${BINDIR} \ |
388 | usr/bin/udevadm \ |
389 | usr/lib/systemd/systemd-udevd \ |
390 | usr/lib/systemd/system/systemd-udevd-control.socket \ |
391 | usr/lib/systemd/system/systemd-udevd-kernel.socket \ |
392 | usr/lib/systemd/system/systemd-udevd.service \ |
393 | usr/lib/systemd/system/systemd-udev-settle.service \ |
394 | usr/lib/systemd/system/systemd-udev-trigger.service \ |
395 | usr/lib/udev \ |
396 | usr/share/man/man7/udev.7 \ |
397 | usr/share/man/man8/systemd-udevd.8 \ |
398 | usr/share/man/man8/udevadm.8 \ |
399 | usr/share/pkgconfig/udev.pc \ |
400 | || die |
401 | |
402 | # remove udev rule for systemd |
403 | mdelete /usr/lib/udev/rules.d/99-systemd.rules || die |
404 | |
405 | minstalldocs LICENSE* NEWS README TODO || die |
406 | |
407 | # install our config |
408 | cd ${UDEV_CONFIG_SRCDIR} |
409 | make DESTDIR=${BINDIR} install || die |
410 | if [[ ${SYSVINIT_SUPPORT} = 1 ]] |
411 | then |
412 | # install sysvinit rc. script |
413 | make DESTDIR=${BINDIR} install-sysvinit || die |
414 | fi |
415 | |
416 | # create symlinks for these utilities to /sbin |
417 | minstalldir /usr/sbin || die |
418 | # where multipath-tools expect them to be |
419 | mlink ../lib/udev/scsi_id /usr/sbin/ || die |
420 | |
421 | # mark some dirs undeletable |
422 | mkeepdir /etc/udev/rules.d || die |
423 | mkeepdir /usr/lib/udev/state || die |
424 | |
425 | # CONFIG_PROTECT_MASK for /etc/udev/rules.d |
426 | minstalldir /etc/env.d || die |
427 | echo "CONFIG_PROTECT_MASK=\"/etc/udev/rules.d\"" > ${BINDIR}/etc/env.d/02udev || die |
428 | } |
429 | |
430 | preinstall_udev() |
431 | { |
432 | if [[ ! -z $(magequery -n hotplug) ]] |
433 | then |
434 | echo -e ${COLRED} |
435 | echo -e "Error: sys-apps/hotplug is installed!!" |
436 | echo -e "hotplug is now fully provided by udev itself and it is not recommend to use this anymore." |
437 | echo -e "Please uninstall sys-apps/hotplug first!" |
438 | echo -e ${COLDEFAULT} |
439 | die "sys-apps/hotplug found!" |
440 | fi |
441 | |
442 | # move udev state |
443 | if [ ! -L ${MROOT}/lib ] |
444 | then |
445 | if [[ -d ${MROOT}/lib/udev-state ]] |
446 | then |
447 | mv -f ${MROOT}/lib/udev-state/* ${MROOT}/usr/lib/udev/state/ |
448 | rm -r ${MROOT}/lib/udev-state |
449 | fi |
450 | if [[ -d ${MROOT}/lib/udev/state ]] |
451 | then |
452 | mv -f ${MROOT}/lib/udev/state/* ${MROOT}/usr/lib/udev/state/ |
453 | rm -r ${MROOT}/lib/udev/state |
454 | fi |
455 | fi |
456 | |
457 | # remove deprecated udev devices dir |
458 | if [[ -d ${MROOT}/lib/udev/devices ]] |
459 | then |
460 | rm -r ${MROOT}/lib/udev/devices |
461 | fi |
462 | if [[ -d ${MROOT}/usr/lib/udev/devices ]] |
463 | then |
464 | rm -r ${MROOT}/usr/lib/udev/devices |
465 | fi |
466 | |
467 | if [[ -f ${MROOT}/etc/udev/udev.config ]] && |
468 | [[ ! -f ${MROOT}/etc/udev/udev.rules ]] |
469 | then |
470 | mv -f ${MROOT}/etc/udev/udev.config ${MROOT}/etc/udev/udev.rules |
471 | fi |
472 | |
473 | # delete the old udev.hotplug symlink if it is present |
474 | if [[ -h ${MROOT}/etc/hotplug.d/default/udev.hotplug ]] |
475 | then |
476 | rm -f ${MROOT}/etc/hotplug.d/default/udev.hotplug |
477 | fi |
478 | |
479 | # delete the old wait_for_sysfs.hotplug symlink if it is present |
480 | if [[ -h ${MROOT}/etc/hotplug.d/default/05-wait_for_sysfs.hotplug ]] |
481 | then |
482 | rm -f ${MROOT}/etc/hotplug.d/default/05-wait_for_sysfs.hotplug |
483 | fi |
484 | |
485 | # delete the old 10-udev.hotplug symlink if it is present |
486 | if [[ -h ${MROOT}/etc/hotplug.d/default/10-udev.hotplug ]] |
487 | then |
488 | rm -f ${MROOT}/etc/hotplug.d/default/10-udev.hotplug |
489 | fi |
490 | |
491 | # delete the deprectated udev-late rc-script |
492 | [[ -x ${MROOT}/sbin/rc-config ]] && ${MROOT}/sbin/rc-config del udev-late |
493 | |
494 | # delete obsolete hotplug.dev script |
495 | if [[ -f ${MROOT}/etc/dev.d/net/hotplug.dev ]] |
496 | then |
497 | rm -f ${MROOT}/etc/dev.d/net/hotplug.dev |
498 | fi |
499 | |
500 | # delete deprecated pnp-aliases |
501 | if [[ -f ${MROOT}/etc/modprobe.d/pnp-aliases ]] |
502 | then |
503 | rm -f ${MROOT}/etc/modprobe.d/pnp-aliases |
504 | fi |
505 | |
506 | # delete deprecated blacklist |
507 | if [[ -f ${MROOT}/etc/udev/blacklist ]] |
508 | then |
509 | rm -f ${MROOT}/etc/udev/blacklist |
510 | fi |
511 | |
512 | # delete all udev.rules which are moved from /etc/udev to /lib/udev |
513 | local rule |
514 | for rule in 40-arch-s390.rules \ |
515 | 61-persistent-storage-edd.rules \ |
516 | 75-persistent-net-generator.rules \ |
517 | 64-md-raid.rules \ |
518 | 65-permissions.rules \ |
519 | 64-device-mapper.rules \ |
520 | 40-alsa.rules \ |
521 | 40-zaptel.rules \ |
522 | 60-persistent-input.rules \ |
523 | 40-arch-ia64.rules \ |
524 | 05-udev-early.rules \ |
525 | 40-arch-ppc.rules \ |
526 | 60-cdrom_id.rules \ |
527 | 40-pilot-links.rules \ |
528 | 95-udev-late.rules \ |
529 | 40-magellan.rules \ |
530 | 50-udev-default.rules \ |
531 | 80-drivers.rules \ |
532 | 30-kernel-compat.rules \ |
533 | 40-video.rules \ |
534 | 60-persistent-storage-tape.rules \ |
535 | 75-cd-aliases-generator.rules \ |
536 | 60-persistent-storage.rules |
537 | do |
538 | # delete obsolete hotplug.dev script |
539 | if [[ -f ${MROOT}/etc/udev/rules.d/${rule} ]] |
540 | then |
541 | rm -f ${MROOT}/etc/udev/rules.d/${rule} |
542 | fi |
543 | done |
544 | } |
545 | |
546 | postinstall_udev() |
547 | { |
548 | [[ ! -d ${MROOT}/run ]] && install -d ${MROOT}/run |
549 | |
550 | # systemd |
551 | if [[ -x /usr/bin/systemctl ]] && [[ -z ${MROOT} ]] && [[ ${MROOT} != / ]] |
552 | then |
553 | # reload config |
554 | systemctl daemon-reload |
555 | |
556 | # try to kill |
557 | if ! systemctl stop systemd-udevd.service systemd-udevd-control.socket systemd-udevd-kernel.socket >/dev/null 2>&1 |
558 | then |
559 | # kill daemon if we are not in a chroot |
560 | if [[ /proc/1/exe ]] && [[ -d /proc/1/root ]] |
561 | then |
562 | if [[ $(stat -Lc '%%D-%%i' /) = $(stat -Lc '%%D-%%i' /proc/1/root) ]] |
563 | then |
564 | udevadm control --exit 2>&1 |
565 | fi |
566 | fi |
567 | fi |
568 | # start the daemon |
569 | if ! systemctl start systemd-udevd.service >/dev/null 2>&1 |
570 | then |
571 | # start daemon if we are not in a chroot |
572 | if [[ -f /proc/1/exe ]] && [[ -d /proc/1/root ]] |
573 | then |
574 | if [[ $(stat -Lc '%%D-%%i' /) = $(stat -Lc '%%D-%%i' /proc/1/root) ]] |
575 | then |
576 | /usr/lib/systemd/systemd-udevd --daemon |
577 | fi |
578 | fi |
579 | fi |
580 | |
581 | # sysV |
582 | else |
583 | # after install/uprade, udev *must* be reloaded if already running |
584 | if [[ -z ${MROOT} ]] || [[ ${MROOT} = / ]] && |
585 | [[ -n $(pidof systemd-udevd) ]] && [[ ${MAGE_BOOTSTRAP} != true ]] |
586 | then |
587 | echo "MROOT=/; restarting udev daemon ..." |
588 | # support old installations too |
589 | killall -15 udevd &> /dev/null |
590 | killall -15 systemd-udevd &> /dev/null |
591 | sleep 1 |
592 | killall -9 systemd-udevd &> /dev/null |
593 | killall -9 udevd &> /dev/null |
594 | /usr/lib/systemd/systemd-udevd --daemon |
595 | fi |
596 | fi |
597 | } |
598 | |
599 | preinstall_systemd() |
600 | { |
601 | if [[ ${SYSVINIT_SUPPORT} != 1 ]] |
602 | then |
603 | if [[ ! -z $(magequery -n sysvinit) ]] |
604 | then |
605 | echo -e ${COLRED} |
606 | echo -e "Error: sys-apps/sysvinit is installed!!" |
607 | echo -e "sysvinit is now replaced by systemd which is the new default init system." |
608 | echo -e "Please uninstall sys-apps/sysvinit first!" |
609 | echo -e ${COLDEFAULT} |
610 | die "sys-apps/sysvinit found!" |
611 | fi |
612 | fi |
613 | |
614 | # adding lock group |
615 | ${MLIBDIR}/mgroupadd -o "-g 54" lock |
616 | |
617 | # fix broken systemd installations, where |
618 | # /usr/lib/systemd/systemd is a directory and not the daemon-exec |
619 | if [[ -d ${MROOT}/usr/lib/systemd/systemd ]] |
620 | then |
621 | rm -r ${MROOT}/usr/lib/systemd/systemd |
622 | fi |
623 | |
624 | # rename configuration files that changed their names |
625 | if [[ -f ${MROOT}/etc/systemd/systemd-logind.conf ]] |
626 | then |
627 | mv -n ${MROOT}/etc/systemd/{systemd-,}logind.conf |
628 | fi |
629 | if [[ -f ${MROOT}/etc/systemd/systemd-journald.conf ]] |
630 | then |
631 | mv -n ${MROOT}/etc/systemd/{systemd-,}journald.conf |
632 | fi |
633 | } |
634 | |
635 | postinstall_systemd() |
636 | { |
637 | # try to read default runlevel from the old inittab if it exists |
638 | local runlevel |
639 | runlevel=$(awk -F ':' '$3 == "initdefault" && $1 !~ "^#" { print $2 }' ${MROOT}/etc/inittab 2> /dev/null) |
640 | local target |
641 | if [[ -z ${runlevel} ]] |
642 | then |
643 | target="/usr/lib/systemd/system/graphical.target" |
644 | else |
645 | target="/usr/lib/systemd/system/runlevel${runlevel}.target" |
646 | fi |
647 | # and symlink what we found to the new-style default.target |
648 | ln -snf ${target} ${MROOT}/etc/systemd/system/default.target |
649 | |
650 | # convert modules.autoload |
651 | if [ -f ${MROOT}/etc/modules.autoload ] |
652 | then |
653 | local modules |
654 | # get only lines which are not commented or empty; |
655 | # if we get any items than the modules.autoload is in use |
656 | modules=$(sed -e '/^#/d' -e '/^$/d' ${MROOT}/etc/modules.autoload) |
657 | if [[ ! -z ${modules} ]] |
658 | then |
659 | [ ! -d ${MROOT}/etc/modules-load.d ] && install -d ${MROOT}/etc/modules-load.d |
660 | echo -e "# Converted by systemd install from /etc/modules.autoload\n#\n#" \ |
661 | > ${MROOT}/etc/modules-load.d/modules.autoload.conf |
662 | cat ${MROOT}/etc/modules.autoload \ |
663 | >> ${MROOT}/etc/modules-load.d/modules.autoload.conf |
664 | fi |
665 | fi |
666 | |
667 | # check mtab, and replace with a symlink if required |
668 | if [[ ! -L ${MROOT}/etc/mtab ]] || \ |
669 | [[ $(readlink ${MROOT}/etc/mtab) != /proc/self/mounts ]] |
670 | then |
671 | ln -snf /proc/self/mounts ${MROOT}/etc/mtab |
672 | fi |
673 | |
674 | if [[ -z ${MROOT} ]] || [[ ${MROOT} = / ]] |
675 | then |
676 | # create machine-id |
677 | if [ ! -f /etc/machine-id ] |
678 | then |
679 | systemd-machine-id-setup |
680 | fi |
681 | # create a random-seed |
682 | /usr/lib/systemd/systemd-random-seed save |
683 | |
684 | # restart systemd daemon |
685 | systemctl daemon-reexec |
686 | |
687 | # restart systemd-logind daemon |
688 | systemctl try-restart systemd-logind.service |
689 | |
690 | # enable the services we install by default. |
691 | systemctl enable \ |
692 | getty@.service \ |
693 | remote-fs.target \ |
694 | systemd-readahead-replay.service \ |
695 | systemd-readahead-collect.service |
696 | fi |
697 | |
698 | if [[ ${SYSVINIT_SUPPORT} = 1 ]] |
699 | then |
700 | echo |
701 | echo "systemd has been installed to /usr/lib/systemd/systemd. Please ensure you append" |
702 | echo "init=/usr/lib/systemd/systemd to your kernel command line in your bootloader." |
703 | echo |
704 | fi |
705 | } |