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