From 3311446c4b1e8a261de14e068af19941037a884c Mon Sep 17 00:00:00 2001 From: Robert Schwebel Date: Mon, 9 Aug 2010 10:09:25 +0200 Subject: WIP: systemd: add new packet Signed-off-by: Robert Schwebel --- generic/etc/group | 1 + patches/systemd-20/0001-missing-IN_CLOEXIT.patch | 127 +++++++++ patches/systemd-20/0002-limited-datatype.patch | 19 ++ patches/systemd-20/0003-add-xml-files.patch | 299 +++++++++++++++++++++ .../0004-create-dbussystemservicedir.patch | 21 ++ .../systemd-20/0005-dbus-fix-system-handling.patch | 30 +++ patches/systemd-20/autogen.sh | 1 + patches/systemd-20/series | 5 + rules/systemd.in | 23 ++ rules/systemd.make | 118 ++++++++ 10 files changed, 644 insertions(+) create mode 100644 patches/systemd-20/0001-missing-IN_CLOEXIT.patch create mode 100644 patches/systemd-20/0002-limited-datatype.patch create mode 100644 patches/systemd-20/0003-add-xml-files.patch create mode 100644 patches/systemd-20/0004-create-dbussystemservicedir.patch create mode 100644 patches/systemd-20/0005-dbus-fix-system-handling.patch create mode 120000 patches/systemd-20/autogen.sh create mode 100644 patches/systemd-20/series create mode 100644 rules/systemd.in create mode 100644 rules/systemd.make diff --git a/generic/etc/group b/generic/etc/group index ee390872f..a7f01af35 100644 --- a/generic/etc/group +++ b/generic/etc/group @@ -1,5 +1,6 @@ root:x:0: daemon:x:1: +utmp:x:43: users:x:100: ftp:x:101: www:x:102: diff --git a/patches/systemd-20/0001-missing-IN_CLOEXIT.patch b/patches/systemd-20/0001-missing-IN_CLOEXIT.patch new file mode 100644 index 000000000..e52e96f3c --- /dev/null +++ b/patches/systemd-20/0001-missing-IN_CLOEXIT.patch @@ -0,0 +1,127 @@ +src/util.c: In function 'acquire_terminal': +src/util.c:2241: warning: implicit declaration of function 'inotify_init1' +src/util.c:2241: error: 'IN_CLOEXEC' undeclared (first use in this function) + +src/socket-util.c: In function 'socket_address_listen': +src/socket-util.c:322: error: 'SOCK_NONBLOCK' undeclared (first use in this function) +src/socket-util.c:322: error: (Each undeclared identifier is reported only once +src/socket-util.c:322: error: for each function it appears in.) +src/socket-util.c:322: error: 'SOCK_CLOEXEC' undeclared (first use in this function) +make[2]: *** [src/socket-util.lo] Error 1 + + +--- + src/job.c | 8 ++++++++ + src/log.c | 4 ++++ + src/manager.c | 8 ++++++++ + src/socket-util.c | 8 ++++++++ + src/unit.c | 8 ++++++++ + src/util.c | 4 ++++ + 6 files changed, 40 insertions(+) + +Index: systemd-13/src/util.c +=================================================================== +--- systemd-13.orig/src/util.c ++++ systemd-13/src/util.c +@@ -60,6 +60,10 @@ + #include "label.h" + #include "exit-status.h" + ++#ifndef IN_CLOEXEC ++#define IN_CLOEXEC 0 ++#endif ++ + bool streq_ptr(const char *a, const char *b) { + + /* Like streq(), but tries to make sense of NULL pointers */ +Index: systemd-13/src/socket-util.c +=================================================================== +--- systemd-13.orig/src/socket-util.c ++++ systemd-13/src/socket-util.c +@@ -38,6 +38,14 @@ + #include "missing.h" + #include "label.h" + ++#ifndef SOCK_NONBLOCK ++#define SOCK_NONBLOCK 0 ++#endif ++ ++#ifndef SOCK_CLOEXEC ++#define SOCK_CLOEXEC 0 ++#endif ++ + int socket_address_parse(SocketAddress *a, const char *s) { + int r; + char *e, *n; +Index: systemd-13/src/log.c +=================================================================== +--- systemd-13.orig/src/log.c ++++ systemd-13/src/log.c +@@ -33,6 +33,10 @@ + + #define SYSLOG_TIMEOUT_USEC (5*USEC_PER_SEC) + ++#ifndef SOCK_CLOEXEC ++#define SOCK_CLOEXEC 0 ++#endif ++ + static LogTarget log_target = LOG_TARGET_CONSOLE; + static int log_max_level = LOG_INFO; + +Index: systemd-13/src/unit.c +=================================================================== +--- systemd-13.orig/src/unit.c ++++ systemd-13/src/unit.c +@@ -43,6 +43,14 @@ + #include "cgroup-util.h" + #include "missing.h" + ++#ifndef TFD_NONBLOCK ++#define TFD_NONBLOCK 0 ++#endif ++ ++#ifndef TFD_CLOEXEC ++#define TFD_CLOEXEC 0 ++#endif ++ + const UnitVTable * const unit_vtable[_UNIT_TYPE_MAX] = { + [UNIT_SERVICE] = &service_vtable, + [UNIT_TIMER] = &timer_vtable, +Index: systemd-13/src/job.c +=================================================================== +--- systemd-13.orig/src/job.c ++++ systemd-13/src/job.c +@@ -33,6 +33,14 @@ + #include "log.h" + #include "dbus-job.h" + ++#ifndef TFD_NONBLOCK ++#define TFD_NONBLOCK 0 ++#endif ++ ++#ifndef TFD_CLOEXEC ++#define TFD_CLOEXEC 0 ++#endif ++ + Job* job_new(Manager *m, JobType type, Unit *unit) { + Job *j; + +Index: systemd-13/src/manager.c +=================================================================== +--- systemd-13.orig/src/manager.c ++++ systemd-13/src/manager.c +@@ -59,6 +59,14 @@ + #include "bus-errors.h" + #include "exit-status.h" + ++#ifndef SOCK_NONBLOCK ++#define SOCK_NONBLOCK 0 ++#endif ++ ++#ifndef SOCK_CLOEXEC ++#define SOCK_CLOEXEC 0 ++#endif ++ + /* As soon as 16 units are in our GC queue, make sure to run a gc sweep */ + #define GC_QUEUE_ENTRIES_MAX 16 + diff --git a/patches/systemd-20/0002-limited-datatype.patch b/patches/systemd-20/0002-limited-datatype.patch new file mode 100644 index 000000000..5ec8bc06d --- /dev/null +++ b/patches/systemd-20/0002-limited-datatype.patch @@ -0,0 +1,19 @@ +src/manager.c:144: warning: comparison is always false due to limited range of data type [-Wtype-limits] + +--- + src/manager.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +Index: systemd-13/src/manager.c +=================================================================== +--- systemd-13.orig/src/manager.c ++++ systemd-13/src/manager.c +@@ -126,7 +126,7 @@ static int manager_setup_notify(Manager + } + + static int enable_special_signals(Manager *m) { +- char fd; ++ int fd; + + assert(m); + diff --git a/patches/systemd-20/0003-add-xml-files.patch b/patches/systemd-20/0003-add-xml-files.patch new file mode 100644 index 000000000..8f36a7d5f --- /dev/null +++ b/patches/systemd-20/0003-add-xml-files.patch @@ -0,0 +1,299 @@ +--- + org.freedesktop.systemd1.Automount.xml | 8 +++ + org.freedesktop.systemd1.Device.xml | 7 ++ + org.freedesktop.systemd1.Job.xml | 2 + org.freedesktop.systemd1.Manager.xml | 2 + org.freedesktop.systemd1.Mount.xml | 69 +++++++++++++++++++++++++++ + org.freedesktop.systemd1.Path.xml | 9 +++ + org.freedesktop.systemd1.Service.xml | 2 + org.freedesktop.systemd1.Snapshot.xml | 9 +++ + org.freedesktop.systemd1.Socket.xml | 83 +++++++++++++++++++++++++++++++++ + org.freedesktop.systemd1.Swap.xml | 9 +++ + org.freedesktop.systemd1.Target.xml | 7 ++ + org.freedesktop.systemd1.Timer.xml | 9 +++ + org.freedesktop.systemd1.Unit.xml | 2 + 13 files changed, 218 insertions(+) + +Index: systemd-18/org.freedesktop.systemd1.Automount.xml +=================================================================== +--- /dev/null ++++ systemd-18/org.freedesktop.systemd1.Automount.xml +@@ -0,0 +1,8 @@ ++ ++ ++ ++ ++ ++ ++ +Index: systemd-18/org.freedesktop.systemd1.Device.xml +=================================================================== +--- /dev/null ++++ systemd-18/org.freedesktop.systemd1.Device.xml +@@ -0,0 +1,7 @@ ++ ++ ++ ++ ++ ++ +Index: systemd-18/org.freedesktop.systemd1.Mount.xml +=================================================================== +--- /dev/null ++++ systemd-18/org.freedesktop.systemd1.Mount.xml +@@ -0,0 +1,69 @@ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ +Index: systemd-18/org.freedesktop.systemd1.Path.xml +=================================================================== +--- /dev/null ++++ systemd-18/org.freedesktop.systemd1.Path.xml +@@ -0,0 +1,9 @@ ++ ++ ++ ++ ++ ++ ++ ++ +Index: systemd-18/org.freedesktop.systemd1.Snapshot.xml +=================================================================== +--- /dev/null ++++ systemd-18/org.freedesktop.systemd1.Snapshot.xml +@@ -0,0 +1,9 @@ ++ ++ ++ ++ ++ ++ ++ ++ +Index: systemd-18/org.freedesktop.systemd1.Socket.xml +=================================================================== +--- /dev/null ++++ systemd-18/org.freedesktop.systemd1.Socket.xml +@@ -0,0 +1,83 @@ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ +Index: systemd-18/org.freedesktop.systemd1.Swap.xml +=================================================================== +--- /dev/null ++++ systemd-18/org.freedesktop.systemd1.Swap.xml +@@ -0,0 +1,9 @@ ++ ++ ++ ++ ++ ++ ++ ++ +Index: systemd-18/org.freedesktop.systemd1.Target.xml +=================================================================== +--- /dev/null ++++ systemd-18/org.freedesktop.systemd1.Target.xml +@@ -0,0 +1,7 @@ ++ ++ ++ ++ ++ ++ +Index: systemd-18/org.freedesktop.systemd1.Timer.xml +=================================================================== +--- /dev/null ++++ systemd-18/org.freedesktop.systemd1.Timer.xml +@@ -0,0 +1,9 @@ ++ ++ ++ ++ ++ ++ ++ ++ +Index: systemd-18/org.freedesktop.systemd1.Manager.xml +=================================================================== +--- /dev/null ++++ systemd-18/org.freedesktop.systemd1.Manager.xml +@@ -0,0 +1,2 @@ ++ ++ +Index: systemd-18/org.freedesktop.systemd1.Job.xml +=================================================================== +--- /dev/null ++++ systemd-18/org.freedesktop.systemd1.Job.xml +@@ -0,0 +1,2 @@ ++ ++ +Index: systemd-18/org.freedesktop.systemd1.Unit.xml +=================================================================== +--- /dev/null ++++ systemd-18/org.freedesktop.systemd1.Unit.xml +@@ -0,0 +1,2 @@ ++ ++ +Index: systemd-18/org.freedesktop.systemd1.Service.xml +=================================================================== +--- /dev/null ++++ systemd-18/org.freedesktop.systemd1.Service.xml +@@ -0,0 +1,2 @@ ++ ++ diff --git a/patches/systemd-20/0004-create-dbussystemservicedir.patch b/patches/systemd-20/0004-create-dbussystemservicedir.patch new file mode 100644 index 000000000..ad134a7ed --- /dev/null +++ b/patches/systemd-20/0004-create-dbussystemservicedir.patch @@ -0,0 +1,21 @@ +( cd /home/rsc/svn/oselas/bsp/pengutronix/OSELAS.BSP-Pengutronix-Generic-trunk/platform-versatilepb/packages/systemd-10/usr/share/dbus-1/services && \ + rm -f org.freedesktop.systemd1.service && \ + ln -s ../system-services/org.freedesktop.systemd1.service org.freedesktop.systemd1.service ) +/bin/sh: line 0: cd: /home/rsc/svn/oselas/bsp/pengutronix/OSELAS.BSP-Pengutronix-Generic-trunk/platform-versatilepb/packages/systemd-10/usr/share/dbus-1/services: No such file or directory + +--- + Makefile.am | 1 + + 1 file changed, 1 insertion(+) + +Index: systemd-18/Makefile.am +=================================================================== +--- systemd-18.orig/Makefile.am ++++ systemd-18/Makefile.am +@@ -1161,6 +1161,7 @@ install-data-hook: + $(DESTDIR)$(pkgsysconfdir)/system/multi-user.target.wants \ + $(DESTDIR)$(pkgsysconfdir)/system/getty.target.wants \ + $(DESTDIR)$(pkgsysconfdir)/user \ ++ $(DESTDIR)$(dbussessionservicedir) \ + $(DESTDIR)$(sysconfdir)/xdg/systemd + ( cd $(DESTDIR)$(sysconfdir)/xdg/systemd/ && \ + rm -f user && \ diff --git a/patches/systemd-20/0005-dbus-fix-system-handling.patch b/patches/systemd-20/0005-dbus-fix-system-handling.patch new file mode 100644 index 000000000..ff097b520 --- /dev/null +++ b/patches/systemd-20/0005-dbus-fix-system-handling.patch @@ -0,0 +1,30 @@ +From 88a053f041a07c75d5395261524b5cf695284430 Mon Sep 17 00:00:00 2001 +From: Robert Schwebel +Date: Thu, 14 Oct 2010 17:53:07 +0200 +Subject: [PATCH] dbus: fix --system handling + +We currently only create the private D-Bus server when pid == 1, but +this has also to be done if the user started us with --system. +Otherwhise we get this error: + + systemd-cgroups-agent[164]: Failed to get D-Bus connection: + Failed to connect to socket /org/freedesktop/systemd1/private: Connection refused + +Signed-off-by: Robert Schwebel +--- + src/dbus.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +Index: systemd-18/src/dbus.c +=================================================================== +--- systemd-18.orig/src/dbus.c ++++ systemd-18/src/dbus.c +@@ -952,7 +952,7 @@ static int bus_init_private(Manager *m) + return 0; + + /* We want the private bus only when running as init */ +- if (getpid() != 1) ++ if (m->running_as != MANAGER_SYSTEM) + return 0; + + if (!(m->private_bus = dbus_server_listen("unix:abstract=/org/freedesktop/systemd1/private", &error))) { diff --git a/patches/systemd-20/autogen.sh b/patches/systemd-20/autogen.sh new file mode 120000 index 000000000..9f8a4cb7d --- /dev/null +++ b/patches/systemd-20/autogen.sh @@ -0,0 +1 @@ +../autogen.sh \ No newline at end of file diff --git a/patches/systemd-20/series b/patches/systemd-20/series new file mode 100644 index 000000000..82d8a03a4 --- /dev/null +++ b/patches/systemd-20/series @@ -0,0 +1,5 @@ +0001-missing-IN_CLOEXIT.patch +0002-limited-datatype.patch +0003-add-xml-files.patch +0004-create-dbussystemservicedir.patch +0005-dbus-fix-system-handling.patch diff --git a/rules/systemd.in b/rules/systemd.in new file mode 100644 index 000000000..2cfc4a614 --- /dev/null +++ b/rules/systemd.in @@ -0,0 +1,23 @@ +## SECTION=shell_and_console + +config SYSTEMD + tristate + select LIBC_PTHREAD + select LIBC_RT + select DBUS + select DBUS_GLIB + select LIBCAP + select UDEV + select UDEV_LIBUDEV + prompt "systemd" + help + systemd is a system and session manager for Linux, compatible with SysV + and LSB init scripts. systemd provides aggressive parallelization + capabilities, uses socket and D-Bus activation for starting services, + offers on-demand starting of daemons, keeps track of processes using + Linux cgroups, supports snapshotting and restoring of the system state, + maintains mount and automount points and implements an elaborate + transactional dependency-based service control logic. It can work as a + drop-in replacement for sysvinit. + + http://www.freedesktop.org/wiki/Software/systemd diff --git a/rules/systemd.make b/rules/systemd.make new file mode 100644 index 000000000..0ace4ef10 --- /dev/null +++ b/rules/systemd.make @@ -0,0 +1,118 @@ +# -*-makefile-*- +# +# Copyright (C) 2010 by Robert Schwebel +# +# See CREDITS for details about who has contributed to this project. +# +# For further information about the PTXdist project and license conditions +# see the README file. +# + +# +# We provide this package +# +PACKAGES-$(PTXCONF_SYSTEMD) += systemd + +# +# Paths and names +# +SYSTEMD_VERSION := 20 +SYSTEMD := systemd-$(SYSTEMD_VERSION) +SYSTEMD_SUFFIX := tar.bz2 +SYSTEMD_URL := http://www.freedesktop.org/software/systemd/$(SYSTEMD).$(SYSTEMD_SUFFIX) +SYSTEMD_SOURCE := $(SRCDIR)/$(SYSTEMD).$(SYSTEMD_SUFFIX) +SYSTEMD_DIR := $(BUILDDIR)/$(SYSTEMD) +SYSTEMD_LICENSE := unknown + +# ---------------------------------------------------------------------------- +# Get +# ---------------------------------------------------------------------------- + +$(SYSTEMD_SOURCE): + @$(call targetinfo) + @$(call get, SYSTEMD) + +# ---------------------------------------------------------------------------- +# Prepare +# ---------------------------------------------------------------------------- + +#SYSTEMD_CONF_ENV := $(CROSS_ENV) + +# +# autoconf +# +SYSTEMD_CONF_TOOL := autoconf +SYSTEMD_CONF_OPT := $(CROSS_AUTOCONF_USR) + +SYSTEMD_CONF_OPT += \ + --enable-silent-rules \ + --disable-selinux \ + --disable-tcpwrap \ + --disable-pam \ + --disable-gtk \ + --with-distro=other \ + --with-sysvinit-path=/etc/init.d \ + --with-sysvrcd-path=/etc \ + --with-syslog-service=syslog-ng.service \ + --with-dbuspolicydir=/etc/dbus-1/system.d \ + --with-dbussessionservicedir=/usr/share/dbus-1/services \ + --with-dbussystemservicedir=/usr/share/dbus-1/system-services \ + --with-dbusinterfacedir=/usr/share/dbus-1/interfaces \ + --with-udevrulesdir=/lib/udev/rules.d \ + --with-pamlibdir=/lib/security \ + --with-rootdir= + +# SYSTEMD_MAKEVARS := V=1 + +# FIXME --with-syslog-service depends on config +# FIXME do we have to create dbuspolicydir? +# FIXME --with-rootdir=/ or /usr? +# - autofs4 is mandatory. Is this necessary? +# - ipv6 is mandatory. Is this necessary? + +# FIXME busybox tools: +# - modprobe fails +# - mount fails + +# ---------------------------------------------------------------------------- +# Target-Install +# ---------------------------------------------------------------------------- + +$(STATEDIR)/systemd.targetinstall: + @$(call targetinfo) + + @$(call install_init, systemd) + @$(call install_fixup, systemd,PRIORITY,optional) + @$(call install_fixup, systemd,SECTION,base) + @$(call install_fixup, systemd,AUTHOR,"Robert Schwebel ") + @$(call install_fixup, systemd,DESCRIPTION,missing) + + # + # Some info about the current state of systemd support in ptxdist: + # + # - we don't care about a user systemd yet + # + + # daemon + tools + @$(call install_copy, systemd, 0, 0, 0755, -, /bin/systemd) + @$(call install_copy, systemd, 0, 0, 0755, -, /bin/systemctl) + @$(call install_copy, systemd, 0, 0, 0755, -, /bin/systemd-ask-password) + @$(call install_copy, systemd, 0, 0, 0755, -, /bin/systemd-tmpfiles) + @$(call install_copy, systemd, 0, 0, 0755, -, /bin/systemd-notify) + @$(call install_copy, systemd, 0, 0, 0755, -, /usr/bin/systemd-cgls) + + # configuration + @$(call install_copy, systemd, 0, 0, 0644, -, /etc/systemd/system.conf) + @$(call install_copy, systemd, 0, 0, 0644, -, /etc/tmpfiles.d/x11.conf) + @$(call install_copy, systemd, 0, 0, 0644, -, /etc/tmpfiles.d/systemd.conf) + @$(call install_copy, systemd, 0, 0, 0644, -, /lib/udev/rules.d/99-systemd.rules) + @$(call install_copy, systemd, 0, 0, 0644, -, /etc/dbus-1/system.d/org.freedesktop.systemd1.conf) + + # units + @$(call install_tree, systemd, -, -, $(SYSTEMD_PKGDIR)/lib/systemd, /lib/systemd) + + @$(call install_finish, systemd) + + @$(call touch) + +# vim: syntax=make -- cgit v1.2.3