[arch-commits] Commit in systemd/trunk (4 files)

Thomas Bächler thomas at nymeria.archlinux.org
Sun Sep 29 20:22:14 UTC 2013


    Date: Sunday, September 29, 2013 @ 22:22:13
  Author: thomas
Revision: 195281

upgpkg: systemd 207-6 - add a few more upstream patches

7ab064a6d60c cryptsetup-generator: allow specifying options in /proc/cmdline
ecd1e54ca6bf man: document luks.options kernel commandline
3cf0f8f7e0b9 udev-rules: avoid erroring on trailing whitespace

Added:
  systemd/trunk/0001-cryptsetup-generator-allow-specifying-options-in-pro.patch
  systemd/trunk/0001-man-document-luks.options-kernel-commandline.patch
  systemd/trunk/0001-udev-rules-avoid-erroring-on-trailing-whitespace.patch
Modified:
  systemd/trunk/PKGBUILD

-----------------------------------------------------------------+
 0001-cryptsetup-generator-allow-specifying-options-in-pro.patch |  190 ++++++++++
 0001-man-document-luks.options-kernel-commandline.patch         |   28 +
 0001-udev-rules-avoid-erroring-on-trailing-whitespace.patch     |   32 +
 PKGBUILD                                                        |   15 
 4 files changed, 262 insertions(+), 3 deletions(-)

