blob: 6ac99cd63c891fe9e37dc9c06ea9d31d1c225437 [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001SUMMARY = "A System and service manager"
2HOMEPAGE = "http://www.freedesktop.org/wiki/Software/systemd"
3
4DESCRIPTION = "systemd is a system and service manager for Linux, compatible with \
5SysV and LSB init scripts. systemd provides aggressive parallelization \
6capabilities, uses socket and D-Bus activation for starting services, \
7offers on-demand starting of daemons, keeps track of processes using \
8Linux cgroups, supports snapshotting and restoring of the system \
9state, maintains mount and automount points and implements an \
10elaborate transactional dependency-based service control logic. It can \
11work as a drop-in replacement for sysvinit."
12
13LICENSE = "GPLv2 & LGPLv2.1"
14LIC_FILES_CHKSUM = "file://LICENSE.GPL2;md5=751419260aa954499f7abaabaa882bbe \
15 file://LICENSE.LGPL2.1;md5=4fbd65380cdd255951079008b364516c"
16
17PROVIDES = "udev"
18
19PE = "1"
20
21DEPENDS = "kmod docbook-sgml-dtd-4.1-native intltool-native gperf-native acl readline dbus libcap libcgroup glib-2.0 qemu-native util-linux"
22
23SECTION = "base/shell"
24
25inherit useradd pkgconfig autotools perlnative update-rc.d update-alternatives qemu systemd ptest gettext
26
27SRCREV = "e1439a1472c5f691733b8ef10e702beac2496a63"
28
29PV = "225+git${SRCPV}"
30
31SRC_URI = "git://github.com/systemd/systemd.git;protocol=git \
32 file://0003-binfmt-Don-t-install-dependency-links-at-install-tim.patch \
33 file://0004-configure-Check-for-additional-features-that-uclibc-.patch \
34 file://0005-nspawn-Use-execvpe-only-when-libc-supports-it.patch \
35 file://0006-journal-Use-posix-fallocate-only-if-available.patch \
36 file://0007-util-Use-mkostemp-only-if-libc-supports-it.patch \
37 file://0008-util-bypass-unimplemented-_SC_PHYS_PAGES-system-conf.patch \
38 file://0009-sysv-generator-add-support-for-executing-scripts-und.patch \
39 file://0010-Make-root-s-home-directory-configurable.patch \
40 file://0011-systemd-user-avoid-using-system-auth.patch \
41 file://0012-implment-systemd-sysv-install-for-OE.patch \
42 file://0014-Revert-rules-remove-firmware-loading-rules.patch \
43 file://0015-Revert-udev-remove-userspace-firmware-loading-suppor.patch \
44 file://touchscreen.rules \
45 file://00-create-volatile.conf \
46 file://init \
47 file://run-ptest \
48 "
49SRC_URI_append_qemuall = "file://qemuall_io_latency-core-device.c-Change-the-default-device-timeout-to-2.patch"
50
51S = "${WORKDIR}/git"
52
53SRC_URI_append_libc-uclibc = "\
54 file://0001-units-Prefer-getty-to-agetty-in-console-setup-system.patch \
55 "
56LDFLAGS_append_libc-uclibc = " -lrt"
57
58GTKDOC_DOCDIR = "${S}/docs/"
59
60PACKAGECONFIG ??= "xz ldconfig \
61 ${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'pam', '', d)} \
62 ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'xkbcommon', '', d)} \
63 ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'selinux', '', d)} \
64 "
65
66PACKAGECONFIG[journal-upload] = "--enable-libcurl,--disable-libcurl,curl"
67# Sign the journal for anti-tampering
68PACKAGECONFIG[gcrypt] = "--enable-gcrypt,--disable-gcrypt,libgcrypt"
69# regardless of PACKAGECONFIG, libgcrypt is always required to expand
70# the AM_PATH_LIBGCRYPT autoconf macro
71DEPENDS += "libgcrypt"
72# Compress the journal
73PACKAGECONFIG[xz] = "--enable-xz,--disable-xz,xz"
74PACKAGECONFIG[cryptsetup] = "--enable-libcryptsetup,--disable-libcryptsetup,cryptsetup"
75PACKAGECONFIG[microhttpd] = "--enable-microhttpd,--disable-microhttpd,libmicrohttpd"
76PACKAGECONFIG[elfutils] = "--enable-elfutils,--disable-elfutils,elfutils"
77PACKAGECONFIG[resolved] = "--enable-resolved,--disable-resolved"
78PACKAGECONFIG[networkd] = "--enable-networkd,--disable-networkd"
79PACKAGECONFIG[libidn] = "--enable-libidn,--disable-libidn,libidn"
80PACKAGECONFIG[audit] = "--enable-audit,--disable-audit,audit"
81PACKAGECONFIG[manpages] = "--enable-manpages,--disable-manpages,libxslt-native xmlto-native docbook-xml-dtd4-native docbook-xsl-stylesheets-native"
82PACKAGECONFIG[pam] = "--enable-pam,--disable-pam,libpam"
83# Verify keymaps on locale change
84PACKAGECONFIG[xkbcommon] = "--enable-xkbcommon,--disable-xkbcommon,libxkbcommon"
85# Update NAT firewall rules
86PACKAGECONFIG[iptc] = "--enable-libiptc,--disable-libiptc,iptables"
87PACKAGECONFIG[ldconfig] = "--enable-ldconfig,--disable-ldconfig,,"
88PACKAGECONFIG[selinux] = "--enable-selinux,--disable-selinux,libselinux"
89PACKAGECONFIG[valgrind] = "ac_cv_header_valgrind_memcheck_h=yes ac_cv_header_valgrind_valgrind_h=yes ,ac_cv_header_valgrind_memcheck_h=no ac_cv_header_valgrind_valgrind_h=no ,valgrind"
90
91CACHED_CONFIGUREVARS += "ac_cv_path_KILL=${base_bindir}/kill"
92CACHED_CONFIGUREVARS += "ac_cv_path_KMOD=${base_bindir}/kmod"
93CACHED_CONFIGUREVARS += "ac_cv_path_QUOTACHECK=${sbindir}/quotacheck"
94CACHED_CONFIGUREVARS += "ac_cv_path_QUOTAON=${sbindir}/quotaon"
95CACHED_CONFIGUREVARS += "ac_cv_path_SULOGIN=${base_sbindir}/sulogin"
96
97# Helper variables to clarify locations. This mirrors the logic in systemd's
98# build system.
99rootprefix ?= "${base_prefix}"
100rootlibdir ?= "${base_libdir}"
101rootlibexecdir = "${rootprefix}/lib"
102
103CACHED_CONFIGUREVARS_class-target = "\
104 ac_cv_path_MOUNT_PATH=${base_bindir}/mount \
105 ac_cv_path_UMOUNT_PATH=${base_bindir}/umount \
106 ac_cv_path_KMOD=${base_bindir}/kmod \
107 ac_cv_path_KILL=${base_bindir}/kill \
108 ac_cv_path_SULOGIN=${base_sbindir}/sulogin \
109 ac_cv_path_KEXEC=${sbindir}/kexec \
110 ac_cv_path_QUOTACHECK=${sbindir}/quotacheck \
111 ac_cv_path_QUOTAON=${sbindir}/quotaon \
112 "
113
114EXTRA_OECONF = " --with-rootprefix=${rootprefix} \
115 --with-rootlibdir=${rootlibdir} \
116 --with-roothomedir=${ROOT_HOME} \
117 --disable-coredump \
118 --enable-split-usr \
119 --without-python \
120 --with-sysvrcnd-path=${sysconfdir} \
121 --with-firmware-path=/lib/firmware \
122 "
123# uclibc does not have NSS
124EXTRA_OECONF_append_libc-uclibc = " --disable-myhostname "
125
126do_configure_prepend() {
127 export NM="${HOST_PREFIX}gcc-nm"
128 export AR="${HOST_PREFIX}gcc-ar"
129 export RANLIB="${HOST_PREFIX}gcc-ranlib"
130 export KMOD="${base_bindir}/kmod"
131 if [ -d ${S}/units.pre_sed ] ; then
132 cp -r ${S}/units.pre_sed ${S}/units
133 else
134 cp -r ${S}/units ${S}/units.pre_sed
135 fi
136 sed -i '/ln --relative --help/d' ${S}/configure.ac
137 sed -i -e 's:\$(LN_S) --relative -f:lnr:g' ${S}/Makefile.am
138 sed -i -e 's:\$(LN_S) --relative:lnr:g' ${S}/Makefile.am
139}
140
141do_install() {
142 autotools_do_install
143 install -d ${D}/${base_sbindir}
144 # Provided by a separate recipe
145 rm ${D}${systemd_unitdir}/system/serial-getty* -f
146
147 # Provide support for initramfs
148 [ ! -e ${D}/init ] && ln -s ${rootlibexecdir}/systemd/systemd ${D}/init
149 [ ! -e ${D}/${base_sbindir}/udevd ] && ln -s ${rootlibexecdir}/systemd/systemd-udevd ${D}/${base_sbindir}/udevd
150
151 # Create machine-id
152 # 20:12 < mezcalero> koen: you have three options: a) run systemd-machine-id-setup at install time, b) have / read-only and an empty file there (for stateless) and c) boot with / writable
153 touch ${D}${sysconfdir}/machine-id
154
155
156 install -d ${D}${sysconfdir}/udev/rules.d/
157 install -d ${D}${sysconfdir}/tmpfiles.d
158 install -m 0644 ${WORKDIR}/*.rules ${D}${sysconfdir}/udev/rules.d/
159
160 install -m 0644 ${WORKDIR}/00-create-volatile.conf ${D}${sysconfdir}/tmpfiles.d/
161
162 if ${@bb.utils.contains('DISTRO_FEATURES','sysvinit','true','false',d)}; then
163 install -d ${D}${sysconfdir}/init.d
164 install -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/systemd-udevd
165 sed -i s%@UDEVD@%${rootlibexecdir}/systemd/systemd-udevd% ${D}${sysconfdir}/init.d/systemd-udevd
166 fi
167
168 chown root:systemd-journal ${D}/${localstatedir}/log/journal
169
170 # Delete journal README, as log can be symlinked inside volatile.
171 rm -f ${D}/${localstatedir}/log/README
172
173 # Create symlinks for systemd-update-utmp-runlevel.service
174 install -d ${D}${systemd_unitdir}/system/graphical.target.wants
175 install -d ${D}${systemd_unitdir}/system/multi-user.target.wants
176 install -d ${D}${systemd_unitdir}/system/poweroff.target.wants
177 install -d ${D}${systemd_unitdir}/system/reboot.target.wants
178 install -d ${D}${systemd_unitdir}/system/rescue.target.wants
179 ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_unitdir}/system/graphical.target.wants/systemd-update-utmp-runlevel.service
180 ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_unitdir}/system/multi-user.target.wants/systemd-update-utmp-runlevel.service
181 ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_unitdir}/system/poweroff.target.wants/systemd-update-utmp-runlevel.service
182 ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_unitdir}/system/reboot.target.wants/systemd-update-utmp-runlevel.service
183 ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_unitdir}/system/rescue.target.wants/systemd-update-utmp-runlevel.service
184
185 # Enable journal to forward message to syslog daemon
186 sed -i -e 's/.*ForwardToSyslog.*/ForwardToSyslog=yes/' ${D}${sysconfdir}/systemd/journald.conf
187 # this file is needed to exist if networkd is disabled but timesyncd is still in use since timesyncd checks it
188 # for existence else it fails
189 if [ -s ${D}${libdir}/tmpfiles.d/systemd.conf ]; then
190 ${@bb.utils.contains('PACKAGECONFIG', 'networkd', ':', 'sed -i -e "\$ad /run/systemd/netif/links 0755 root root -" ${D}${libdir}/tmpfiles.d/systemd.conf', d)}
191 fi
192 install -Dm 0755 ${S}/src/systemctl/systemd-sysv-install.SKELETON ${D}${systemd_unitdir}/systemd-sysv-install
193}
194
195do_install_ptest () {
196 install -d ${D}${PTEST_PATH}/test
197 cp -rf ${S}/test/* ${D}${PTEST_PATH}/test
198 install -m 0755 ${B}/test-udev ${D}${PTEST_PATH}/
199 install -d ${D}${PTEST_PATH}/build-aux
200 cp ${S}/build-aux/test-driver ${D}${PTEST_PATH}/build-aux/
201 cp -rf ${B}/rules ${D}${PTEST_PATH}/
202 # This directory needs to be there for udev-test.pl to work.
203 install -d ${D}${libdir}/udev/rules.d
204 cp ${B}/Makefile ${D}${PTEST_PATH}/
205 cp ${S}/test/sys.tar.xz ${D}${PTEST_PATH}/test
206 sed -i 's/"tree"/"ls"/' ${D}${PTEST_PATH}/test/udev-test.pl
207 sed -i 's#${S}#${PTEST_PATH}#g' ${D}${PTEST_PATH}/Makefile
208 sed -i 's#${B}#${PTEST_PATH}#g' ${D}${PTEST_PATH}/Makefile
209}
210
211python populate_packages_prepend (){
212 systemdlibdir = d.getVar("rootlibdir", True)
213 do_split_packages(d, systemdlibdir, '^lib(.*)\.so\.*', 'lib%s', 'Systemd %s library', extra_depends='', allow_links=True)
214}
215PACKAGES_DYNAMIC += "^lib(udev|systemd).*"
216
217PACKAGES =+ "${PN}-gui ${PN}-vconsole-setup ${PN}-initramfs ${PN}-analyze ${PN}-kernel-install \
218 ${PN}-rpm-macros ${PN}-binfmt ${PN}-pam ${PN}-zsh ${PN}-xorg-xinitrc"
219
220SYSTEMD_PACKAGES = "${PN}-binfmt"
221SYSTEMD_SERVICE_${PN}-binfmt = "systemd-binfmt.service"
222
223USERADD_PACKAGES = "${PN}"
224USERADD_PARAM_${PN} += "--system systemd-journal-gateway; --system systemd-timesync"
225GROUPADD_PARAM_${PN} = "-r lock; -r systemd-journal"
226
227FILES_${PN}-analyze = "${bindir}/systemd-analyze"
228
229FILES_${PN}-initramfs = "/init"
230RDEPENDS_${PN}-initramfs = "${PN}"
231
232RDEPENDS_${PN}-ptest += "perl python bash"
233FILES_${PN}-ptest += "${libdir}/udev/rules.d"
234
235FILES_${PN}-dbg += "${libdir}/systemd/ptest/.debug"
236
237FILES_${PN}-gui = "${bindir}/systemadm"
238
239FILES_${PN}-vconsole-setup = "${rootlibexecdir}/systemd/systemd-vconsole-setup \
240 ${systemd_unitdir}/system/systemd-vconsole-setup.service \
241 ${systemd_unitdir}/system/sysinit.target.wants/systemd-vconsole-setup.service"
242
243RDEPENDS_${PN}-kernel-install += "bash"
244FILES_${PN}-kernel-install = "${bindir}/kernel-install \
245 ${sysconfdir}/kernel/ \
246 ${exec_prefix}/lib/kernel \
247 "
248FILES_${PN}-rpm-macros = "${exec_prefix}/lib/rpm \
249 "
250
251FILES_${PN}-xorg-xinitrc = "${sysconfdir}/X11/xinit/xinitrc.d/*"
252
253FILES_${PN}-zsh = "${datadir}/zsh/site-functions"
254
255FILES_${PN}-binfmt = "${sysconfdir}/binfmt.d/ \
256 ${exec_prefix}/lib/binfmt.d \
257 ${rootlibexecdir}/systemd/systemd-binfmt \
258 ${systemd_unitdir}/system/proc-sys-fs-binfmt_misc.* \
259 ${systemd_unitdir}/system/systemd-binfmt.service"
260RRECOMMENDS_${PN}-binfmt = "kernel-module-binfmt-misc"
261
262RRECOMMENDS_${PN}-vconsole-setup = "kbd kbd-consolefonts kbd-keymaps"
263
264CONFFILES_${PN} = "${sysconfdir}/systemd/journald.conf \
265 ${sysconfdir}/systemd/logind.conf \
266 ${sysconfdir}/systemd/system.conf \
267 ${sysconfdir}/systemd/user.conf"
268
269FILES_${PN} = " ${base_bindir}/* \
270 ${datadir}/bash-completion \
271 ${datadir}/dbus-1/services \
272 ${datadir}/dbus-1/system-services \
273 ${datadir}/polkit-1 \
274 ${datadir}/${BPN} \
275 ${datadir}/factory \
276 ${sysconfdir}/bash_completion.d/ \
277 ${sysconfdir}/dbus-1/ \
278 ${sysconfdir}/machine-id \
279 ${sysconfdir}/modules-load.d/ \
280 ${sysconfdir}/pam.d/ \
281 ${sysconfdir}/sysctl.d/ \
282 ${sysconfdir}/systemd/ \
283 ${sysconfdir}/tmpfiles.d/ \
284 ${sysconfdir}/xdg/ \
285 ${sysconfdir}/init.d/README \
286 ${rootlibexecdir}/systemd/* \
287 ${systemd_unitdir}/* \
288 ${base_libdir}/security/*.so \
289 ${libdir}/libnss_* \
290 /cgroup \
291 ${bindir}/systemd* \
292 ${bindir}/busctl \
293 ${bindir}/localectl \
294 ${bindir}/hostnamectl \
295 ${bindir}/timedatectl \
296 ${bindir}/bootctl \
297 ${bindir}/kernel-install \
298 ${exec_prefix}/lib/tmpfiles.d/*.conf \
299 ${exec_prefix}/lib/systemd \
300 ${exec_prefix}/lib/modules-load.d \
301 ${exec_prefix}/lib/sysctl.d \
302 ${exec_prefix}/lib/sysusers.d \
303 ${localstatedir} \
304 ${nonarch_base_libdir}/udev/rules.d/70-uaccess.rules \
305 ${nonarch_base_libdir}/udev/rules.d/71-seat.rules \
306 ${nonarch_base_libdir}/udev/rules.d/73-seat-late.rules \
307 ${nonarch_base_libdir}/udev/rules.d/99-systemd.rules \
308 "
309
310FILES_${PN}-dbg += "${rootlibdir}/.debug ${systemd_unitdir}/.debug ${systemd_unitdir}/*/.debug ${base_libdir}/security/.debug/"
311FILES_${PN}-dev += "${base_libdir}/security/*.la ${datadir}/dbus-1/interfaces/ ${sysconfdir}/rpm/macros.systemd"
312
313RDEPENDS_${PN} += "kmod dbus util-linux-mount udev (= ${EXTENDPKGV})"
314RDEPENDS_${PN} += "volatile-binds update-rc.d"
315
316RRECOMMENDS_${PN} += "systemd-serialgetty systemd-vconsole-setup \
317 systemd-compat-units udev-hwdb \
318 util-linux-agetty util-linux-fsck e2fsprogs-e2fsck \
319 kernel-module-autofs4 kernel-module-unix kernel-module-ipv6 \
320 os-release \
321"
322
323PACKAGES =+ "udev-dbg udev udev-hwdb"
324
325FILES_udev-dbg += "${nonarch_base_libdir}/udev/.debug"
326
327RPROVIDES_udev = "hotplug"
328
329RDEPENDS_udev-hwdb += "udev"
330
331FILES_udev += "${base_sbindir}/udevd \
332 ${rootlibexecdir}/systemd/systemd-udevd \
333 ${rootlibexecdir}/udev/accelerometer \
334 ${rootlibexecdir}/udev/ata_id \
335 ${rootlibexecdir}/udev/cdrom_id \
336 ${rootlibexecdir}/udev/collect \
337 ${rootlibexecdir}/udev/findkeyboards \
338 ${rootlibexecdir}/udev/keyboard-force-release.sh \
339 ${rootlibexecdir}/udev/keymap \
340 ${rootlibexecdir}/udev/mtd_probe \
341 ${rootlibexecdir}/udev/scsi_id \
342 ${rootlibexecdir}/udev/v4l_id \
343 ${rootlibexecdir}/udev/keymaps \
344 ${rootlibexecdir}/udev/rules.d/*.rules \
345 ${sysconfdir}/udev \
346 ${sysconfdir}/init.d/systemd-udevd \
347 ${systemd_unitdir}/system/*udev* \
348 ${systemd_unitdir}/system/*.wants/*udev* \
349 ${base_bindir}/udevadm \
350 ${datadir}/bash-completion/completions/udevadm \
351 "
352
353FILES_udev-hwdb = "${rootlibexecdir}/udev/hwdb.d"
354
355INITSCRIPT_PACKAGES = "udev"
356INITSCRIPT_NAME_udev = "systemd-udevd"
357INITSCRIPT_PARAMS_udev = "start 03 S ."
358
359python __anonymous() {
360 if not bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d):
361 d.setVar("INHIBIT_UPDATERCD_BBCLASS", "1")
362}
363
364# TODO:
365# u-a for runlevel and telinit
366
367ALTERNATIVE_${PN} = "init halt reboot shutdown poweroff runlevel"
368
369ALTERNATIVE_TARGET[init] = "${rootlibexecdir}/systemd/systemd"
370ALTERNATIVE_LINK_NAME[init] = "${base_sbindir}/init"
371ALTERNATIVE_PRIORITY[init] ?= "300"
372
373ALTERNATIVE_TARGET[halt] = "${base_bindir}/systemctl"
374ALTERNATIVE_LINK_NAME[halt] = "${base_sbindir}/halt"
375ALTERNATIVE_PRIORITY[halt] ?= "300"
376
377ALTERNATIVE_TARGET[reboot] = "${base_bindir}/systemctl"
378ALTERNATIVE_LINK_NAME[reboot] = "${base_sbindir}/reboot"
379ALTERNATIVE_PRIORITY[reboot] ?= "300"
380
381ALTERNATIVE_TARGET[shutdown] = "${base_bindir}/systemctl"
382ALTERNATIVE_LINK_NAME[shutdown] = "${base_sbindir}/shutdown"
383ALTERNATIVE_PRIORITY[shutdown] ?= "300"
384
385ALTERNATIVE_TARGET[poweroff] = "${base_bindir}/systemctl"
386ALTERNATIVE_LINK_NAME[poweroff] = "${base_sbindir}/poweroff"
387ALTERNATIVE_PRIORITY[poweroff] ?= "300"
388
389ALTERNATIVE_TARGET[runlevel] = "${base_bindir}/systemctl"
390ALTERNATIVE_LINK_NAME[runlevel] = "${base_sbindir}/runlevel"
391ALTERNATIVE_PRIORITY[runlevel] ?= "300"
392
393pkg_postinst_udev-hwdb () {
394 if test -n "$D"; then
395 ${@qemu_run_binary(d, '$D', '${base_bindir}/udevadm')} hwdb --update \
396 --root $D
397 else
398 udevadm hwdb --update
399 fi
400}
401
402pkg_prerm_udev-hwdb () {
403 if test -n "$D"; then
404 exit 1
405 fi
406
407 rm -f ${sysconfdir}/udev/hwdb.bin
408}
409
410# As this recipe builds udev, respect systemd being in DISTRO_FEATURES so
411# that we don't build both udev and systemd in world builds.
412python () {
413 if not bb.utils.contains ('DISTRO_FEATURES', 'systemd', True, False, d):
414 raise bb.parse.SkipPackage("'systemd' not in DISTRO_FEATURES")
415}