+++ /dev/null
-Prefer getty to agetty in console setup systemd units
-
-Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
-Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>
----
-
-diff -aburN systemd-212.orig/units/getty@.service.m4 systemd-212/units/getty@.service.m4
---- systemd-212.orig/units/getty@.service.m4 2014-01-28 11:08:51.000000000 +0100
-+++ systemd-212/units/getty@.service.m4 2014-03-26 11:06:27.000000000 +0100
-@@ -27,7 +27,7 @@
-
- [Service]
- # the VT is cleared by TTYVTDisallocate
--ExecStart=-/sbin/agetty --noclear %I $TERM
-+ExecStart=-/sbin/getty -L %I 115200 vt100
- Type=idle
- Restart=always
- RestartSec=0
-diff -aburN systemd-212.orig/units/serial-getty@.service.m4 systemd-212/units/serial-getty@.service.m4
---- systemd-212.orig/units/serial-getty@.service.m4 2014-03-13 18:47:24.000000000 +0100
-+++ systemd-212/units/serial-getty@.service.m4 2014-03-26 11:07:01.000000000 +0100
-@@ -22,7 +22,7 @@
- IgnoreOnIsolate=yes
-
- [Service]
--ExecStart=-/sbin/agetty --keep-baud 115200,38400,9600 %I $TERM
-+ExecStart=-/sbin/getty -L %I 115200 vt100
- Type=idle
- Restart=always
- RestartSec=0
--- /dev/null
+From a924f43f30f9c4acaf70618dd2a055f8b0f166be Mon Sep 17 00:00:00 2001
+From: Evgeny Vereshchagin <evvers@ya.ru>
+Date: Wed, 24 May 2017 08:56:48 +0300
+Subject: [PATCH] resolved: bugfix of null pointer p->question dereferencing
+ (#6020)
+
+See https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1621396
+
+[Upstream commit: https://github.com/systemd/systemd/commit/a924f43f30f9c4acaf70618dd2a055f8b0f166be]
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+---
+ src/resolve/resolved-dns-packet.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/src/resolve/resolved-dns-packet.c b/src/resolve/resolved-dns-packet.c
+index 652970284e..240ee448f4 100644
+--- a/src/resolve/resolved-dns-packet.c
++++ b/src/resolve/resolved-dns-packet.c
+@@ -2269,6 +2269,9 @@ int dns_packet_is_reply_for(DnsPacket *p, const DnsResourceKey *key) {
+ if (r < 0)
+ return r;
+
++ if (!p->question)
++ return 0;
++
+ if (p->question->n_keys != 1)
+ return 0;
+
+++ /dev/null
-From c78fa2b40cb8b810d06ef225e30f12a7ed44ffa2 Mon Sep 17 00:00:00 2001
-From: "Yann E. MORIN" <yann.morin.1998@free.fr>
-Date: Sat, 1 Apr 2017 11:26:29 +0200
-Subject: [PATCH] build: check for ln --relative
-
-ln --relative is recent enough that not all distributions support it.
-This is especially the case for enterprise-grade distributions than can
-have a life-span of more than a decade.
-
-Detect if ln supports --relative and use it if so.
-
-If not supported, use a bit of sed magic to construct the ../ sequence,
-that leads back to / when appended to the destination directory.
-
-We introduce this as a macro that expands to a single command. To avoid
-complexity in the macro, we expect paths to be passed whitout the
-leading DESTDIR.
-
----
-Upstream status: submitted, disputed:
- https://github.com/systemd/systemd/pull/5682
-
----
- Makefile.am | 25 ++++++++++++++++++++++---
- configure.ac | 5 ++++-
- 2 files changed, 26 insertions(+), 4 deletions(-)
-
-diff --git a/Makefile.am b/Makefile.am
-index 1cc657a..ec503f2 100644
---- a/Makefile.am
-+++ b/Makefile.am
-@@ -300,6 +300,24 @@ install-busnames-target-wants-hook:
- what="$(BUSNAMES_TARGET_WANTS)" && wants=busnames.target && dir=$(systemunitdir) && $(add-wants)
- what="$(USER_BUSNAMES_TARGET_WANTS)" && wants=busnames.target && dir=$(userunitdir) && $(add-wants)
-
-+# Macro to emulate ln --relative when needed
-+# $(1): options for ln, except --relative
-+# $(2): source file, absolute path without leading DESTDIR
-+# $(3): destination file, absolute path without leading DESTDIR
-+if HAVE_LN_RELATIVE
-+define ln-s-relative
-+ $(LN_S) --relative $(1) \
-+ $(DESTDIR)$(strip $(2)) \
-+ $(DESTDIR)$(strip $(3))
-+endef
-+else
-+define ln-s-relative
-+ $(LN_S) $(1) \
-+ `dirname $(strip $(3)) |sed -r -e 's:/+[^/]+:../:g; s:/$$::'`$(strip $(2)) \
-+ $(DESTDIR)$(strip $(3))
-+endef
-+endif
-+
- define add-wants
- [ -z "$$what" ] || ( \
- dir=$(DESTDIR)$$dir/$$wants.wants && \
-@@ -313,8 +331,9 @@ install-directories-hook:
- $(MKDIR_P) $(addprefix $(DESTDIR),$(INSTALL_DIRS))
-
- install-environment-conf-hook: install-directories-hook
-- $(AM_V_LN)$(LN_S) --relative -f $(DESTDIR)$(sysconfdir)/environment \
-- $(DESTDIR)$(environmentdir)/99-environment.conf
-+ $(AM_V_LN)$(call ln-s-relative,-f,\
-+ $(sysconfdir)/environment,\
-+ $(environmentdir)/99-environment.conf)
-
- install-aliases-hook:
- set -- $(SYSTEM_UNIT_ALIASES) && \
-@@ -337,7 +356,7 @@ define install-relative-aliases
- while [ -n "$$1" ]; do \
- $(MKDIR_P) `dirname $(DESTDIR)$$dir/$$2` && \
- rm -f $(DESTDIR)$$dir/$$2 && \
-- $(LN_S) --relative $(DESTDIR)$$1 $(DESTDIR)$$dir/$$2 && \
-+ $(call ln-s-relative,,$$1,$$dir/$$2) && \
- shift 2 || exit $$?; \
- done
- endef
-diff --git a/configure.ac b/configure.ac
-index cf37ca6..d586fc4 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -108,7 +108,10 @@ AC_PATH_PROG([SULOGIN], [sulogin], [/usr/sbin/sulogin], [$PATH:/usr/sbin:/sbin])
- AC_PATH_PROG([MOUNT_PATH], [mount], [/usr/bin/mount], [$PATH:/usr/sbin:/sbin])
- AC_PATH_PROG([UMOUNT_PATH], [umount], [/usr/bin/umount], [$PATH:/usr/sbin:/sbin])
-
--AS_IF([! ln --relative --help > /dev/null 2>&1], [AC_MSG_ERROR([*** ln doesn't support --relative ***])])
-+AC_MSG_CHECKING([if ln supports --relative])
-+AS_IF([! ${LN_S} --relative --help > /dev/null 2>&1], [ln_relative=no], [ln_relative=yes])
-+AC_MSG_RESULT([$ln_relative])
-+AM_CONDITIONAL([HAVE_LN_RELATIVE], [test "x$ln_relative" = "xyes"])
-
- M4_DEFINES=
-
---
-2.9.3
-
--- /dev/null
+From db848813bae4d28c524b3b6a7dad135e426659ce Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
+Date: Sun, 18 Jun 2017 16:07:57 -0400
+Subject: [PATCH] resolved: simplify alloc size calculation
+
+The allocation size was calculated in a complicated way, and for values
+close to the page size we would actually allocate less than requested.
+
+Reported by Chris Coulson <chris.coulson@canonical.com>.
+
+CVE-2017-9445
+
+[Upstream commit: https://github.com/systemd/systemd/commit/db848813bae4d28c524b3b6a7dad135e426659ce]
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+---
+ src/resolve/resolved-dns-packet.c | 8 +-------
+ src/resolve/resolved-dns-packet.h | 2 --
+ 2 files changed, 1 insertion(+), 9 deletions(-)
+
+diff --git a/src/resolve/resolved-dns-packet.c b/src/resolve/resolved-dns-packet.c
+index 240ee448f4..821b66e266 100644
+--- a/src/resolve/resolved-dns-packet.c
++++ b/src/resolve/resolved-dns-packet.c
+@@ -47,13 +47,7 @@ int dns_packet_new(DnsPacket **ret, DnsProtocol protocol, size_t mtu) {
+
+ assert(ret);
+
+- if (mtu <= UDP_PACKET_HEADER_SIZE)
+- a = DNS_PACKET_SIZE_START;
+- else
+- a = mtu - UDP_PACKET_HEADER_SIZE;
+-
+- if (a < DNS_PACKET_HEADER_SIZE)
+- a = DNS_PACKET_HEADER_SIZE;
++ a = MAX(mtu, DNS_PACKET_HEADER_SIZE);
+
+ /* round up to next page size */
+ a = PAGE_ALIGN(ALIGN(sizeof(DnsPacket)) + a) - ALIGN(sizeof(DnsPacket));
+diff --git a/src/resolve/resolved-dns-packet.h b/src/resolve/resolved-dns-packet.h
+index 2c92392e4d..3abcaf8cf3 100644
+--- a/src/resolve/resolved-dns-packet.h
++++ b/src/resolve/resolved-dns-packet.h
+@@ -66,8 +66,6 @@ struct DnsPacketHeader {
+ /* With EDNS0 we can use larger packets, default to 4096, which is what is commonly used */
+ #define DNS_PACKET_UNICAST_SIZE_LARGE_MAX 4096
+
+-#define DNS_PACKET_SIZE_START 512
+-
+ struct DnsPacket {
+ int n_ref;
+ DnsProtocol protocol;
+++ /dev/null
-Fix AM_PATH_LIBGCRYPT not found
-
-This patch installs a copy of libgcrypt.m4 from the libgcrypt source tarball
-to systemd m4 directory.
-
-Libgcrypt uses a custom m4 macro and not pkg-config to check if the
-development files are available. Though libgcrypt support is optional in
-systemd, this macro should be available whenever autoreconf is used, otherwise
-the re-configuration will fail with:
-
- configure.ac:616: warning: macro 'AM_PATH_LIBGCRYPT' not found in library
-
-As asking the user to install the development package of libgcrypt on the host
-machine or adding libgcrypt as a build dependency to systemd is not
-acceptable, the required file is added to the m4 directory.
-
-Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>
-Index: systemd-213/m4/libgcrypt.m4
-===================================================================
---- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ systemd-213/m4/libgcrypt.m4 2014-06-11 10:41:11.749305509 +0200
-@@ -0,0 +1,123 @@
-+dnl Autoconf macros for libgcrypt
-+dnl Copyright (C) 2002, 2004 Free Software Foundation, Inc.
-+dnl
-+dnl This file is free software; as a special exception the author gives
-+dnl unlimited permission to copy and/or distribute it, with or without
-+dnl modifications, as long as this notice is preserved.
-+dnl
-+dnl This file is distributed in the hope that it will be useful, but
-+dnl WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
-+dnl implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-+
-+
-+dnl AM_PATH_LIBGCRYPT([MINIMUM-VERSION,
-+dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
-+dnl Test for libgcrypt and define LIBGCRYPT_CFLAGS and LIBGCRYPT_LIBS.
-+dnl MINIMUN-VERSION is a string with the version number optionalliy prefixed
-+dnl with the API version to also check the API compatibility. Example:
-+dnl a MINIMUN-VERSION of 1:1.2.5 won't pass the test unless the installed
-+dnl version of libgcrypt is at least 1.2.5 *and* the API number is 1. Using
-+dnl this features allows to prevent build against newer versions of libgcrypt
-+dnl with a changed API.
-+dnl
-+AC_DEFUN([AM_PATH_LIBGCRYPT],
-+[ AC_ARG_WITH(libgcrypt-prefix,
-+ AC_HELP_STRING([--with-libgcrypt-prefix=PFX],
-+ [prefix where LIBGCRYPT is installed (optional)]),
-+ libgcrypt_config_prefix="$withval", libgcrypt_config_prefix="")
-+ if test x$libgcrypt_config_prefix != x ; then
-+ if test x${LIBGCRYPT_CONFIG+set} != xset ; then
-+ LIBGCRYPT_CONFIG=$libgcrypt_config_prefix/bin/libgcrypt-config
-+ fi
-+ fi
-+
-+ AC_PATH_TOOL(LIBGCRYPT_CONFIG, libgcrypt-config, no)
-+ tmp=ifelse([$1], ,1:1.2.0,$1)
-+ if echo "$tmp" | grep ':' >/dev/null 2>/dev/null ; then
-+ req_libgcrypt_api=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\1/'`
-+ min_libgcrypt_version=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\2/'`
-+ else
-+ req_libgcrypt_api=0
-+ min_libgcrypt_version="$tmp"
-+ fi
-+
-+ AC_MSG_CHECKING(for LIBGCRYPT - version >= $min_libgcrypt_version)
-+ ok=no
-+ if test "$LIBGCRYPT_CONFIG" != "no" ; then
-+ req_major=`echo $min_libgcrypt_version | \
-+ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
-+ req_minor=`echo $min_libgcrypt_version | \
-+ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
-+ req_micro=`echo $min_libgcrypt_version | \
-+ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
-+ libgcrypt_config_version=`$LIBGCRYPT_CONFIG --version`
-+ major=`echo $libgcrypt_config_version | \
-+ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
-+ minor=`echo $libgcrypt_config_version | \
-+ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
-+ micro=`echo $libgcrypt_config_version | \
-+ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
-+ if test "$major" -gt "$req_major"; then
-+ ok=yes
-+ else
-+ if test "$major" -eq "$req_major"; then
-+ if test "$minor" -gt "$req_minor"; then
-+ ok=yes
-+ else
-+ if test "$minor" -eq "$req_minor"; then
-+ if test "$micro" -ge "$req_micro"; then
-+ ok=yes
-+ fi
-+ fi
-+ fi
-+ fi
-+ fi
-+ fi
-+ if test $ok = yes; then
-+ AC_MSG_RESULT([yes ($libgcrypt_config_version)])
-+ else
-+ AC_MSG_RESULT(no)
-+ fi
-+ if test $ok = yes; then
-+ # If we have a recent libgcrypt, we should also check that the
-+ # API is compatible
-+ if test "$req_libgcrypt_api" -gt 0 ; then
-+ tmp=`$LIBGCRYPT_CONFIG --api-version 2>/dev/null || echo 0`
-+ if test "$tmp" -gt 0 ; then
-+ AC_MSG_CHECKING([LIBGCRYPT API version])
-+ if test "$req_libgcrypt_api" -eq "$tmp" ; then
-+ AC_MSG_RESULT([okay])
-+ else
-+ ok=no
-+ AC_MSG_RESULT([does not match. want=$req_libgcrypt_api got=$tmp])
-+ fi
-+ fi
-+ fi
-+ fi
-+ if test $ok = yes; then
-+ LIBGCRYPT_CFLAGS=`$LIBGCRYPT_CONFIG --cflags`
-+ LIBGCRYPT_LIBS=`$LIBGCRYPT_CONFIG --libs`
-+ ifelse([$2], , :, [$2])
-+ if test x"$host" != x ; then
-+ libgcrypt_config_host=`$LIBGCRYPT_CONFIG --host 2>/dev/null || echo none`
-+ if test x"$libgcrypt_config_host" != xnone ; then
-+ if test x"$libgcrypt_config_host" != x"$host" ; then
-+ AC_MSG_WARN([[
-+***
-+*** The config script $LIBGCRYPT_CONFIG was
-+*** built for $libgcrypt_config_host and thus may not match the
-+*** used host $host.
-+*** You may want to use the configure option --with-libgcrypt-prefix
-+*** to specify a matching config script.
-+***]])
-+ fi
-+ fi
-+ fi
-+ else
-+ LIBGCRYPT_CFLAGS=""
-+ LIBGCRYPT_LIBS=""
-+ ifelse([$3], , :, [$3])
-+ fi
-+ AC_SUBST(LIBGCRYPT_CFLAGS)
-+ AC_SUBST(LIBGCRYPT_LIBS)
-+])
--- /dev/null
+From 88795538726a5bbfd9efc13d441cb05e1d7fc139 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
+Date: Tue, 27 Jun 2017 14:20:00 -0400
+Subject: [PATCH] resolved: do not allocate packets with minimum size
+
+dns_packet_new() is sometimes called with mtu == 0, and in that case we should
+allocate more than the absolute minimum (which is the dns packet header size),
+otherwise we have to resize immediately again after appending the first data to
+the packet.
+
+This partially reverts the previous commit.
+
+[Upstream commit: https://github.com/systemd/systemd/commit/88795538726a5bbfd9efc13d441cb05e1d7fc139]
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+---
+ src/resolve/resolved-dns-packet.c | 12 +++++++++++-
+ 1 file changed, 11 insertions(+), 1 deletion(-)
+
+diff --git a/src/resolve/resolved-dns-packet.c b/src/resolve/resolved-dns-packet.c
+index 821b66e266..d1f0f760a4 100644
+--- a/src/resolve/resolved-dns-packet.c
++++ b/src/resolve/resolved-dns-packet.c
+@@ -28,6 +28,9 @@
+
+ #define EDNS0_OPT_DO (1<<15)
+
++#define DNS_PACKET_SIZE_START 512
++assert_cc(DNS_PACKET_SIZE_START > UDP_PACKET_HEADER_SIZE)
++
+ typedef struct DnsPacketRewinder {
+ DnsPacket *packet;
+ size_t saved_rindex;
+@@ -47,7 +50,14 @@ int dns_packet_new(DnsPacket **ret, DnsProtocol protocol, size_t mtu) {
+
+ assert(ret);
+
+- a = MAX(mtu, DNS_PACKET_HEADER_SIZE);
++ /* When dns_packet_new() is called with mtu == 0, allocate more than the
++ * absolute minimum (which is the dns packet header size), to avoid
++ * resizing immediately again after appending the first data to the packet.
++ */
++ if (mtu < UDP_PACKET_HEADER_SIZE)
++ a = DNS_PACKET_SIZE_START;
++ else
++ a = MAX(mtu, DNS_PACKET_HEADER_SIZE);
+
+ /* round up to next page size */
+ a = PAGE_ALIGN(ALIGN(sizeof(DnsPacket)) + a) - ALIGN(sizeof(DnsPacket));
--- /dev/null
+Prefer getty to agetty in console setup systemd units
+
+Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
+Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>
+---
+
+diff -aburN systemd-212.orig/units/getty@.service.m4 systemd-212/units/getty@.service.m4
+--- systemd-212.orig/units/getty@.service.m4 2014-01-28 11:08:51.000000000 +0100
++++ systemd-212/units/getty@.service.m4 2014-03-26 11:06:27.000000000 +0100
+@@ -27,7 +27,7 @@
+
+ [Service]
+ # the VT is cleared by TTYVTDisallocate
+-ExecStart=-/sbin/agetty --noclear %I $TERM
++ExecStart=-/sbin/getty -L %I 115200 vt100
+ Type=idle
+ Restart=always
+ RestartSec=0
+diff -aburN systemd-212.orig/units/serial-getty@.service.m4 systemd-212/units/serial-getty@.service.m4
+--- systemd-212.orig/units/serial-getty@.service.m4 2014-03-13 18:47:24.000000000 +0100
++++ systemd-212/units/serial-getty@.service.m4 2014-03-26 11:07:01.000000000 +0100
+@@ -22,7 +22,7 @@
+ IgnoreOnIsolate=yes
+
+ [Service]
+-ExecStart=-/sbin/agetty --keep-baud 115200,38400,9600 %I $TERM
++ExecStart=-/sbin/getty -L %I 115200 vt100
+ Type=idle
+ Restart=always
+ RestartSec=0
--- /dev/null
+From c78fa2b40cb8b810d06ef225e30f12a7ed44ffa2 Mon Sep 17 00:00:00 2001
+From: "Yann E. MORIN" <yann.morin.1998@free.fr>
+Date: Sat, 1 Apr 2017 11:26:29 +0200
+Subject: [PATCH] build: check for ln --relative
+
+ln --relative is recent enough that not all distributions support it.
+This is especially the case for enterprise-grade distributions than can
+have a life-span of more than a decade.
+
+Detect if ln supports --relative and use it if so.
+
+If not supported, use a bit of sed magic to construct the ../ sequence,
+that leads back to / when appended to the destination directory.
+
+We introduce this as a macro that expands to a single command. To avoid
+complexity in the macro, we expect paths to be passed whitout the
+leading DESTDIR.
+
+---
+Upstream status: submitted, disputed:
+ https://github.com/systemd/systemd/pull/5682
+
+---
+ Makefile.am | 25 ++++++++++++++++++++++---
+ configure.ac | 5 ++++-
+ 2 files changed, 26 insertions(+), 4 deletions(-)
+
+diff --git a/Makefile.am b/Makefile.am
+index 1cc657a..ec503f2 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -300,6 +300,24 @@ install-busnames-target-wants-hook:
+ what="$(BUSNAMES_TARGET_WANTS)" && wants=busnames.target && dir=$(systemunitdir) && $(add-wants)
+ what="$(USER_BUSNAMES_TARGET_WANTS)" && wants=busnames.target && dir=$(userunitdir) && $(add-wants)
+
++# Macro to emulate ln --relative when needed
++# $(1): options for ln, except --relative
++# $(2): source file, absolute path without leading DESTDIR
++# $(3): destination file, absolute path without leading DESTDIR
++if HAVE_LN_RELATIVE
++define ln-s-relative
++ $(LN_S) --relative $(1) \
++ $(DESTDIR)$(strip $(2)) \
++ $(DESTDIR)$(strip $(3))
++endef
++else
++define ln-s-relative
++ $(LN_S) $(1) \
++ `dirname $(strip $(3)) |sed -r -e 's:/+[^/]+:../:g; s:/$$::'`$(strip $(2)) \
++ $(DESTDIR)$(strip $(3))
++endef
++endif
++
+ define add-wants
+ [ -z "$$what" ] || ( \
+ dir=$(DESTDIR)$$dir/$$wants.wants && \
+@@ -313,8 +331,9 @@ install-directories-hook:
+ $(MKDIR_P) $(addprefix $(DESTDIR),$(INSTALL_DIRS))
+
+ install-environment-conf-hook: install-directories-hook
+- $(AM_V_LN)$(LN_S) --relative -f $(DESTDIR)$(sysconfdir)/environment \
+- $(DESTDIR)$(environmentdir)/99-environment.conf
++ $(AM_V_LN)$(call ln-s-relative,-f,\
++ $(sysconfdir)/environment,\
++ $(environmentdir)/99-environment.conf)
+
+ install-aliases-hook:
+ set -- $(SYSTEM_UNIT_ALIASES) && \
+@@ -337,7 +356,7 @@ define install-relative-aliases
+ while [ -n "$$1" ]; do \
+ $(MKDIR_P) `dirname $(DESTDIR)$$dir/$$2` && \
+ rm -f $(DESTDIR)$$dir/$$2 && \
+- $(LN_S) --relative $(DESTDIR)$$1 $(DESTDIR)$$dir/$$2 && \
++ $(call ln-s-relative,,$$1,$$dir/$$2) && \
+ shift 2 || exit $$?; \
+ done
+ endef
+diff --git a/configure.ac b/configure.ac
+index cf37ca6..d586fc4 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -108,7 +108,10 @@ AC_PATH_PROG([SULOGIN], [sulogin], [/usr/sbin/sulogin], [$PATH:/usr/sbin:/sbin])
+ AC_PATH_PROG([MOUNT_PATH], [mount], [/usr/bin/mount], [$PATH:/usr/sbin:/sbin])
+ AC_PATH_PROG([UMOUNT_PATH], [umount], [/usr/bin/umount], [$PATH:/usr/sbin:/sbin])
+
+-AS_IF([! ln --relative --help > /dev/null 2>&1], [AC_MSG_ERROR([*** ln doesn't support --relative ***])])
++AC_MSG_CHECKING([if ln supports --relative])
++AS_IF([! ${LN_S} --relative --help > /dev/null 2>&1], [ln_relative=no], [ln_relative=yes])
++AC_MSG_RESULT([$ln_relative])
++AM_CONDITIONAL([HAVE_LN_RELATIVE], [test "x$ln_relative" = "xyes"])
+
+ M4_DEFINES=
+
+--
+2.9.3
+
--- /dev/null
+Fix AM_PATH_LIBGCRYPT not found
+
+This patch installs a copy of libgcrypt.m4 from the libgcrypt source tarball
+to systemd m4 directory.
+
+Libgcrypt uses a custom m4 macro and not pkg-config to check if the
+development files are available. Though libgcrypt support is optional in
+systemd, this macro should be available whenever autoreconf is used, otherwise
+the re-configuration will fail with:
+
+ configure.ac:616: warning: macro 'AM_PATH_LIBGCRYPT' not found in library
+
+As asking the user to install the development package of libgcrypt on the host
+machine or adding libgcrypt as a build dependency to systemd is not
+acceptable, the required file is added to the m4 directory.
+
+Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>
+Index: systemd-213/m4/libgcrypt.m4
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ systemd-213/m4/libgcrypt.m4 2014-06-11 10:41:11.749305509 +0200
+@@ -0,0 +1,123 @@
++dnl Autoconf macros for libgcrypt
++dnl Copyright (C) 2002, 2004 Free Software Foundation, Inc.
++dnl
++dnl This file is free software; as a special exception the author gives
++dnl unlimited permission to copy and/or distribute it, with or without
++dnl modifications, as long as this notice is preserved.
++dnl
++dnl This file is distributed in the hope that it will be useful, but
++dnl WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
++dnl implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
++
++
++dnl AM_PATH_LIBGCRYPT([MINIMUM-VERSION,
++dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
++dnl Test for libgcrypt and define LIBGCRYPT_CFLAGS and LIBGCRYPT_LIBS.
++dnl MINIMUN-VERSION is a string with the version number optionalliy prefixed
++dnl with the API version to also check the API compatibility. Example:
++dnl a MINIMUN-VERSION of 1:1.2.5 won't pass the test unless the installed
++dnl version of libgcrypt is at least 1.2.5 *and* the API number is 1. Using
++dnl this features allows to prevent build against newer versions of libgcrypt
++dnl with a changed API.
++dnl
++AC_DEFUN([AM_PATH_LIBGCRYPT],
++[ AC_ARG_WITH(libgcrypt-prefix,
++ AC_HELP_STRING([--with-libgcrypt-prefix=PFX],
++ [prefix where LIBGCRYPT is installed (optional)]),
++ libgcrypt_config_prefix="$withval", libgcrypt_config_prefix="")
++ if test x$libgcrypt_config_prefix != x ; then
++ if test x${LIBGCRYPT_CONFIG+set} != xset ; then
++ LIBGCRYPT_CONFIG=$libgcrypt_config_prefix/bin/libgcrypt-config
++ fi
++ fi
++
++ AC_PATH_TOOL(LIBGCRYPT_CONFIG, libgcrypt-config, no)
++ tmp=ifelse([$1], ,1:1.2.0,$1)
++ if echo "$tmp" | grep ':' >/dev/null 2>/dev/null ; then
++ req_libgcrypt_api=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\1/'`
++ min_libgcrypt_version=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\2/'`
++ else
++ req_libgcrypt_api=0
++ min_libgcrypt_version="$tmp"
++ fi
++
++ AC_MSG_CHECKING(for LIBGCRYPT - version >= $min_libgcrypt_version)
++ ok=no
++ if test "$LIBGCRYPT_CONFIG" != "no" ; then
++ req_major=`echo $min_libgcrypt_version | \
++ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
++ req_minor=`echo $min_libgcrypt_version | \
++ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
++ req_micro=`echo $min_libgcrypt_version | \
++ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
++ libgcrypt_config_version=`$LIBGCRYPT_CONFIG --version`
++ major=`echo $libgcrypt_config_version | \
++ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
++ minor=`echo $libgcrypt_config_version | \
++ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
++ micro=`echo $libgcrypt_config_version | \
++ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
++ if test "$major" -gt "$req_major"; then
++ ok=yes
++ else
++ if test "$major" -eq "$req_major"; then
++ if test "$minor" -gt "$req_minor"; then
++ ok=yes
++ else
++ if test "$minor" -eq "$req_minor"; then
++ if test "$micro" -ge "$req_micro"; then
++ ok=yes
++ fi
++ fi
++ fi
++ fi
++ fi
++ fi
++ if test $ok = yes; then
++ AC_MSG_RESULT([yes ($libgcrypt_config_version)])
++ else
++ AC_MSG_RESULT(no)
++ fi
++ if test $ok = yes; then
++ # If we have a recent libgcrypt, we should also check that the
++ # API is compatible
++ if test "$req_libgcrypt_api" -gt 0 ; then
++ tmp=`$LIBGCRYPT_CONFIG --api-version 2>/dev/null || echo 0`
++ if test "$tmp" -gt 0 ; then
++ AC_MSG_CHECKING([LIBGCRYPT API version])
++ if test "$req_libgcrypt_api" -eq "$tmp" ; then
++ AC_MSG_RESULT([okay])
++ else
++ ok=no
++ AC_MSG_RESULT([does not match. want=$req_libgcrypt_api got=$tmp])
++ fi
++ fi
++ fi
++ fi
++ if test $ok = yes; then
++ LIBGCRYPT_CFLAGS=`$LIBGCRYPT_CONFIG --cflags`
++ LIBGCRYPT_LIBS=`$LIBGCRYPT_CONFIG --libs`
++ ifelse([$2], , :, [$2])
++ if test x"$host" != x ; then
++ libgcrypt_config_host=`$LIBGCRYPT_CONFIG --host 2>/dev/null || echo none`
++ if test x"$libgcrypt_config_host" != xnone ; then
++ if test x"$libgcrypt_config_host" != x"$host" ; then
++ AC_MSG_WARN([[
++***
++*** The config script $LIBGCRYPT_CONFIG was
++*** built for $libgcrypt_config_host and thus may not match the
++*** used host $host.
++*** You may want to use the configure option --with-libgcrypt-prefix
++*** to specify a matching config script.
++***]])
++ fi
++ fi
++ fi
++ else
++ LIBGCRYPT_CFLAGS=""
++ LIBGCRYPT_LIBS=""
++ ifelse([$3], , :, [$3])
++ fi
++ AC_SUBST(LIBGCRYPT_CFLAGS)
++ AC_SUBST(LIBGCRYPT_LIBS)
++])
# sha256 locally computed
sha256 8b3e99da3d4164b66581830a7f2436c0c8fe697b5fbdc3927bdb960646be0083 systemd-233.tar.gz
-sha256 eed8fef0045876e9efa0ba6725ed9ea93654bf24d67bb5aad467a341ad375883 a924f43f30f9c4acaf70618dd2a055f8b0f166be.patch
-sha256 43c75bd161a8ef0de5db607aaceed77220f2ba4903cf44e7e9db544980420a5e db848813bae4d28c524b3b6a7dad135e426659ce.patch
-sha256 451f7c09332479ebe4ac01612f5f034df4524e16b5bc5d1c8ddcda14e9f3cd69 88795538726a5bbfd9efc13d441cb05e1d7fc139.patch
SYSTEMD_PROVIDES = udev
SYSTEMD_AUTORECONF = YES
-SYSTEMD_PATCH = \
- https://github.com/systemd/systemd/commit/a924f43f30f9c4acaf70618dd2a055f8b0f166be.patch \
- https://github.com/systemd/systemd/commit/db848813bae4d28c524b3b6a7dad135e426659ce.patch \
- https://github.com/systemd/systemd/commit/88795538726a5bbfd9efc13d441cb05e1d7fc139.patch
-
# Make sure that systemd will always be built after busybox so that we have
# a consistent init setup between two builds
ifeq ($(BR2_PACKAGE_BUSYBOX),y)