Added: 0001-cryptsetup-generator-allow-specifying-options-in-pro.patch
===================================================================
--- 0001-cryptsetup-generator-allow-specifying-options-in-pro.patch	                        (rev 0)
+++ 0001-cryptsetup-generator-allow-specifying-options-in-pro.patch	2013-09-29 20:22:13 UTC (rev 195281)
@@ -0,0 +1,190 @@
+From 7ab064a6d60cf805765077b67d56c123f9cf3c58 Mon Sep 17 00:00:00 2001
+From: Tom Gundersen <teg at jklm.no>
+Date: Sun, 18 Aug 2013 14:59:00 +0800
+Subject: [PATCH] cryptsetup-generator: allow specifying options in
+ /proc/cmdline
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+The main usecase for this is to make it possible to use cryptsetup in
+the initrd without it having to include a host-specific /etc/crypttab.
+
+Tested-by: Thomas Bächler <thomas at archlinux.org>
+---
+ man/systemd-cryptsetup-generator.xml  | 23 ++++++++++
+ src/cryptsetup/cryptsetup-generator.c | 79 +++++++++++++++++++++++++++++++++--
+ 2 files changed, 98 insertions(+), 4 deletions(-)
+
+diff --git a/man/systemd-cryptsetup-generator.xml b/man/systemd-cryptsetup-generator.xml
+index 215ac2d..d6b7e49 100644
+--- a/man/systemd-cryptsetup-generator.xml
++++ b/man/systemd-cryptsetup-generator.xml
+@@ -137,6 +137,29 @@
+                                 will be activated in the initrd or the real root.</para>
+                                 </listitem>
+                         </varlistentry>
++
++                        <varlistentry>
++                                <term><varname>luks.options=</varname></term>
++                                <term><varname>rd.luks.options=</varname></term>
++
++                                <listitem><para>Takes a LUKS super
++                                block UUID followed by an '=' and a string
++                                of options separated by commas as argument.
++                                This will override the options for the given
++                                UUID.</para>
++                                <para>If only a list of options, without an
++                                UUID, is specified, they apply to any UUIDs not
++                                specified elsewhere, and without an entry in
++                                /etc/crypttab.</para><para>
++                                <varname>rd.luks.options=</varname>
++                                is honored only by initial RAM disk
++                                (initrd) while
++                                <varname>luks.options=</varname> is
++                                honored by both the main system and
++                                the initrd.</para>
++                                </listitem>
++                        </varlistentry>
++
+                         <varlistentry>
+                                 <term><varname>luks.key=</varname></term>
+                                 <term><varname>rd.luks.key=</varname></term>
+diff --git a/src/cryptsetup/cryptsetup-generator.c b/src/cryptsetup/cryptsetup-generator.c
+index 967c5e6..ba6efa6 100644
+--- a/src/cryptsetup/cryptsetup-generator.c
++++ b/src/cryptsetup/cryptsetup-generator.c
+@@ -240,7 +240,7 @@ static int create_disk(
+         return 0;
+ }
+ 
+-static int parse_proc_cmdline(char ***arg_proc_cmdline_disks, char **arg_proc_cmdline_keyfile) {
++static int parse_proc_cmdline(char ***arg_proc_cmdline_disks, char ***arg_proc_cmdline_options, char **arg_proc_cmdline_keyfile) {
+         _cleanup_free_ char *line = NULL;
+         char *w = NULL, *state = NULL;
+         int r;
+@@ -307,7 +307,20 @@ static int parse_proc_cmdline(char ***arg_proc_cmdline_disks, char **arg_proc_cm
+                                         return log_oom();
+                         }
+ 
++                } else if (startswith(word, "luks.options=")) {
++                        if (strv_extend(arg_proc_cmdline_options, word + 13) < 0)
++                                return log_oom();
++
++                } else if (startswith(word, "rd.luks.options=")) {
++
++                        if (in_initrd()) {
++                                if (strv_extend(arg_proc_cmdline_options, word + 16) < 0)
++                                        return log_oom();
++                        }
++
+                 } else if (startswith(word, "luks.key=")) {
++                        if (*arg_proc_cmdline_keyfile)
++                                free(*arg_proc_cmdline_keyfile);
+                         *arg_proc_cmdline_keyfile = strdup(word + 9);
+                         if (!*arg_proc_cmdline_keyfile)
+                                 return log_oom();
+@@ -337,6 +350,7 @@ static int parse_proc_cmdline(char ***arg_proc_cmdline_disks, char **arg_proc_cm
+ int main(int argc, char *argv[]) {
+         _cleanup_strv_free_ char **arg_proc_cmdline_disks_done = NULL;
+         _cleanup_strv_free_ char **arg_proc_cmdline_disks = NULL;
++        _cleanup_strv_free_ char **arg_proc_cmdline_options = NULL;
+         _cleanup_free_ char *arg_proc_cmdline_keyfile = NULL;
+         _cleanup_fclose_ FILE *f = NULL;
+         unsigned n = 0;
+@@ -357,7 +371,7 @@ int main(int argc, char *argv[]) {
+ 
+         umask(0022);
+ 
+-        if (parse_proc_cmdline(&arg_proc_cmdline_disks, &arg_proc_cmdline_keyfile) < 0)
++        if (parse_proc_cmdline(&arg_proc_cmdline_disks, &arg_proc_cmdline_options, &arg_proc_cmdline_keyfile) < 0)
+                 return EXIT_FAILURE;
+ 
+         if (!arg_enabled)
+@@ -412,6 +426,26 @@ int main(int argc, char *argv[]) {
+                                 continue;
+                         }
+ 
++                        if (arg_proc_cmdline_options) {
++                                /*
++                                  If options are specified on the kernel commandline, let them override
++                                  the ones from crypttab.
++                                */
++                                STRV_FOREACH(i, arg_proc_cmdline_options) {
++                                        _cleanup_free_ char *proc_uuid = NULL, *proc_options = NULL;
++                                        const char *p = *i;
++
++                                        k = sscanf(p, "%m[0-9a-fA-F-]=%ms", &proc_uuid, &proc_options);
++                                        if (k == 2 && streq(proc_uuid, device + 5)) {
++                                                if (options)
++                                                        free(options);
++                                                options = strdup(p);
++                                                if (!proc_options)
++                                                        return log_oom();
++                                        }
++                                }
++                        }
++
+                         if (arg_proc_cmdline_disks) {
+                                 /*
+                                   If luks UUIDs are specified on the kernel command line, use them as a filter
+@@ -452,7 +486,7 @@ next:
+                   on the kernel command line and not yet written.
+                 */
+ 
+-                _cleanup_free_ char *name = NULL, *device = NULL;
++                _cleanup_free_ char *name = NULL, *device = NULL, *options = NULL;
+                 const char *p = *i;
+ 
+                 if (startswith(p, "luks-"))
+@@ -467,7 +501,44 @@ next:
+                 if (!name || !device)
+                         return log_oom();
+ 
+-                if (create_disk(name, device, arg_proc_cmdline_keyfile, "timeout=0") < 0)
++                if (arg_proc_cmdline_options) {
++                        /*
++                          If options are specified on the kernel commandline, use them.
++                        */
++                        char **j;
++
++                        STRV_FOREACH(j, arg_proc_cmdline_options) {
++                                _cleanup_free_ char *proc_uuid = NULL, *proc_options = NULL;
++                                const char *s = *j;
++                                int k;
++
++                                k = sscanf(s, "%m[0-9a-fA-F-]=%ms", &proc_uuid, &proc_options);
++                                if (k == 2) {
++                                        if (streq(proc_uuid, device + 5)) {
++                                                if (options)
++                                                        free(options);
++                                                options = strdup(proc_options);
++                                                if (!options)
++                                                        return log_oom();
++                                        }
++                                } else if (!options) {
++                                        /*
++                                          Fall back to options without a specified UUID
++                                        */
++                                        options = strdup(s);
++                                        if (!options)
++                                                return log_oom();
++                                }
++                        }
++                }
++
++                if (!options) {
++                        options = strdup("timeout=0");
++                        if (!options)
++                                return log_oom();
++                }
++
++                if (create_disk(name, device, arg_proc_cmdline_keyfile, options) < 0)
+                         r = EXIT_FAILURE;
+         }
+ 
+-- 
+1.8.4
+

Added: 0001-man-document-luks.options-kernel-commandline.patch
===================================================================
--- 0001-man-document-luks.options-kernel-commandline.patch	                        (rev 0)
+++ 0001-man-document-luks.options-kernel-commandline.patch	2013-09-29 20:22:13 UTC (rev 195281)
@@ -0,0 +1,28 @@
+From ecd1e54ca6bf18a6da5f171b1ae24deac0fa7c87 Mon Sep 17 00:00:00 2001
+From: Tom Gundersen <teg at jklm.no>
+Date: Fri, 13 Sep 2013 21:03:55 +0200
+Subject: [PATCH] man: document luks.options kernel commandline
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+This should have been part of commit 7ab064a6d
+---
+ man/kernel-command-line.xml | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/man/kernel-command-line.xml b/man/kernel-command-line.xml
+index a4b7d13..cc267a3 100644
+--- a/man/kernel-command-line.xml
++++ b/man/kernel-command-line.xml
+@@ -250,6 +250,8 @@
+                                 <term><varname>rd.luks.crypttab=</varname></term>
+                                 <term><varname>luks.uuid=</varname></term>
+                                 <term><varname>rd.luks.uuid=</varname></term>
++                                <term><varname>luks.options=</varname></term>
++                                <term><varname>rd.luks.options=</varname></term>
+                                 <term><varname>luks.key=</varname></term>
+                                 <term><varname>rd.luks.key=</varname></term>
+ 
+-- 
+1.8.4
+

Added: 0001-udev-rules-avoid-erroring-on-trailing-whitespace.patch
===================================================================
--- 0001-udev-rules-avoid-erroring-on-trailing-whitespace.patch	                        (rev 0)
+++ 0001-udev-rules-avoid-erroring-on-trailing-whitespace.patch	2013-09-29 20:22:13 UTC (rev 195281)
@@ -0,0 +1,32 @@
+From 3cf0f8f7e0b950b5f6d678f3e8b7f0fc0f52d4bf Mon Sep 17 00:00:00 2001
+From: Dave Reisner <dreisner at archlinux.org>
+Date: Mon, 16 Sep 2013 11:22:35 -0400
+Subject: [PATCH] udev-rules: avoid erroring on trailing whitespace
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+https://bugs.archlinux.org/task/36950
+---
+ src/udev/udev-rules.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c
+index f14158b..6f8b127 100644
+--- a/src/udev/udev-rules.c
++++ b/src/udev/udev-rules.c
+@@ -1068,6 +1068,12 @@ static int add_rule(struct udev_rules *rules, char *line,
+                 enum operation_type op;
+ 
+                 if (get_key(rules->udev, &linepos, &key, &op, &value) != 0) {
++                        /* Avoid erroring on trailing whitespace. This is probably rare
++                         * so save the work for the error case instead of always trying
++                         * to strip the trailing whitespace with strstrip(). */
++                        while (isblank(*linepos))
++                                linepos++;
++
+                         /* If we aren't at the end of the line, this is a parsing error.
+                          * Make a best effort to describe where the problem is. */
+                         if (*linepos != '\n') {
+-- 
+1.8.4
+

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2013-09-29 19:55:44 UTC (rev 195280)
+++ PKGBUILD	2013-09-29 20:22:13 UTC (rev 195281)
@@ -4,7 +4,7 @@
 pkgbase=systemd
 pkgname=('systemd' 'systemd-sysvcompat')
 pkgver=207
-pkgrel=5
+pkgrel=6
 arch=('i686' 'x86_64')
 url="http://www.freedesktop.org/wiki/Software/systemd"
 makedepends=('acl' 'cryptsetup' 'dbus-core' 'docbook-xsl' 'gobject-introspection' 'gperf'
@@ -17,7 +17,10 @@
         'initcpio-install-udev'
         0001-polkit-Avoid-race-condition-in-scraping-proc.patch
         0001-swap-fix-reverse-dependencies.patch
-        0002-swap-create-.wants-symlink-to-auto-swap-devices.patch)
+        0002-swap-create-.wants-symlink-to-auto-swap-devices.patch
+        0001-cryptsetup-generator-allow-specifying-options-in-pro.patch
+        0001-man-document-luks.options-kernel-commandline.patch
+        0001-udev-rules-avoid-erroring-on-trailing-whitespace.patch)
 md5sums=('7799f3cc9d289b8db1c1fa56ae7ecd88'
          '29245f7a240bfba66e2b1783b63b6b40'
          '8b68b0218a3897d4d37a6ccf47914774'
@@ -24,7 +27,10 @@
          'bde43090d4ac0ef048e3eaee8202a407'
          '9eb0a46aa2a3a6d74117f9a174dbe168'
          '182be4c729aaecde249b7b05b48a481f'
-         'b54fbe35e2689ac36cda9ac4a5a86f24')
+         'b54fbe35e2689ac36cda9ac4a5a86f24'
+         '20e65eefdffe384edc4acebe9e01c873'
+         '9fb76e01f41beb60e331908f7f1e04bc'
+         '1f0bfc22e09b9dfe53f4485fab7af2ee')
 
 prepare() {
   cd "$pkgname-$pkgver"
@@ -32,6 +38,9 @@
   patch -Np1 <"$srcdir"/0001-swap-fix-reverse-dependencies.patch
   patch -Np1 <"$srcdir"/0002-swap-create-.wants-symlink-to-auto-swap-devices.patch
   patch -Np1 <"$srcdir"/0001-polkit-Avoid-race-condition-in-scraping-proc.patch
+  patch -Np1 <"$srcdir"/0001-cryptsetup-generator-allow-specifying-options-in-pro.patch
+  patch -Np1 <"$srcdir"/0001-man-document-luks.options-kernel-commandline.patch
+  patch -Np1 <"$srcdir"/0001-udev-rules-avoid-erroring-on-trailing-whitespace.patch
 }
 
 build() {




More information about the arch-commits mailing list