From c527fd1f14c27855a37f2e8ac5346ce8d940ced2 Mon Sep 17 00:00:00 2001 From: Tudor Florea Date: Thu, 16 Oct 2014 03:05:19 +0200 Subject: initial commit for Enea Linux 4.0-140929 Migrated from the internal git server on the daisy-enea-point-release branch Signed-off-by: Tudor Florea --- meta/recipes-core/systemd/systemd-compat-units.bb | 41 ++ meta/recipes-core/systemd/systemd-serialgetty.bb | 49 ++ .../systemd-serialgetty/serial-getty@.service | 36 ++ .../systemd/systemd-systemctl-native.bb | 15 + .../systemd/systemd-systemctl/systemctl | 153 ++++++ .../systemd/systemd/00-create-volatile.conf | 7 + ...1-uClibc-doesn-t-implement-pwritev-preadv.patch | 34 ++ .../systemd/systemd/binfmt-install.patch | 56 +++ meta/recipes-core/systemd/systemd/init | 104 +++++ .../systemd/systemd/optional_secure_getenv.patch | 19 + meta/recipes-core/systemd/systemd/run-ptest | 3 + ...t-use-assert_return-to-check-for-disconne.patch | 513 +++++++++++++++++++++ .../systemd-pam-configure-check-uclibc.patch | 32 ++ .../systemd/systemd/systemd-pam-fix-execvpe.patch | 29 ++ .../systemd/systemd-pam-fix-fallocate.patch | 84 ++++ .../systemd/systemd-pam-fix-getty-unit.patch | 35 ++ .../systemd/systemd/systemd-pam-fix-mkostemp.patch | 30 ++ .../recipes-core/systemd/systemd/touchscreen.rules | 18 + .../systemd/systemd/uclibc-get-physmem.patch | 37 ++ .../systemd/systemd/uclibc-sysinfo_h.patch | 19 + meta/recipes-core/systemd/systemd_211.bb | 353 ++++++++++++++ 21 files changed, 1667 insertions(+) create mode 100644 meta/recipes-core/systemd/systemd-compat-units.bb create mode 100644 meta/recipes-core/systemd/systemd-serialgetty.bb create mode 100644 meta/recipes-core/systemd/systemd-serialgetty/serial-getty@.service create mode 100644 meta/recipes-core/systemd/systemd-systemctl-native.bb create mode 100755 meta/recipes-core/systemd/systemd-systemctl/systemctl create mode 100644 meta/recipes-core/systemd/systemd/00-create-volatile.conf create mode 100644 meta/recipes-core/systemd/systemd/0001-uClibc-doesn-t-implement-pwritev-preadv.patch create mode 100644 meta/recipes-core/systemd/systemd/binfmt-install.patch create mode 100644 meta/recipes-core/systemd/systemd/init create mode 100644 meta/recipes-core/systemd/systemd/optional_secure_getenv.patch create mode 100644 meta/recipes-core/systemd/systemd/run-ptest create mode 100644 meta/recipes-core/systemd/systemd/sd-bus-don-t-use-assert_return-to-check-for-disconne.patch create mode 100644 meta/recipes-core/systemd/systemd/systemd-pam-configure-check-uclibc.patch create mode 100644 meta/recipes-core/systemd/systemd/systemd-pam-fix-execvpe.patch create mode 100644 meta/recipes-core/systemd/systemd/systemd-pam-fix-fallocate.patch create mode 100644 meta/recipes-core/systemd/systemd/systemd-pam-fix-getty-unit.patch create mode 100644 meta/recipes-core/systemd/systemd/systemd-pam-fix-mkostemp.patch create mode 100644 meta/recipes-core/systemd/systemd/touchscreen.rules create mode 100644 meta/recipes-core/systemd/systemd/uclibc-get-physmem.patch create mode 100644 meta/recipes-core/systemd/systemd/uclibc-sysinfo_h.patch create mode 100644 meta/recipes-core/systemd/systemd_211.bb (limited to 'meta/recipes-core/systemd') diff --git a/meta/recipes-core/systemd/systemd-compat-units.bb b/meta/recipes-core/systemd/systemd-compat-units.bb new file mode 100644 index 0000000000..6419bc2c65 --- /dev/null +++ b/meta/recipes-core/systemd/systemd-compat-units.bb @@ -0,0 +1,41 @@ +SUMMARY = "Enhances systemd compatilibity with existing SysVinit scripts" + +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690" + +PR = "r29" + +DEPENDS = "systemd-systemctl-native" + +inherit allarch + +ALLOW_EMPTY_${PN} = "1" + +SYSTEMD_DISABLED_SYSV_SERVICES = " \ + busybox-udhcpc \ + hwclock \ + networking \ + nfsserver \ + nfscommon \ + syslog.busybox \ +" + +pkg_postinst_${PN} () { + cd $D${sysconfdir}/init.d + + echo "Disabling the following sysv scripts: " + + OPTS="" + + if [ -n "$D" ]; then + OPTS="--root=$D" + fi + + for i in ${SYSTEMD_DISABLED_SYSV_SERVICES} ; do + if [ \( -e $i -o $i.sh \) -a ! \( -e $D${sysconfdir}/systemd/system/$i.service -o -e $D${systemd_unitdir}/system/$i.service \) ] ; then + echo -n "$i: " ; systemctl ${OPTS} mask $i.service + fi + done ; echo +} + +RDPEPENDS_${PN} = "systemd" diff --git a/meta/recipes-core/systemd/systemd-serialgetty.bb b/meta/recipes-core/systemd/systemd-serialgetty.bb new file mode 100644 index 0000000000..13b2dbacec --- /dev/null +++ b/meta/recipes-core/systemd/systemd-serialgetty.bb @@ -0,0 +1,49 @@ +SUMMARY = "Serial terminal support for systemd" +LICENSE = "GPLv2+" +LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6" + +PR = "r5" + +SERIAL_CONSOLE ?= "115200 ttyS0" + +SRC_URI = "file://serial-getty@.service" + +do_install() { + if [ ! -z "${SERIAL_CONSOLES}" ] ; then + default_baudrate=`echo "${SERIAL_CONSOLES}" | sed 's/\;.*//'` + install -d ${D}${systemd_unitdir}/system/ + install -d ${D}${sysconfdir}/systemd/system/getty.target.wants/ + install -m 0644 ${WORKDIR}/serial-getty@.service ${D}${systemd_unitdir}/system/ + sed -i -e s/\@BAUDRATE\@/$default_baudrate/g ${D}${systemd_unitdir}/system/serial-getty@.service + + tmp="${SERIAL_CONSOLES}" + for entry in $tmp ; do + baudrate=`echo $entry | sed 's/\;.*//'` + ttydev=`echo $entry | sed -e 's/^[0-9]*\;//' -e 's/\;.*//'` + if [ "$baudrate" = "$default_baudrate" ] ; then + # enable the service + ln -sf ${systemd_unitdir}/system/serial-getty@.service \ + ${D}${sysconfdir}/systemd/system/getty.target.wants/serial-getty@$ttydev.service + else + # install custom service file for the non-default baudrate + install -m 0644 ${WORKDIR}/serial-getty@.service ${D}${systemd_unitdir}/system/serial-getty$baudrate@.service + sed -i -e s/\@BAUDRATE\@/$baudrate/g ${D}${systemd_unitdir}/system/serial-getty$baudrate@.service + # enable the service + ln -sf ${systemd_unitdir}/system/serial-getty$baudrate@.service \ + ${D}${sysconfdir}/systemd/system/getty.target.wants/serial-getty$baudrate@$ttydev.service + fi + done + fi +} + +RDEPENDS_${PN} = "systemd" + +# This is a machine specific file +FILES_${PN} = "${systemd_unitdir}/system/*.service ${sysconfdir}" +PACKAGE_ARCH = "${MACHINE_ARCH}" + +# As this package is tied to systemd, only build it when we're also building systemd. +python () { + if not oe.utils.contains ('DISTRO_FEATURES', 'systemd', True, False, d): + raise bb.parse.SkipPackage("'systemd' not in DISTRO_FEATURES") +} diff --git a/meta/recipes-core/systemd/systemd-serialgetty/serial-getty@.service b/meta/recipes-core/systemd/systemd-serialgetty/serial-getty@.service new file mode 100644 index 0000000000..865de3402d --- /dev/null +++ b/meta/recipes-core/systemd/systemd-serialgetty/serial-getty@.service @@ -0,0 +1,36 @@ +# This file is part of systemd. +# +# systemd is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 2.1 of the License, or +# (at your option) any later version. + +[Unit] +Description=Serial Getty on %I +Documentation=man:agetty(8) man:systemd-getty-generator(8) +Documentation=http://0pointer.de/blog/projects/serial-console.html +BindsTo=dev-%i.device +After=dev-%i.device systemd-user-sessions.service plymouth-quit-wait.service +After=rc-local.service + +# If additional gettys are spawned during boot then we should make +# sure that this is synchronized before getty.target, even though +# getty.target didn't actually pull it in. +Before=getty.target +IgnoreOnIsolate=yes + +[Service] +ExecStart=-/sbin/agetty --keep-baud %I @BAUDRATE@ $TERM +Type=idle +Restart=always +RestartSec=0 +UtmpIdentifier=%I +TTYPath=/dev/%I +TTYReset=yes +TTYVHangup=yes +KillMode=process +IgnoreSIGPIPE=no +SendSIGHUP=yes + +[Install] +WantedBy=getty.target diff --git a/meta/recipes-core/systemd/systemd-systemctl-native.bb b/meta/recipes-core/systemd/systemd-systemctl-native.bb new file mode 100644 index 0000000000..72bc77df4f --- /dev/null +++ b/meta/recipes-core/systemd/systemd-systemctl-native.bb @@ -0,0 +1,15 @@ +SUMMARY = "Wrapper for enabling systemd services" + +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690" + +PR = "r6" + +inherit native + +SRC_URI = "file://systemctl" + +do_install() { + install -d ${D}${bindir} + install -m 0755 ${WORKDIR}/systemctl ${D}${bindir} +} diff --git a/meta/recipes-core/systemd/systemd-systemctl/systemctl b/meta/recipes-core/systemd/systemd-systemctl/systemctl new file mode 100755 index 0000000000..b37f27abfb --- /dev/null +++ b/meta/recipes-core/systemd/systemd-systemctl/systemctl @@ -0,0 +1,153 @@ +#!/bin/sh +echo "Started $0 $*" + +ROOT= + +# parse command line params +action= +while [ $# != 0 ]; do + opt="$1" + + case "$opt" in + enable) + shift + + action="$opt" + services="$1" + cmd_args="1" + shift + ;; + disable) + shift + + action="$opt" + services="$1" + cmd_args="1" + shift + ;; + mask) + shift + + action="$opt" + services="$1" + cmd_args="1" + shift + ;; + preset) + shift + + action="$opt" + services="$1" + cmd_args="1" + shift + ;; + --root=*) + ROOT=${opt##--root=} + cmd_args="0" + shift + ;; + *) + if [ "$cmd_args" = "1" ]; then + services="$services $opt" + shift + else + echo "'$opt' is an unkown option; exiting with error" + exit 1 + fi + ;; + esac +done +if [ "$action" = "preset" -a "$service_file" = "" ]; then + services=$(for f in `find $ROOT/etc/systemd/system $ROOT/lib/systemd/system $ROOT/usr/lib/systemd/system -type f 2>1`; do basename $f; done) + services="$services $opt" + presetall=1 +fi + +for service in $services; do + if [ "$presetall" = "1" ]; then + action="preset" + fi + if [ "$action" = "mask" ]; then + if [ ! -d $ROOT/etc/systemd/system/ ]; then + mkdir -p $ROOT/etc/systemd/system/ + fi + cmd="ln -s /dev/null $ROOT/etc/systemd/system/$service" + echo "$cmd" + $cmd + exit 0 + fi + + echo "Try to find location of $service..." + # find service file + for p in $ROOT/etc/systemd/system \ + $ROOT/lib/systemd/system \ + $ROOT/usr/lib/systemd/system; do + if [ -e $p/$service ]; then + service_file=$p/$service + service_file=${service_file##$ROOT} + fi + done + if [ -z "$service_file" ]; then + echo "'$service' couldn't be found; exiting with error" + exit 1 + fi + echo "Found $service in $service_file" + + # If any new unit types are added to systemd they should be added + # to this regular expression. + unit_types_re='\.\(service\|socket\|device\|mount\|automount\|swap\|target\|path\|timer\|snapshot\)$' + if [ "$action" = "preset" ]; then + action=`egrep -sh $service $ROOT/etc/systemd/user-preset/*.preset | cut -f1 -d' '` + if [ -z "$action" ]; then + globalpreset=`egrep -sh '\*' $ROOT/etc/systemd/user-preset/*.preset | cut -f1 -d' '` + if [ -n "$globalpreset" ]; then + action="$globalpreset" + else + action="enable" + fi + fi + fi + # create the required symbolic links + wanted_by=$(sed '/^WantedBy[[:space:]]*=/s,[^=]*=,,p;d' "$ROOT/$service_file" \ + | tr ',' '\n' \ + | grep "$unit_types_re") + + for r in $wanted_by; do + echo "WantedBy=$r found in $service" + if [ "$action" = "enable" ]; then + mkdir -p $ROOT/etc/systemd/system/$r.wants + ln -s $service_file $ROOT/etc/systemd/system/$r.wants + echo "Enabled $service for $wanted_by." + else + rm -f $ROOT/etc/systemd/system/$r.wants/$service + rmdir --ignore-fail-on-non-empty -p $ROOT/etc/systemd/system/$r.wants + echo "Disabled $service for $wanted_by." + fi + done + + # create the required symbolic 'Alias' links + alias=$(sed '/^Alias[[:space:]]*=/s,[^=]*=,,p;d' "$ROOT/$service_file" \ + | tr ',' '\n' \ + | grep "$unit_types_re") + + for r in $alias; do + if [ "$action" = "enable" ]; then + mkdir -p $ROOT/etc/systemd/system + ln -s $service_file $ROOT/etc/systemd/system/$r + echo "Enabled $service for $alias." + else + rm -f $ROOT/etc/systemd/system/$r + echo "Disabled $service for $alias." + fi + done + + # call us for the other required scripts + also=$(sed '/^Also[[:space:]]*=/s,[^=]*=,,p;d' "$ROOT/$service_file" \ + | tr ',' '\n') + for a in $also; do + echo "Also=$a found in $service" + if [ "$action" = "enable" ]; then + $0 --root=$ROOT enable $a + fi + done +done diff --git a/meta/recipes-core/systemd/systemd/00-create-volatile.conf b/meta/recipes-core/systemd/systemd/00-create-volatile.conf new file mode 100644 index 0000000000..9ffa88e464 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/00-create-volatile.conf @@ -0,0 +1,7 @@ +#This goes hand-in-hand with the base-files of OE-Core. The file must +# be sorted before 'systemd.conf' becuase this attempts to create a file +# inside /var/log. + + +d /var/volatile/log - - - - +d /var/volatile/tmp - - - - diff --git a/meta/recipes-core/systemd/systemd/0001-uClibc-doesn-t-implement-pwritev-preadv.patch b/meta/recipes-core/systemd/systemd/0001-uClibc-doesn-t-implement-pwritev-preadv.patch new file mode 100644 index 0000000000..9fdb3c9ab3 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0001-uClibc-doesn-t-implement-pwritev-preadv.patch @@ -0,0 +1,34 @@ +Upstream-Status: Inappropriate [uclibc specific] + +From 7be9273548bcb1f57d011fc252965e45dd2a058c Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Wed, 21 Aug 2013 19:09:27 -0700 +Subject: [PATCH] uClibc doesn't implement pwritev/preadv + +Lets stub out the testcase for building. + +Signed-off-by: Khem Raj +--- + src/libsystemd-bus/test-bus-memfd.c | 2 ++ + 1 file changed, 2 insertions(+) + +Index: systemd-209/src/libsystemd/sd-bus/test-bus-memfd.c +=================================================================== +--- systemd-209.orig/src/libsystemd/sd-bus/test-bus-memfd.c 2014-02-19 15:03:09.983254602 -0800 ++++ systemd-209/src/libsystemd/sd-bus/test-bus-memfd.c 2014-02-19 23:42:10.636652864 -0800 +@@ -151,6 +151,7 @@ + /* check content */ + assert_se(memcmp(buf, "ll", 2) == 0); + ++#ifndef __UCLIBC__ + /* writev it out*/ + iov[0].iov_base = (char *)"ABC"; + iov[0].iov_len = 3; +@@ -173,6 +174,7 @@ + assert_se(memcmp(bufv[0], "ABC", 3) == 0); + assert_se(memcmp(bufv[1], "DEF", 3) == 0); + assert_se(memcmp(bufv[2], "GHI", 3) == 0); ++#endif /* __UCLIBC__ */ + + sd_memfd_free(m); + diff --git a/meta/recipes-core/systemd/systemd/binfmt-install.patch b/meta/recipes-core/systemd/systemd/binfmt-install.patch new file mode 100644 index 0000000000..c2d5099f24 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/binfmt-install.patch @@ -0,0 +1,56 @@ +Don't install dependency links at install time for the binfmt services, use +[Install] blocks so that they get created when the service is enabled like a +traditional service. + +The [Install] blocks were rejected upstream as they don't have a way to "enable" +it on install without static symlinks which can't be disabled, only masked. We +however can do that in a postinst. + +Upstream-Status: Denied +Signed-off-by: Ross Burton + +diff --git a/Makefile.am b/Makefile.am +index 7933de6..78acb6f 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -3133,10 +3133,6 @@ INSTALL_DIRS += \ + $(prefix)/lib/binfmt.d \ + $(sysconfdir)/binfmt.d + +-SYSINIT_TARGET_WANTS += \ +- systemd-binfmt.service \ +- proc-sys-fs-binfmt_misc.automount +- + endif + + EXTRA_DIST += \ +diff --git a/units/proc-sys-fs-binfmt_misc.automount b/units/proc-sys-fs-binfmt_misc.automount +index 6be3893..709adef 100644 +--- a/units/proc-sys-fs-binfmt_misc.automount ++++ b/units/proc-sys-fs-binfmt_misc.automount +@@ -16,3 +16,6 @@ ConditionPathIsReadWrite=/proc/sys/ + + [Automount] + Where=/proc/sys/fs/binfmt_misc ++ ++[Install] ++WantedBy=sysinit.target +diff --git a/units/systemd-binfmt.service.in b/units/systemd-binfmt.service.in +index 02dfe77..86d3481 100644 +--- a/units/systemd-binfmt.service.in ++++ b/units/systemd-binfmt.service.in +@@ -11,6 +11,7 @@ Documentation=man:systemd-binfmt.service(8) man:binfmt.d(5) + Documentation=https://www.kernel.org/doc/Documentation/binfmt_misc.txt + DefaultDependencies=no + Conflicts=shutdown.target ++Wants=proc-sys-fs-binfmt_misc.automount + After=systemd-readahead-collect.service systemd-readahead-replay.service proc-sys-fs-binfmt_misc.automount + Before=sysinit.target shutdown.target + ConditionPathIsReadWrite=/proc/sys/ +@@ -24,3 +25,6 @@ ConditionDirectoryNotEmpty=|/run/binfmt.d + Type=oneshot + RemainAfterExit=yes + ExecStart=@rootlibexecdir@/systemd-binfmt ++ ++[Install] ++WantedBy=sysinit.target diff --git a/meta/recipes-core/systemd/systemd/init b/meta/recipes-core/systemd/systemd/init new file mode 100644 index 0000000000..ea52be4820 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/init @@ -0,0 +1,104 @@ +#!/bin/sh + +### BEGIN INIT INFO +# Provides: udev +# Required-Start: mountvirtfs +# Required-Stop: +# Default-Start: S +# Default-Stop: +# Short-Description: Start udevd, populate /dev and load drivers. +### END INIT INFO + +. /etc/init.d/functions + +export TZ=/etc/localtime + +[ -d /sys/class ] || exit 1 +[ -r /proc/mounts ] || exit 1 +[ -x @UDEVD@ ] || exit 1 +[ -f /etc/default/udev-cache ] && . /etc/default/udev-cache +[ -f /etc/udev/udev.conf ] && . /etc/udev/udev.conf + +readfile () { + filename=$1 + READDATA="" + if [ -r $filename ]; then + while read line; do + READDATA="$READDATA$line" + done < $filename + fi +} + +case "$1" in + start) + export ACTION=add + # propagate /dev from /sys + echo "Starting udev" + + # mount the devtmpfs on /dev, if not already done + LANG=C awk '$2 == "/dev" && ($3 == "devtmpfs") { exit 1 }' /proc/mounts && { + mount -n -o mode=0755 -t devtmpfs none "/dev" + } + [ -e /dev/pts ] || mkdir -m 0755 /dev/pts + [ -e /dev/shm ] || mkdir -m 1777 /dev/shm + mount -a -t tmpfs 2>/dev/null + + # cache handling + if [ "$DEVCACHE" != "" ]; then + readfile /proc/version + VERSION="$READDATA" + readfile /proc/cmdline + CMDLINE="$READDATA" + readfile /proc/devices + DEVICES="$READDATA" + readfile /proc/atags + ATAGS="$READDATA" + + if [ -e $DEVCACHE ]; then + readfile /etc/udev/cache.data + if [ "$READDATA" = "$VERSION$CMDLINE$DEVICES$ATAGS" ]; then + (cd /; tar xf $DEVCACHE > /dev/null 2>&1) + not_first_boot=1 + [ "$VERBOSE" != "no" ] && echo "udev: using cache file $DEVCACHE" + [ -e /dev/shm/udev.cache ] && rm -f /dev/shm/udev.cache + else + echo "$VERSION$CMDLINE$DEVICES$ATAGS" > /dev/shm/udev.cache + fi + else + echo "$VERSION$CMDLINE$DEVICES$ATAGS" > /dev/shm/udev.cache + fi + fi + + # make_extra_nodes + killproc systemd-udevd > "/dev/null" 2>&1 + + # trigger the sorted events + echo -e '\000\000\000\000' > /proc/sys/kernel/hotplug + @UDEVD@ -d + + udevadm control --env=STARTUP=1 + if [ "$not_first_boot" != "" ];then + udevadm trigger --action=add --subsystem-nomatch=tty --subsystem-nomatch=mem --subsystem-nomatch=vc --subsystem-nomatch=vtconsole --subsystem-nomatch=misc --subsystem-nomatch=dcon --subsystem-nomatch=pci_bus --subsystem-nomatch=graphics --subsystem-nomatch=backlight --subsystem-nomatch=video4linux --subsystem-nomatch=platform + (udevadm settle --timeout=3; udevadm control --env=STARTUP=)& + else + udevadm trigger --action=add + udevadm settle + fi + ;; + stop) + echo "Stopping udevd" + start-stop-daemon --stop --name systemd-udevd --quiet + ;; + restart) + $0 stop + sleep 1 + $0 start + ;; + status) + status systemd-udevd + ;; + *) + echo "Usage: $0 {start|stop|status|restart}" + exit 1 +esac +exit 0 diff --git a/meta/recipes-core/systemd/systemd/optional_secure_getenv.patch b/meta/recipes-core/systemd/systemd/optional_secure_getenv.patch new file mode 100644 index 0000000000..2063268246 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/optional_secure_getenv.patch @@ -0,0 +1,19 @@ +on uclibc secure_getenv is not available +therefore default to using getenv instead + +Upstream-Status: Denied [no desire for uclibc support] +Signed-off-by: Khem Raj + +Index: git/src/shared/missing.h +=================================================================== +--- git.orig/src/shared/missing.h 2012-09-22 18:46:44.141282145 -0700 ++++ git/src/shared/missing.h 2012-09-22 18:48:44.081276570 -0700 +@@ -233,6 +233,8 @@ + #ifndef HAVE_SECURE_GETENV + # ifdef HAVE___SECURE_GETENV + # define secure_getenv __secure_getenv ++# elif defined __UCLIBC__ ++# define secure_getenv getenv + # else + # error neither secure_getenv nor __secure_getenv are available + # endif diff --git a/meta/recipes-core/systemd/systemd/run-ptest b/meta/recipes-core/systemd/systemd/run-ptest new file mode 100644 index 0000000000..2f6bd93a5b --- /dev/null +++ b/meta/recipes-core/systemd/systemd/run-ptest @@ -0,0 +1,3 @@ +tar -C test -xJf test/sys.tar.xz +make test/rules-test.sh.log +make test/udev-test.pl.log diff --git a/meta/recipes-core/systemd/systemd/sd-bus-don-t-use-assert_return-to-check-for-disconne.patch b/meta/recipes-core/systemd/systemd/sd-bus-don-t-use-assert_return-to-check-for-disconne.patch new file mode 100644 index 0000000000..c5bee97238 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/sd-bus-don-t-use-assert_return-to-check-for-disconne.patch @@ -0,0 +1,513 @@ +From a3d59cd1b0a2738d06893948492113f2c35be0af Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Wed, 19 Mar 2014 21:41:21 +0100 +Subject: [PATCH] sd-bus: don't use assert_return() to check for disconnected + bus connections + +A terminated connection is a runtime error and not a developer mistake, +hence don't use assert_return() to check for it. + +Upstream-Status: Backport + +Signed-off-by: Jonathan Liu +--- + src/libsystemd/sd-bus/bus-control.c | 20 +++++++++--- + src/libsystemd/sd-bus/bus-convenience.c | 58 +++++++++++++++++++++++++-------- + src/libsystemd/sd-bus/bus-objects.c | 23 +++++++++---- + src/libsystemd/sd-bus/sd-bus.c | 49 ++++++++++++++++++++-------- + 4 files changed, 113 insertions(+), 37 deletions(-) + +diff --git a/src/libsystemd/sd-bus/bus-control.c b/src/libsystemd/sd-bus/bus-control.c +index bb6683e..bd392a2 100644 +--- a/src/libsystemd/sd-bus/bus-control.c ++++ b/src/libsystemd/sd-bus/bus-control.c +@@ -128,12 +128,14 @@ _public_ int sd_bus_request_name(sd_bus *bus, const char *name, uint64_t flags) + assert_return(bus, -EINVAL); + assert_return(name, -EINVAL); + assert_return(bus->bus_client, -EINVAL); +- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN); + assert_return(!bus_pid_changed(bus), -ECHILD); + assert_return(!(flags & ~(SD_BUS_NAME_ALLOW_REPLACEMENT|SD_BUS_NAME_REPLACE_EXISTING|SD_BUS_NAME_QUEUE)), -EINVAL); + assert_return(service_name_is_valid(name), -EINVAL); + assert_return(name[0] != ':', -EINVAL); + ++ if (!BUS_IS_OPEN(bus->state)) ++ return -ENOTCONN; ++ + if (bus->is_kernel) + return bus_request_name_kernel(bus, name, flags); + else +@@ -201,11 +203,13 @@ _public_ int sd_bus_release_name(sd_bus *bus, const char *name) { + assert_return(bus, -EINVAL); + assert_return(name, -EINVAL); + assert_return(bus->bus_client, -EINVAL); +- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN); + assert_return(!bus_pid_changed(bus), -ECHILD); + assert_return(service_name_is_valid(name), -EINVAL); + assert_return(name[0] != ':', -EINVAL); + ++ if (!BUS_IS_OPEN(bus->state)) ++ return -ENOTCONN; ++ + if (bus->is_kernel) + return bus_release_name_kernel(bus, name); + else +@@ -342,9 +346,11 @@ static int bus_list_names_dbus1(sd_bus *bus, char ***acquired, char ***activatab + _public_ int sd_bus_list_names(sd_bus *bus, char ***acquired, char ***activatable) { + assert_return(bus, -EINVAL); + assert_return(acquired || activatable, -EINVAL); +- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN); + assert_return(!bus_pid_changed(bus), -ECHILD); + ++ if (!BUS_IS_OPEN(bus->state)) ++ return -ENOTCONN; ++ + if (bus->is_kernel) + return bus_list_names_kernel(bus, acquired, activatable); + else +@@ -735,11 +741,13 @@ _public_ int sd_bus_get_owner( + assert_return(name, -EINVAL); + assert_return(mask <= _SD_BUS_CREDS_ALL, -ENOTSUP); + assert_return(mask == 0 || creds, -EINVAL); +- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN); + assert_return(!bus_pid_changed(bus), -ECHILD); + assert_return(service_name_is_valid(name), -EINVAL); + assert_return(bus->bus_client, -ENODATA); + ++ if (!BUS_IS_OPEN(bus->state)) ++ return -ENOTCONN; ++ + if (bus->is_kernel) + return bus_get_owner_kdbus(bus, name, mask, creds); + else +@@ -1196,10 +1204,12 @@ _public_ int sd_bus_get_owner_machine_id(sd_bus *bus, const char *name, sd_id128 + assert_return(bus, -EINVAL); + assert_return(name, -EINVAL); + assert_return(machine, -EINVAL); +- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN); + assert_return(!bus_pid_changed(bus), -ECHILD); + assert_return(service_name_is_valid(name), -EINVAL); + ++ if (!BUS_IS_OPEN(bus->state)) ++ return -ENOTCONN; ++ + if (streq_ptr(name, bus->unique_name)) + return sd_id128_get_machine(machine); + +diff --git a/src/libsystemd/sd-bus/bus-convenience.c b/src/libsystemd/sd-bus/bus-convenience.c +index 6e02ad3..c5b9cd4 100644 +--- a/src/libsystemd/sd-bus/bus-convenience.c ++++ b/src/libsystemd/sd-bus/bus-convenience.c +@@ -36,9 +36,11 @@ _public_ int sd_bus_emit_signal( + int r; + + assert_return(bus, -EINVAL); +- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN); + assert_return(!bus_pid_changed(bus), -ECHILD); + ++ if (!BUS_IS_OPEN(bus->state)) ++ return -ENOTCONN; ++ + r = sd_bus_message_new_signal(bus, &m, path, interface, member); + if (r < 0) + return r; +@@ -70,9 +72,11 @@ _public_ int sd_bus_call_method( + int r; + + assert_return(bus, -EINVAL); +- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN); + assert_return(!bus_pid_changed(bus), -ECHILD); + ++ if (!BUS_IS_OPEN(bus->state)) ++ return -ENOTCONN; ++ + r = sd_bus_message_new_method_call(bus, &m, destination, path, interface, member); + if (r < 0) + return r; +@@ -100,9 +104,12 @@ _public_ int sd_bus_reply_method_return( + assert_return(call, -EINVAL); + assert_return(call->sealed, -EPERM); + assert_return(call->header->type == SD_BUS_MESSAGE_METHOD_CALL, -EINVAL); +- assert_return(call->bus && BUS_IS_OPEN(call->bus->state), -ENOTCONN); ++ assert_return(call->bus, -EINVAL); + assert_return(!bus_pid_changed(call->bus), -ECHILD); + ++ if (!BUS_IS_OPEN(call->bus->state)) ++ return -ENOTCONN; ++ + if (call->header->flags & BUS_MESSAGE_NO_REPLY_EXPECTED) + return 0; + +@@ -134,9 +141,12 @@ _public_ int sd_bus_reply_method_error( + assert_return(call->sealed, -EPERM); + assert_return(call->header->type == SD_BUS_MESSAGE_METHOD_CALL, -EINVAL); + assert_return(sd_bus_error_is_set(e), -EINVAL); +- assert_return(call->bus && BUS_IS_OPEN(call->bus->state), -ENOTCONN); ++ assert_return(call->bus, -EINVAL); + assert_return(!bus_pid_changed(call->bus), -ECHILD); + ++ if (!BUS_IS_OPEN(call->bus->state)) ++ return -ENOTCONN; ++ + if (call->header->flags & BUS_MESSAGE_NO_REPLY_EXPECTED) + return 0; + +@@ -159,9 +169,12 @@ _public_ int sd_bus_reply_method_errorf( + assert_return(call, -EINVAL); + assert_return(call->sealed, -EPERM); + assert_return(call->header->type == SD_BUS_MESSAGE_METHOD_CALL, -EINVAL); +- assert_return(call->bus && BUS_IS_OPEN(call->bus->state), -ENOTCONN); ++ assert_return(call->bus, -EINVAL); + assert_return(!bus_pid_changed(call->bus), -ECHILD); + ++ if (!BUS_IS_OPEN(call->bus->state)) ++ return -ENOTCONN; ++ + if (call->header->flags & BUS_MESSAGE_NO_REPLY_EXPECTED) + return 0; + +@@ -182,9 +195,12 @@ _public_ int sd_bus_reply_method_errno( + assert_return(call, -EINVAL); + assert_return(call->sealed, -EPERM); + assert_return(call->header->type == SD_BUS_MESSAGE_METHOD_CALL, -EINVAL); +- assert_return(call->bus && BUS_IS_OPEN(call->bus->state), -ENOTCONN); ++ assert_return(call->bus, -EINVAL); + assert_return(!bus_pid_changed(call->bus), -ECHILD); + ++ if (!BUS_IS_OPEN(call->bus->state)) ++ return -ENOTCONN; ++ + if (call->header->flags & BUS_MESSAGE_NO_REPLY_EXPECTED) + return 0; + +@@ -208,9 +224,12 @@ _public_ int sd_bus_reply_method_errnof( + assert_return(call, -EINVAL); + assert_return(call->sealed, -EPERM); + assert_return(call->header->type == SD_BUS_MESSAGE_METHOD_CALL, -EINVAL); +- assert_return(call->bus && BUS_IS_OPEN(call->bus->state), -ENOTCONN); ++ assert_return(call->bus, -EINVAL); + assert_return(!bus_pid_changed(call->bus), -ECHILD); + ++ if (!BUS_IS_OPEN(call->bus->state)) ++ return -ENOTCONN; ++ + if (call->header->flags & BUS_MESSAGE_NO_REPLY_EXPECTED) + return 0; + +@@ -239,9 +258,11 @@ _public_ int sd_bus_get_property( + assert_return(member_name_is_valid(member), -EINVAL); + assert_return(reply, -EINVAL); + assert_return(signature_is_single(type, false), -EINVAL); +- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN); + assert_return(!bus_pid_changed(bus), -ECHILD); + ++ if (!BUS_IS_OPEN(bus->state)) ++ return -ENOTCONN; ++ + r = sd_bus_call_method(bus, destination, path, "org.freedesktop.DBus.Properties", "Get", error, &rep, "ss", strempty(interface), member); + if (r < 0) + return r; +@@ -273,9 +294,11 @@ _public_ int sd_bus_get_property_trivial( + assert_return(member_name_is_valid(member), -EINVAL); + assert_return(bus_type_is_trivial(type), -EINVAL); + assert_return(ptr, -EINVAL); +- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN); + assert_return(!bus_pid_changed(bus), -ECHILD); + ++ if (!BUS_IS_OPEN(bus->state)) ++ return -ENOTCONN; ++ + r = sd_bus_call_method(bus, destination, path, "org.freedesktop.DBus.Properties", "Get", error, &reply, "ss", strempty(interface), member); + if (r < 0) + return r; +@@ -309,9 +332,11 @@ _public_ int sd_bus_get_property_string( + assert_return(isempty(interface) || interface_name_is_valid(interface), -EINVAL); + assert_return(member_name_is_valid(member), -EINVAL); + assert_return(ret, -EINVAL); +- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN); + assert_return(!bus_pid_changed(bus), -ECHILD); + ++ if (!BUS_IS_OPEN(bus->state)) ++ return -ENOTCONN; ++ + r = sd_bus_call_method(bus, destination, path, "org.freedesktop.DBus.Properties", "Get", error, &reply, "ss", strempty(interface), member); + if (r < 0) + return r; +@@ -348,9 +373,11 @@ _public_ int sd_bus_get_property_strv( + assert_return(isempty(interface) || interface_name_is_valid(interface), -EINVAL); + assert_return(member_name_is_valid(member), -EINVAL); + assert_return(ret, -EINVAL); +- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN); + assert_return(!bus_pid_changed(bus), -ECHILD); + ++ if (!BUS_IS_OPEN(bus->state)) ++ return -ENOTCONN; ++ + r = sd_bus_call_method(bus, destination, path, "org.freedesktop.DBus.Properties", "Get", error, &reply, "ss", strempty(interface), member); + if (r < 0) + return r; +@@ -383,9 +410,11 @@ _public_ int sd_bus_set_property( + assert_return(isempty(interface) || interface_name_is_valid(interface), -EINVAL); + assert_return(member_name_is_valid(member), -EINVAL); + assert_return(signature_is_single(type, false), -EINVAL); +- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN); + assert_return(!bus_pid_changed(bus), -ECHILD); + ++ if (!BUS_IS_OPEN(bus->state)) ++ return -ENOTCONN; ++ + r = sd_bus_message_new_method_call(bus, &m, destination, path, "org.freedesktop.DBus.Properties", "Set"); + if (r < 0) + return r; +@@ -416,9 +445,12 @@ _public_ int sd_bus_query_sender_creds(sd_bus_message *call, uint64_t mask, sd_b + + assert_return(call, -EINVAL); + assert_return(call->sealed, -EPERM); +- assert_return(call->bus && BUS_IS_OPEN(call->bus->state), -ENOTCONN); ++ assert_return(call->bus, -EINVAL); + assert_return(!bus_pid_changed(call->bus), -ECHILD); + ++ if (!BUS_IS_OPEN(call->bus->state)) ++ return -ENOTCONN; ++ + c = sd_bus_message_get_creds(call); + + /* All data we need? */ +diff --git a/src/libsystemd/sd-bus/bus-objects.c b/src/libsystemd/sd-bus/bus-objects.c +index 08792fe..539cf2a 100644 +--- a/src/libsystemd/sd-bus/bus-objects.c ++++ b/src/libsystemd/sd-bus/bus-objects.c +@@ -2196,9 +2196,10 @@ _public_ int sd_bus_emit_properties_changed_strv( + assert_return(bus, -EINVAL); + assert_return(object_path_is_valid(path), -EINVAL); + assert_return(interface_name_is_valid(interface), -EINVAL); +- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN); + assert_return(!bus_pid_changed(bus), -ECHILD); + ++ if (!BUS_IS_OPEN(bus->state)) ++ return -ENOTCONN; + + /* A non-NULL but empty names list means nothing needs to be + generated. A NULL list OTOH indicates that all properties +@@ -2241,9 +2242,11 @@ _public_ int sd_bus_emit_properties_changed( + assert_return(bus, -EINVAL); + assert_return(object_path_is_valid(path), -EINVAL); + assert_return(interface_name_is_valid(interface), -EINVAL); +- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN); + assert_return(!bus_pid_changed(bus), -ECHILD); + ++ if (!BUS_IS_OPEN(bus->state)) ++ return -ENOTCONN; ++ + if (!name) + return 0; + +@@ -2361,9 +2364,11 @@ _public_ int sd_bus_emit_interfaces_added_strv(sd_bus *bus, const char *path, ch + + assert_return(bus, -EINVAL); + assert_return(object_path_is_valid(path), -EINVAL); +- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN); + assert_return(!bus_pid_changed(bus), -ECHILD); + ++ if (!BUS_IS_OPEN(bus->state)) ++ return -ENOTCONN; ++ + if (strv_isempty(interfaces)) + return 0; + +@@ -2421,9 +2426,11 @@ _public_ int sd_bus_emit_interfaces_added(sd_bus *bus, const char *path, const c + + assert_return(bus, -EINVAL); + assert_return(object_path_is_valid(path), -EINVAL); +- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN); + assert_return(!bus_pid_changed(bus), -ECHILD); + ++ if (!BUS_IS_OPEN(bus->state)) ++ return -ENOTCONN; ++ + interfaces = strv_from_stdarg_alloca(interface); + + return sd_bus_emit_interfaces_added_strv(bus, path, interfaces); +@@ -2435,9 +2442,11 @@ _public_ int sd_bus_emit_interfaces_removed_strv(sd_bus *bus, const char *path, + + assert_return(bus, -EINVAL); + assert_return(object_path_is_valid(path), -EINVAL); +- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN); + assert_return(!bus_pid_changed(bus), -ECHILD); + ++ if (!BUS_IS_OPEN(bus->state)) ++ return -ENOTCONN; ++ + if (strv_isempty(interfaces)) + return 0; + +@@ -2461,9 +2470,11 @@ _public_ int sd_bus_emit_interfaces_removed(sd_bus *bus, const char *path, const + + assert_return(bus, -EINVAL); + assert_return(object_path_is_valid(path), -EINVAL); +- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN); + assert_return(!bus_pid_changed(bus), -ECHILD); + ++ if (!BUS_IS_OPEN(bus->state)) ++ return -ENOTCONN; ++ + interfaces = strv_from_stdarg_alloca(interface); + + return sd_bus_emit_interfaces_removed_strv(bus, path, interfaces); +diff --git a/src/libsystemd/sd-bus/sd-bus.c b/src/libsystemd/sd-bus/sd-bus.c +index fa6d43a..15c7677 100644 +--- a/src/libsystemd/sd-bus/sd-bus.c ++++ b/src/libsystemd/sd-bus/sd-bus.c +@@ -1594,10 +1594,12 @@ static int bus_send_internal(sd_bus *bus, sd_bus_message *_m, uint64_t *cookie, + int r; + + assert_return(bus, -EINVAL); +- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN); + assert_return(m, -EINVAL); + assert_return(!bus_pid_changed(bus), -ECHILD); + ++ if (!BUS_IS_OPEN(bus->state)) ++ return -ENOTCONN; ++ + if (m->n_fds > 0) { + r = sd_bus_can_send(bus, SD_BUS_TYPE_UNIX_FD); + if (r < 0) +@@ -1673,10 +1675,12 @@ _public_ int sd_bus_send_to(sd_bus *bus, sd_bus_message *m, const char *destinat + int r; + + assert_return(bus, -EINVAL); +- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN); + assert_return(m, -EINVAL); + assert_return(!bus_pid_changed(bus), -ECHILD); + ++ if (!BUS_IS_OPEN(bus->state)) ++ return -ENOTCONN; ++ + if (!streq_ptr(m->destination, destination)) { + + if (!destination) +@@ -1728,13 +1732,15 @@ _public_ int sd_bus_call_async( + int r; + + assert_return(bus, -EINVAL); +- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN); + assert_return(m, -EINVAL); + assert_return(m->header->type == SD_BUS_MESSAGE_METHOD_CALL, -EINVAL); + assert_return(!(m->header->flags & BUS_MESSAGE_NO_REPLY_EXPECTED), -EINVAL); + assert_return(callback, -EINVAL); + assert_return(!bus_pid_changed(bus), -ECHILD); + ++ if (!BUS_IS_OPEN(bus->state)) ++ return -ENOTCONN; ++ + r = hashmap_ensure_allocated(&bus->reply_callbacks, uint64_hash_func, uint64_compare_func); + if (r < 0) + return r; +@@ -1841,13 +1847,15 @@ _public_ int sd_bus_call( + int r; + + assert_return(bus, -EINVAL); +- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN); + assert_return(m, -EINVAL); + assert_return(m->header->type == SD_BUS_MESSAGE_METHOD_CALL, -EINVAL); + assert_return(!(m->header->flags & BUS_MESSAGE_NO_REPLY_EXPECTED), -EINVAL); + assert_return(!bus_error_is_dirty(error), -EINVAL); + assert_return(!bus_pid_changed(bus), -ECHILD); + ++ if (!BUS_IS_OPEN(bus->state)) ++ return -ENOTCONN; ++ + r = bus_ensure_running(bus); + if (r < 0) + return r; +@@ -1973,9 +1981,11 @@ _public_ int sd_bus_get_events(sd_bus *bus) { + int flags = 0; + + assert_return(bus, -EINVAL); +- assert_return(BUS_IS_OPEN(bus->state) || bus->state == BUS_CLOSING, -ENOTCONN); + assert_return(!bus_pid_changed(bus), -ECHILD); + ++ if (!BUS_IS_OPEN(bus->state) && bus->state != BUS_CLOSING) ++ return -ENOTCONN; ++ + if (bus->state == BUS_OPENING) + flags |= POLLOUT; + else if (bus->state == BUS_AUTHENTICATING) { +@@ -2000,9 +2010,11 @@ _public_ int sd_bus_get_timeout(sd_bus *bus, uint64_t *timeout_usec) { + + assert_return(bus, -EINVAL); + assert_return(timeout_usec, -EINVAL); +- assert_return(BUS_IS_OPEN(bus->state) || bus->state == BUS_CLOSING, -ENOTCONN); + assert_return(!bus_pid_changed(bus), -ECHILD); + ++ if (!BUS_IS_OPEN(bus->state) && bus->state != BUS_CLOSING) ++ return -ENOTCONN; ++ + if (bus->track_queue) { + *timeout_usec = 0; + return 1; +@@ -2531,7 +2543,8 @@ static int bus_poll(sd_bus *bus, bool need_more, uint64_t timeout_usec) { + if (bus->state == BUS_CLOSING) + return 1; + +- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN); ++ if (!BUS_IS_OPEN(bus->state)) ++ return -ENOTCONN; + + e = sd_bus_get_events(bus); + if (e < 0) +@@ -2586,7 +2599,8 @@ _public_ int sd_bus_wait(sd_bus *bus, uint64_t timeout_usec) { + if (bus->state == BUS_CLOSING) + return 0; + +- assert_return(BUS_IS_OPEN(bus->state) , -ENOTCONN); ++ if (!BUS_IS_OPEN(bus->state)) ++ return -ENOTCONN; + + if (bus->rqueue_size > 0) + return 0; +@@ -2603,7 +2617,8 @@ _public_ int sd_bus_flush(sd_bus *bus) { + if (bus->state == BUS_CLOSING) + return 0; + +- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN); ++ if (!BUS_IS_OPEN(bus->state)) ++ return -ENOTCONN; + + r = bus_ensure_running(bus); + if (r < 0) +@@ -3113,9 +3128,13 @@ _public_ int sd_bus_get_peer_creds(sd_bus *bus, uint64_t mask, sd_bus_creds **re + assert_return(bus, -EINVAL); + assert_return(mask <= _SD_BUS_CREDS_ALL, -ENOTSUP); + assert_return(ret, -EINVAL); +- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN); + assert_return(!bus_pid_changed(bus), -ECHILD); +- assert_return(!bus->is_kernel, -ENOTSUP); ++ ++ if (!bus->is_kernel) ++ return -ENOTSUP; ++ ++ if (!BUS_IS_OPEN(bus->state)) ++ return -ENOTCONN; + + if (!bus->ucred_valid && !isempty(bus->label)) + return -ENODATA; +@@ -3154,9 +3173,13 @@ _public_ int sd_bus_try_close(sd_bus *bus) { + int r; + + assert_return(bus, -EINVAL); +- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN); + assert_return(!bus_pid_changed(bus), -ECHILD); +- assert_return(bus->is_kernel, -ENOTSUP); ++ ++ if (!bus->is_kernel) ++ return -ENOTSUP; ++ ++ if (!BUS_IS_OPEN(bus->state)) ++ return -ENOTCONN; + + if (bus->rqueue_size > 0) + return -EBUSY; +-- +1.9.1 + diff --git a/meta/recipes-core/systemd/systemd/systemd-pam-configure-check-uclibc.patch b/meta/recipes-core/systemd/systemd/systemd-pam-configure-check-uclibc.patch new file mode 100644 index 0000000000..4639532236 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/systemd-pam-configure-check-uclibc.patch @@ -0,0 +1,32 @@ +Upstream-Status: Denied [no desire for uclibc support] +Signed-off-by: Khem Raj + +Index: git/configure.ac +=================================================================== +--- git.orig/configure.ac 2014-03-15 17:53:51.756340454 -0700 ++++ git/configure.ac 2014-03-15 18:07:34.888355897 -0700 +@@ -78,6 +78,24 @@ + + M4_DEFINES= + ++# check for few functions not implemented in uClibc ++ ++AC_CHECK_FUNCS_ONCE(mkostemp execvpe posix_fallocate) ++ ++# check for %ms format support - assume always no if cross compiling ++ ++AC_MSG_CHECKING([whether %ms format is supported by *scanf]) ++ ++AC_LINK_IFELSE( ++ [AC_LANG_PROGRAM([ ++ #include ++ ],[ ++ char *buf1, *buf2, *buf3, str="1 2.3 abcde" ; ++ int rc = sscanf(str, "%ms %ms %ms", &buf1, &buf2, &buf3) ; ++ return (rc==3)?0:1;])], ++ [AC_DEFINE([HAVE_MSFORMAT], [1], [Define if %ms format is supported by *scanf.])], ++ [AC_MSG_RESULT([no])]) ++ + # gtkdocize greps for '^GTK_DOC_CHECK', so it needs to be on its own line + m4_ifdef([GTK_DOC_CHECK], [ + GTK_DOC_CHECK([1.18],[--flavour no-tmpl])], diff --git a/meta/recipes-core/systemd/systemd/systemd-pam-fix-execvpe.patch b/meta/recipes-core/systemd/systemd/systemd-pam-fix-execvpe.patch new file mode 100644 index 0000000000..7170a38af3 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/systemd-pam-fix-execvpe.patch @@ -0,0 +1,29 @@ +Upstream-Status: Denied [no desire for uclibc support] +Signed-off-by: Khem Raj + +Index: systemd-209/src/nspawn/nspawn.c +=================================================================== +--- systemd-209.orig/src/nspawn/nspawn.c 2014-02-19 15:03:09.000000000 -0800 ++++ systemd-209/src/nspawn/nspawn.c 2014-02-19 23:20:38.720628627 -0800 +@@ -91,6 +91,8 @@ + LINK_GUEST + } LinkJournal; + ++#include "config.h" ++ + static char *arg_directory = NULL; + static char *arg_user = NULL; + static sd_id128_t arg_uuid = {}; +@@ -2045,7 +2047,12 @@ + a[0] = (char*) "/sbin/init"; + execve(a[0], a, env_use); + } else if (argc > optind) ++#ifdef HAVE_EXECVPE + execvpe(argv[optind], argv + optind, env_use); ++#else ++ environ = env_use; ++ execvp(argv[optind], argv + optind); ++#endif /* HAVE_EXECVPE */ + else { + chdir(home ? home : "/root"); + execle("/bin/bash", "-bash", NULL, env_use); diff --git a/meta/recipes-core/systemd/systemd/systemd-pam-fix-fallocate.patch b/meta/recipes-core/systemd/systemd/systemd-pam-fix-fallocate.patch new file mode 100644 index 0000000000..de73be96a7 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/systemd-pam-fix-fallocate.patch @@ -0,0 +1,84 @@ +Upstream-Status: Denied [no desire for uclibc support] +Signed-off-by: Khem Raj + +Index: systemd-209/src/journal/journal-file.c +=================================================================== +--- systemd-209.orig/src/journal/journal-file.c 2014-02-12 18:42:33.000000000 -0800 ++++ systemd-209/src/journal/journal-file.c 2014-02-19 23:23:19.464631643 -0800 +@@ -38,6 +38,8 @@ + #include "compress.h" + #include "fsprg.h" + ++#include "config.h" ++ + #define DEFAULT_DATA_HASH_TABLE_SIZE (2047ULL*sizeof(HashItem)) + #define DEFAULT_FIELD_HASH_TABLE_SIZE (333ULL*sizeof(HashItem)) + +@@ -316,7 +318,7 @@ + + static int journal_file_allocate(JournalFile *f, uint64_t offset, uint64_t size) { + uint64_t old_size, new_size; +- int r; ++ int r = 0; + + assert(f); + +@@ -364,9 +366,24 @@ + /* Note that the glibc fallocate() fallback is very + inefficient, hence we try to minimize the allocation area + as we can. */ ++#ifdef HAVE_POSIX_ALLOCATE + r = posix_fallocate(f->fd, old_size, new_size - old_size); + if (r != 0) + return -r; ++#else ++ /* Use good old method to write zeros into the journal file ++ perhaps very inefficient yet working. */ ++ if(new_size > old_size) { ++ char *buf = alloca(new_size - old_size); ++ off_t oldpos = lseek(f->fd, 0, SEEK_CUR); ++ bzero(buf, new_size - old_size); ++ lseek(f->fd, old_size, SEEK_SET); ++ r = write(f->fd, buf, new_size - old_size); ++ lseek(f->fd, oldpos, SEEK_SET); ++ } ++ if (r < 0) ++ return -errno; ++#endif /* HAVE_POSIX_FALLOCATE */ + + if (fstat(f->fd, &f->last_stat) < 0) + return -errno; +Index: systemd-209/src/journal/journald-kmsg.c +=================================================================== +--- systemd-209.orig/src/journal/journald-kmsg.c 2014-02-19 15:03:09.000000000 -0800 ++++ systemd-209/src/journal/journald-kmsg.c 2014-02-19 23:22:14.396630422 -0800 +@@ -441,6 +441,7 @@ + + int server_open_kernel_seqnum(Server *s) { + int fd; ++ int r = 0; + uint64_t *p; + + assert(s); +@@ -454,8 +455,19 @@ + log_error("Failed to open /run/systemd/journal/kernel-seqnum, ignoring: %m"); + return 0; + } +- +- if (posix_fallocate(fd, 0, sizeof(uint64_t)) < 0) { ++#ifdef HAVE_POSIX_ALLOCATE ++ r = posix_fallocate(fd, 0, sizeof(uint64_t)); ++#else ++ /* Use good old method to write zeros into the journal file ++ perhaps very inefficient yet working. */ ++ char *buf = alloca(sizeof(uint64_t)); ++ off_t oldpos = lseek(fd, 0, SEEK_CUR); ++ bzero(buf, sizeof(uint64_t)); ++ lseek(fd, 0, SEEK_SET); ++ r = write(fd, buf, sizeof(uint64_t)); ++ lseek(fd, oldpos, SEEK_SET); ++#endif /* HAVE_POSIX_FALLOCATE */ ++ if (r < 0) { + log_error("Failed to allocate sequential number file, ignoring: %m"); + close_nointr_nofail(fd); + return 0; diff --git a/meta/recipes-core/systemd/systemd/systemd-pam-fix-getty-unit.patch b/meta/recipes-core/systemd/systemd/systemd-pam-fix-getty-unit.patch new file mode 100644 index 0000000000..9b4c940984 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/systemd-pam-fix-getty-unit.patch @@ -0,0 +1,35 @@ +Prefer getty to agetty in console setup systemd units + +Upstream-Status: Inappropriate [configuration specific] +Signed-off-by: Maxime Ripard +--- + units/getty@.service.m4 | 2 +- + units/serial-getty@.service.m4 | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +Index: git/units/getty@.service.m4 +=================================================================== +--- git.orig/units/getty@.service.m4 2014-03-15 08:16:17.000000000 -0700 ++++ git/units/getty@.service.m4 2014-03-15 08:21:11.007695825 -0700 +@@ -27,7 +27,7 @@ + + [Service] + # the VT is cleared by TTYVTDisallocate +-ExecStart=-/sbin/agetty --noclear %I $TERM ++ExecStart=-/sbin/getty -L %I $TERM + Type=idle + Restart=always + RestartSec=0 +Index: git/units/serial-getty@.service.m4 +=================================================================== +--- git.orig/units/serial-getty@.service.m4 2014-03-15 08:16:17.000000000 -0700 ++++ git/units/serial-getty@.service.m4 2014-03-15 08:22:31.291697331 -0700 +@@ -22,7 +22,7 @@ + IgnoreOnIsolate=yes + + [Service] +-ExecStart=-/sbin/agetty --keep-baud 115200,38400,9600 %I $TERM ++ExecStart=-/sbin/getty -L 115200 %I $TERM + Type=idle + Restart=always + RestartSec=0 diff --git a/meta/recipes-core/systemd/systemd/systemd-pam-fix-mkostemp.patch b/meta/recipes-core/systemd/systemd/systemd-pam-fix-mkostemp.patch new file mode 100644 index 0000000000..8c7aa072da --- /dev/null +++ b/meta/recipes-core/systemd/systemd/systemd-pam-fix-mkostemp.patch @@ -0,0 +1,30 @@ +Upstream-Status: Denied [no desire for uclibc support] +Signed-off-by: Khem Raj + +Index: git/src/shared/util.c +=================================================================== +--- git.orig/src/shared/util.c 2014-03-15 15:14:21.368160908 -0700 ++++ git/src/shared/util.c 2014-03-15 15:44:21.988194688 -0700 +@@ -85,6 +85,8 @@ + #include "def.h" + #include "missing.h" + ++#include "config.h" ++ + int saved_argc = 0; + char **saved_argv = NULL; + +@@ -6222,7 +6224,13 @@ + + u = umask(077); + ++#ifdef HAVE_MKOSTEMP + fd = mkostemp(pattern, flags); ++#else ++ fd = mkstemp(pattern); ++ if (fd >= 0) fcntl(fd, F_SETFD, flags); ++#endif /* HAVE_MKOSTEMP */ ++ + if (fd < 0) + return -errno; + diff --git a/meta/recipes-core/systemd/systemd/touchscreen.rules b/meta/recipes-core/systemd/systemd/touchscreen.rules new file mode 100644 index 0000000000..d83fd1673d --- /dev/null +++ b/meta/recipes-core/systemd/systemd/touchscreen.rules @@ -0,0 +1,18 @@ +# There are a number of modifiers that are allowed to be used in some +# of the different fields. They provide the following subsitutions: +# +# %n the "kernel number" of the device. +# For example, 'sda3' has a "kernel number" of '3' +# %e the smallest number for that name which does not matches an existing node +# %k the kernel name for the device +# %M the kernel major number for the device +# %m the kernel minor number for the device +# %b the bus id for the device +# %c the string returned by the PROGRAM +# %s{filename} the content of a sysfs attribute +# %% the '%' char itself +# + +# Create a symlink to any touchscreen input device +SUBSYSTEM=="input", KERNEL=="event[0-9]*", ATTRS{modalias}=="input:*-e0*,3,*a0,1,*18,*", SYMLINK+="input/touchscreen0" +SUBSYSTEM=="input", KERNEL=="event[0-9]*", ATTRS{modalias}=="ads7846", SYMLINK+="input/touchscreen0" diff --git a/meta/recipes-core/systemd/systemd/uclibc-get-physmem.patch b/meta/recipes-core/systemd/systemd/uclibc-get-physmem.patch new file mode 100644 index 0000000000..39dfc9e2ea --- /dev/null +++ b/meta/recipes-core/systemd/systemd/uclibc-get-physmem.patch @@ -0,0 +1,37 @@ +bypass unimplemented _SC_PHYS_PAGES system configuration API in uclibc + +Upstream-Status: Inappropriate [uclibc-specific] + +Signed-off-by: Khem Raj + +Index: git/src/shared/util.c +=================================================================== +--- git.orig/src/shared/util.c 2014-03-15 18:09:34.796358146 -0700 ++++ git/src/shared/util.c 2014-03-15 20:16:33.836501084 -0700 +@@ -6332,11 +6332,24 @@ + + /* We return this as uint64_t in case we are running as 32bit + * process on a 64bit kernel with huge amounts of memory */ +- ++#ifdef __UCLIBC__ ++ char line[128]; ++ FILE *f = fopen("/proc/meminfo", "r"); ++ if (f == NULL) ++ return 0; ++ while (!feof(f) && fgets(line, sizeof(line)-1, f)) { ++ if (sscanf(line, "MemTotal: %l kB", &mem) == 1) { ++ mem *= 1024; ++ break; ++ } ++ } ++ fclose(f); ++ return (uint64_t) mem; ++#else + mem = sysconf(_SC_PHYS_PAGES); + assert(mem > 0); +- + return (uint64_t) mem * (uint64_t) page_size(); ++#endif + } + + char* mount_test_option(const char *haystack, const char *needle) { diff --git a/meta/recipes-core/systemd/systemd/uclibc-sysinfo_h.patch b/meta/recipes-core/systemd/systemd/uclibc-sysinfo_h.patch new file mode 100644 index 0000000000..15645dee11 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/uclibc-sysinfo_h.patch @@ -0,0 +1,19 @@ +Dont include sys/sysinfo.h on uclibc it conflicts with linux/sysinfo.h + +Signed-off-by: Khem Raj +Upstream-Status: Inappropriate [uclibc specific] + +Index: systemd-209/src/readahead/readahead-common.c +=================================================================== +--- systemd-209.orig/src/readahead/readahead-common.c 2014-02-12 18:42:33.810685053 -0800 ++++ systemd-209/src/readahead/readahead-common.c 2014-02-19 23:49:31.856661142 -0800 +@@ -22,7 +22,9 @@ + #include + #include + #include ++#ifndef __UCLIBC__ + #include ++#endif + #include + #include + #include diff --git a/meta/recipes-core/systemd/systemd_211.bb b/meta/recipes-core/systemd/systemd_211.bb new file mode 100644 index 0000000000..44b196538a --- /dev/null +++ b/meta/recipes-core/systemd/systemd_211.bb @@ -0,0 +1,353 @@ +SUMMARY = "System and service manager for Linux, replacing SysVinit" +HOMEPAGE = "http://www.freedesktop.org/wiki/Software/systemd" + +LICENSE = "GPLv2 & LGPLv2.1 & MIT" +LIC_FILES_CHKSUM = "file://LICENSE.GPL2;md5=751419260aa954499f7abaabaa882bbe \ + file://LICENSE.LGPL2.1;md5=4fbd65380cdd255951079008b364516c \ + file://LICENSE.MIT;md5=544799d0b492f119fa04641d1b8868ed" + +PROVIDES = "udev" + +PE = "1" + +DEPENDS = "kmod docbook-sgml-dtd-4.1-native intltool-native gperf-native acl readline dbus libcap libcgroup glib-2.0 qemu-native util-linux" +DEPENDS += "${@base_contains('DISTRO_FEATURES', 'pam', 'libpam', '', d)}" + +SECTION = "base/shell" + +inherit gtk-doc useradd pkgconfig autotools perlnative update-rc.d update-alternatives qemu systemd ptest + +SRCREV = "3a450ec5c6adf3057bcedd6cc19c10617abc35a5" + +PV = "211+git${SRCPV}" + +SRC_URI = "git://anongit.freedesktop.org/systemd/systemd;branch=master;protocol=git \ + file://binfmt-install.patch \ + file://systemd-pam-configure-check-uclibc.patch \ + file://systemd-pam-fix-execvpe.patch \ + file://systemd-pam-fix-fallocate.patch \ + file://systemd-pam-fix-mkostemp.patch \ + file://optional_secure_getenv.patch \ + file://0001-uClibc-doesn-t-implement-pwritev-preadv.patch \ + file://uclibc-sysinfo_h.patch \ + file://uclibc-get-physmem.patch \ + file://sd-bus-don-t-use-assert_return-to-check-for-disconne.patch \ + \ + file://touchscreen.rules \ + file://00-create-volatile.conf \ + file://init \ + file://run-ptest \ + " + +S = "${WORKDIR}/git" + +SRC_URI_append_libc-uclibc = "\ + file://systemd-pam-fix-getty-unit.patch \ + " +LDFLAGS_append_libc-uclibc = " -lrt" + +GTKDOC_DOCDIR = "${S}/docs/" + +PACKAGECONFIG ??= "xz tcp-wrappers" +# Sign the journal for anti-tampering +PACKAGECONFIG[gcrypt] = "--enable-gcrypt,--disable-gcrypt,libgcrypt" +# regardless of PACKAGECONFIG, libgcrypt is always required to expand +# the AM_PATH_LIBGCRYPT autoconf macro +DEPENDS += "libgcrypt" +# Compress the journal +PACKAGECONFIG[xz] = "--enable-xz,--disable-xz,xz" +PACKAGECONFIG[tcp-wrappers] = "--enable-tcpwrap,--disable-tcpwrap,tcp-wrappers" +PACKAGECONFIG[cryptsetup] = "--enable-libcryptsetup,--disable-libcryptsetup,cryptsetup" +PACKAGECONFIG[microhttpd] = "--enable-microhttpd,--disable-microhttpd,libmicrohttpd" + +CACHED_CONFIGUREVARS = "ac_cv_path_KILL=${base_bindir}/kill" + +# Helper variables to clarify locations. This mirrors the logic in systemd's +# build system. +rootprefix ?= "${base_prefix}" +rootlibdir ?= "${base_libdir}" +rootlibexecdir = "${rootprefix}/lib" + +# The gtk+ tools should get built as a separate recipe e.g. systemd-tools +EXTRA_OECONF = " --with-rootprefix=${rootprefix} \ + --with-rootlibdir=${rootlibdir} \ + ${@base_contains('DISTRO_FEATURES', 'pam', '--enable-pam', '--disable-pam', d)} \ + --enable-xz \ + --disable-manpages \ + --disable-coredump \ + --disable-introspection \ + --disable-kdbus \ + --enable-split-usr \ + --without-python \ + --with-sysvrcnd-path=${sysconfdir} \ + --with-firmware-path=/lib/firmware \ + ac_cv_path_KILL=${base_bindir}/kill \ + " +# uclibc does not have NSS +EXTRA_OECONF_append_libc-uclibc = " --disable-myhostname " + +do_configure_prepend() { + export CPP="${HOST_PREFIX}cpp ${TOOLCHAIN_OPTIONS} ${HOST_CC_ARCH}" + export KMOD="${base_bindir}/kmod" + if [ -d ${S}/units.pre_sed ] ; then + cp -r ${S}/units.pre_sed ${S}/units + else + cp -r ${S}/units ${S}/units.pre_sed + fi + sed -i -e 's:=/root:=${ROOT_HOME}:g' ${S}/units/*.service* + sed -i -e 's:\$(LN_S) --relative -f:lnr:g' ${S}/Makefile.am + sed -i -e 's:\$(LN_S) --relative:lnr:g' ${S}/Makefile.am +} + +do_install() { + autotools_do_install + install -d ${D}/${base_sbindir} + # Provided by a separate recipe + rm ${D}${systemd_unitdir}/system/serial-getty* -f + + # Provide support for initramfs + [ ! -e ${D}/init ] && ln -s ${rootlibexecdir}/systemd/systemd ${D}/init + [ ! -e ${D}/${base_sbindir}/udevd ] && ln -s ${rootlibexecdir}/systemd/systemd-udevd ${D}/${base_sbindir}/udevd + + # Create machine-id + # 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 + touch ${D}${sysconfdir}/machine-id + + install -m 0644 ${WORKDIR}/*.rules ${D}${sysconfdir}/udev/rules.d/ + + install -m 0644 ${WORKDIR}/00-create-volatile.conf ${D}${sysconfdir}/tmpfiles.d/ + + if ${@base_contains('DISTRO_FEATURES','sysvinit','true','false',d)}; then + install -d ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/systemd-udevd + sed -i s%@UDEVD@%${rootlibexecdir}/systemd/systemd-udevd% ${D}${sysconfdir}/init.d/systemd-udevd + fi + + # Delete journal README, as log can be symlinked inside volatile. + rm -f ${D}/${localstatedir}/log/README +} + +do_install_ptest () { + install -d ${D}${PTEST_PATH}/test + cp -rf ${S}/test/* ${D}${PTEST_PATH}/test + install -m 0755 ${B}/test-udev ${D}${PTEST_PATH}/ + install -d ${D}${PTEST_PATH}/build-aux + cp ${S}/build-aux/test-driver ${D}${PTEST_PATH}/build-aux/ + cp -rf ${B}/rules ${D}${PTEST_PATH}/ + # This directory needs to be there for udev-test.pl to work. + install -d ${D}${libdir}/udev/rules.d + cp ${B}/Makefile ${D}${PTEST_PATH}/ + cp ${S}/test/sys.tar.xz ${D}${PTEST_PATH}/test + sed -i 's/"tree"/"ls"/' ${D}${PTEST_PATH}/test/udev-test.pl + sed -i 's#${S}#${PTEST_PATH}#g' ${D}${PTEST_PATH}/Makefile + sed -i 's#${B}#${PTEST_PATH}#g' ${D}${PTEST_PATH}/Makefile +} + +python populate_packages_prepend (){ + systemdlibdir = d.getVar("rootlibdir", True) + do_split_packages(d, systemdlibdir, '^lib(.*)\.so\.*', 'lib%s', 'Systemd %s library', extra_depends='', allow_links=True) +} +PACKAGES_DYNAMIC += "^lib(udev|gudev|systemd).*" + +PACKAGES =+ "${PN}-gui ${PN}-vconsole-setup ${PN}-initramfs ${PN}-analyze ${PN}-kernel-install \ + ${PN}-rpm-macros ${PN}-binfmt ${PN}-pam ${PN}-zsh" + +SYSTEMD_PACKAGES = "${PN}-binfmt" +SYSTEMD_SERVICE_${PN}-binfmt = "systemd-binfmt.service" + +USERADD_PACKAGES = "${PN}" +USERADD_PARAM_${PN} += "--system systemd-journal-gateway" +GROUPADD_PARAM_${PN} = "-r lock; -r systemd-journal" + +FILES_${PN}-analyze = "${bindir}/systemd-analyze" + +FILES_${PN}-initramfs = "/init" +RDEPENDS_${PN}-initramfs = "${PN}" + +# The test cases need perl and bash to run correctly. +RDEPENDS_${PN}-ptest += "perl bash" +FILES_${PN}-ptest += "${libdir}/udev/rules.d" + +FILES_${PN}-dbg += "${libdir}/systemd/ptest/.debug" + +FILES_${PN}-gui = "${bindir}/systemadm" + +FILES_${PN}-vconsole-setup = "${rootlibexecdir}/systemd/systemd-vconsole-setup \ + ${systemd_unitdir}/system/systemd-vconsole-setup.service \ + ${systemd_unitdir}/system/sysinit.target.wants/systemd-vconsole-setup.service" + +FILES_${PN}-kernel-install = "${bindir}/kernel-install \ + ${sysconfdir}/kernel/ \ + ${exec_prefix}/lib/kernel \ + " +FILES_${PN}-rpm-macros = "${exec_prefix}/lib/rpm \ + " + +FILES_${PN}-zsh = "${datadir}/zsh/site-functions" + +FILES_${PN}-binfmt = "${sysconfdir}/binfmt.d/ \ + ${exec_prefix}/lib/binfmt.d \ + ${rootlibexecdir}/systemd/systemd-binfmt \ + ${systemd_unitdir}/system/proc-sys-fs-binfmt_misc.* \ + ${systemd_unitdir}/system/systemd-binfmt.service" +RRECOMMENDS_${PN}-binfmt = "kernel-module-binfmt-misc" + +RRECOMMENDS_${PN}-vconsole-setup = "kbd kbd-consolefonts" + +CONFFILES_${PN} = "${sysconfdir}/systemd/journald.conf \ + ${sysconfdir}/systemd/logind.conf \ + ${sysconfdir}/systemd/system.conf \ + ${sysconfdir}/systemd/user.conf" + +FILES_${PN} = " ${base_bindir}/* \ + ${datadir}/bash-completion \ + ${datadir}/dbus-1/services \ + ${datadir}/dbus-1/system-services \ + ${datadir}/polkit-1 \ + ${datadir}/${BPN} \ + ${sysconfdir}/bash_completion.d/ \ + ${sysconfdir}/dbus-1/ \ + ${sysconfdir}/machine-id \ + ${sysconfdir}/modules-load.d/ \ + ${sysconfdir}/sysctl.d/ \ + ${sysconfdir}/systemd/ \ + ${sysconfdir}/tmpfiles.d/ \ + ${sysconfdir}/xdg/ \ + ${sysconfdir}/init.d/README \ + ${rootlibexecdir}/systemd/* \ + ${systemd_unitdir}/* \ + ${base_libdir}/security/*.so \ + ${libdir}/libnss_myhostname.so.2 \ + /cgroup \ + ${bindir}/systemd* \ + ${bindir}/busctl \ + ${bindir}/localectl \ + ${bindir}/hostnamectl \ + ${bindir}/timedatectl \ + ${bindir}/bootctl \ + ${bindir}/kernel-install \ + ${exec_prefix}/lib/tmpfiles.d/*.conf \ + ${exec_prefix}/lib/systemd \ + ${exec_prefix}/lib/modules-load.d \ + ${exec_prefix}/lib/sysctl.d \ + ${localstatedir} \ + /lib/udev/rules.d/70-uaccess.rules \ + /lib/udev/rules.d/71-seat.rules \ + /lib/udev/rules.d/73-seat-late.rules \ + /lib/udev/rules.d/99-systemd.rules \ + ${@base_contains('DISTRO_FEATURES', 'pam', '${sysconfdir}/pam.d', '', d)} \ + " + +FILES_${PN}-dbg += "${rootlibdir}/.debug ${systemd_unitdir}/.debug ${systemd_unitdir}/*/.debug ${base_libdir}/security/.debug/" +FILES_${PN}-dev += "${base_libdir}/security/*.la ${datadir}/dbus-1/interfaces/ ${sysconfdir}/rpm/macros.systemd" + +RDEPENDS_${PN} += "kmod dbus util-linux-mount udev (= ${EXTENDPKGV})" + +RRECOMMENDS_${PN} += "systemd-serialgetty systemd-compat-units \ + util-linux-agetty \ + util-linux-fsck e2fsprogs-e2fsck \ + kernel-module-autofs4 kernel-module-unix kernel-module-ipv6 \ +" + +PACKAGES =+ "udev-dbg udev udev-utils udev-hwdb" + +FILES_udev-dbg += "/lib/udev/.debug" + +RDEPENDS_udev += "udev-utils" +RPROVIDES_udev = "hotplug" +RRECOMMENDS_udev += "udev-hwdb" + +RDEPENDS_udev-hwdb += "udev-utils" + +FILES_udev += "${base_sbindir}/udevd \ + ${rootlibexecdir}/systemd/systemd-udevd \ + ${rootlibexecdir}/udev/accelerometer \ + ${rootlibexecdir}/udev/ata_id \ + ${rootlibexecdir}/udev/cdrom_id \ + ${rootlibexecdir}/udev/collect \ + ${rootlibexecdir}/udev/findkeyboards \ + ${rootlibexecdir}/udev/keyboard-force-release.sh \ + ${rootlibexecdir}/udev/keymap \ + ${rootlibexecdir}/udev/mtd_probe \ + ${rootlibexecdir}/udev/scsi_id \ + ${rootlibexecdir}/udev/v4l_id \ + ${rootlibexecdir}/udev/keymaps \ + ${rootlibexecdir}/udev/rules.d/4*.rules \ + ${rootlibexecdir}/udev/rules.d/5*.rules \ + ${rootlibexecdir}/udev/rules.d/6*.rules \ + ${rootlibexecdir}/udev/rules.d/70-power-switch.rules \ + ${rootlibexecdir}/udev/rules.d/75*.rules \ + ${rootlibexecdir}/udev/rules.d/78*.rules \ + ${rootlibexecdir}/udev/rules.d/8*.rules \ + ${rootlibexecdir}/udev/rules.d/95*.rules \ + ${sysconfdir}/udev \ + ${sysconfdir}/init.d/systemd-udevd \ + ${systemd_unitdir}/system/*udev* \ + ${systemd_unitdir}/system/*.wants/*udev* \ + " + +FILES_udev-utils = "${base_bindir}/udevadm ${datadir}/bash-completion/completions/udevadm" + +FILES_udev-hwdb = "${rootlibexecdir}/udev/hwdb.d" + +INITSCRIPT_PACKAGES = "udev" +INITSCRIPT_NAME_udev = "systemd-udevd" +INITSCRIPT_PARAMS_udev = "start 03 S ." + +python __anonymous() { + if not oe.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d): + d.setVar("INHIBIT_UPDATERCD_BBCLASS", "1") +} + +# TODO: +# u-a for runlevel and telinit + +ALTERNATIVE_${PN} = "init halt reboot shutdown poweroff runlevel" + +ALTERNATIVE_TARGET[init] = "${rootlibexecdir}/systemd/systemd" +ALTERNATIVE_LINK_NAME[init] = "${base_sbindir}/init" +ALTERNATIVE_PRIORITY[init] ?= "300" + +ALTERNATIVE_TARGET[halt] = "${base_bindir}/systemctl" +ALTERNATIVE_LINK_NAME[halt] = "${base_sbindir}/halt" +ALTERNATIVE_PRIORITY[halt] ?= "300" + +ALTERNATIVE_TARGET[reboot] = "${base_bindir}/systemctl" +ALTERNATIVE_LINK_NAME[reboot] = "${base_sbindir}/reboot" +ALTERNATIVE_PRIORITY[reboot] ?= "300" + +ALTERNATIVE_TARGET[shutdown] = "${base_bindir}/systemctl" +ALTERNATIVE_LINK_NAME[shutdown] = "${base_sbindir}/shutdown" +ALTERNATIVE_PRIORITY[shutdown] ?= "300" + +ALTERNATIVE_TARGET[poweroff] = "${base_bindir}/systemctl" +ALTERNATIVE_LINK_NAME[poweroff] = "${base_sbindir}/poweroff" +ALTERNATIVE_PRIORITY[poweroff] ?= "300" + +ALTERNATIVE_TARGET[runlevel] = "${base_bindir}/systemctl" +ALTERNATIVE_LINK_NAME[runlevel] = "${base_sbindir}/runlevel" +ALTERNATIVE_PRIORITY[runlevel] ?= "300" + +pkg_postinst_udev-hwdb () { + if test -n "$D"; then + ${@qemu_run_binary(d, '$D', '${base_bindir}/udevadm')} hwdb --update \ + --root $D + else + udevadm hwdb --update + fi +} + +pkg_prerm_udev-hwdb () { + if test -n "$D"; then + exit 1 + fi + + rm -f ${sysconfdir}/udev/hwdb.bin +} + +# As this recipe builds udev, respect systemd being in DISTRO_FEATURES so +# that we don't build both udev and systemd in world builds. +python () { + if not oe.utils.contains ('DISTRO_FEATURES', 'systemd', True, False, d): + raise bb.parse.SkipPackage("'systemd' not in DISTRO_FEATURES") +} -- cgit v1.2.3-54-g00ecf