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

Dave Reisner dreisner at archlinux.org
Sun Nov 9 22:03:51 UTC 2014


    Date: Sunday, November 9, 2014 @ 23:03:50
  Author: dreisner
Revision: 225804

upgpkg: systemd 217-6

- backport fix for shutdown sometimes rebooting (FS#42612)
- install ctrl-alt-del.target as a symlink, not a file (FS#42510)
- add "missing" targets in initramfs (FS#42301)

Added:
  systemd/trunk/0001-shutdown-fix-arguments-to-run-initramfs-shutdown.patch
Modified:
  systemd/trunk/PKGBUILD
  systemd/trunk/initcpio-install-systemd

-------------------------------------------------------------+
 0001-shutdown-fix-arguments-to-run-initramfs-shutdown.patch |   68 ++++++++++
 PKGBUILD                                                    |    7 -
 initcpio-install-systemd                                    |   17 +-
 3 files changed, 83 insertions(+), 9 deletions(-)

Added: 0001-shutdown-fix-arguments-to-run-initramfs-shutdown.patch
===================================================================
--- 0001-shutdown-fix-arguments-to-run-initramfs-shutdown.patch	                        (rev 0)
+++ 0001-shutdown-fix-arguments-to-run-initramfs-shutdown.patch	2014-11-09 22:03:50 UTC (rev 225804)
@@ -0,0 +1,68 @@
+From 4b5d8d0f22ae61ceb45a25391354ba53b43ee992 Mon Sep 17 00:00:00 2001
+From: Michal Schmidt <mschmidt at redhat.com>
+Date: Thu, 6 Nov 2014 22:24:13 +0100
+Subject: [PATCH] shutdown: fix arguments to /run/initramfs/shutdown
+
+Our initrd interface specifies that the verb is in argv[1].
+This is where systemd passes it to systemd-shutdown, but getopt
+permutes argv[]. This confuses dracut's shutdown script:
+  Shutdown called with argument '--log-level'. Rebooting!
+
+getopt can be convinced to not permute argv[] by having '-' as the first
+character of optstring. Let's use it. This requires changing the way
+non-option arguments (in our case, the verb) are processed.
+
+This fixes a bug where the system would reboot instead of powering off.
+---
+ src/core/shutdown.c | 17 +++++++++++------
+ 1 file changed, 11 insertions(+), 6 deletions(-)
+
+diff --git a/src/core/shutdown.c b/src/core/shutdown.c
+index dd11ae3..48ed7fa 100644
+--- a/src/core/shutdown.c
++++ b/src/core/shutdown.c
+@@ -75,7 +75,9 @@ static int parse_argv(int argc, char *argv[]) {
+         assert(argc >= 1);
+         assert(argv);
+ 
+-        while ((c = getopt_long(argc, argv, "", options, NULL)) >= 0)
++        /* "-" prevents getopt from permuting argv[] and moving the verb away
++         * from argv[1]. Our interface to initrd promises it'll be there. */
++        while ((c = getopt_long(argc, argv, "-", options, NULL)) >= 0)
+                 switch (c) {
+ 
+                 case ARG_LOG_LEVEL:
+@@ -113,6 +115,13 @@ static int parse_argv(int argc, char *argv[]) {
+ 
+                         break;
+ 
++                case '\001':
++                        if (!arg_verb)
++                                arg_verb = optarg;
++                        else
++                                log_error("Excess arguments, ignoring");
++                        break;
++
+                 case '?':
+                         return -EINVAL;
+ 
+@@ -120,15 +129,11 @@ static int parse_argv(int argc, char *argv[]) {
+                         assert_not_reached("Unhandled option code.");
+                 }
+ 
+-        if (optind >= argc) {
++        if (!arg_verb) {
+                 log_error("Verb argument missing.");
+                 return -EINVAL;
+         }
+ 
+-        arg_verb = argv[optind];
+-
+-        if (optind + 1 < argc)
+-                log_error("Excess arguments, ignoring");
+         return 0;
+ }
+ 
+-- 
+2.1.3
+

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2014-11-09 21:30:28 UTC (rev 225803)
+++ PKGBUILD	2014-11-09 22:03:50 UTC (rev 225804)
@@ -4,7 +4,7 @@
 pkgbase=systemd
 pkgname=('systemd' 'libsystemd' 'systemd-sysvcompat')
 pkgver=217
-pkgrel=5
+pkgrel=6
 arch=('i686' 'x86_64')
 url="http://www.freedesktop.org/wiki/Software/systemd"
 makedepends=('acl' 'cryptsetup' 'docbook-xsl' 'gobject-introspection' 'gperf'
@@ -20,6 +20,7 @@
         '0001-units-don-t-order-journal-flushing-afte-remote-fs.ta.patch'
         '0001-units-order-sd-journal-flush-after-sd-remount-fs.patch'
         '0001-units-make-systemd-journald.service-Type-notify.patch'
+        '0001-shutdown-fix-arguments-to-run-initramfs-shutdown.patch'
         'initcpio-hook-udev'
         'initcpio-install-systemd'
         'initcpio-install-udev')
@@ -31,8 +32,9 @@
          '42ff9d59bb057637355b202157d59991'
          '92497d06e0af615be4b368fe615109c0'
          'a321d62d6ffada9e6976bdd339fa3219'
+         'f72e8d086172177c224f0ce48ef54222'
          '29245f7a240bfba66e2b1783b63b6b40'
-         '455b68a9a15f634dcfdaff2463010d4e'
+         '107c489f27c667be4101aecd3369b355'
          'bde43090d4ac0ef048e3eaee8202a407')
 
 
@@ -46,6 +48,7 @@
   patch -Np1 <../0001-units-don-t-order-journal-flushing-afte-remote-fs.ta.patch
   patch -Np1 <../0001-units-order-sd-journal-flush-after-sd-remount-fs.patch
   patch -Np1 <../0001-units-make-systemd-journald.service-Type-notify.patch
+  patch -Np1 <../0001-shutdown-fix-arguments-to-run-initramfs-shutdown.patch
 }
 
 build() {

Modified: initcpio-install-systemd
===================================================================
--- initcpio-install-systemd	2014-11-09 21:30:28 UTC (rev 225803)
+++ initcpio-install-systemd	2014-11-09 22:03:50 UTC (rev 225804)
@@ -119,7 +119,6 @@
             99-systemd.rules
 
     map add_systemd_unit \
-            ctrl-alt-del.target \
             initrd-cleanup.service \
             initrd-fs.target \
             initrd-parse-etc.service \
@@ -129,26 +128,30 @@
             initrd-udevadm-cleanup-db.service \
             initrd.target \
             kmod-static-nodes.service \
+            local-fs.target \
             local-fs-pre.target \
+            paths.target \
+            slices.target \
             sockets.target \
+            swap.target \
             systemd-fsck at .service \
             systemd-hibernate-resume at .service \
             systemd-journald.service \
+            systemd-journald-dev-log.socket \
             systemd-tmpfiles-setup-dev.service \
             systemd-udev-trigger.service \
             systemd-udevd-control.socket \
             systemd-udevd-kernel.socket \
-            systemd-udevd.service
+            systemd-udevd.service \
+            timers.target
 
     add_symlink "/usr/lib/systemd/system/default.target" "initrd.target"
+    add_symlink "/usr/lib/systemd/system/ctrl-alt-del.target" "reboot.target"
 
-    # libdbus needs the passwd info of the root user
-    # TODO: make sure this is no longer necessary when systemctl moves to sd-bus
+    # udev wants /etc/group since it doesn't launch with --resolve-names=never
     add_file "/etc/nsswitch.conf"
+    add_binary "$(readlink -f /usr/lib/libnss_files.so)"
     add_file "/etc/passwd"
-    add_binary "$(readlink -f /usr/lib/libnss_files.so)"
-
-    # udev wants /etc/group since it doesn't launch with --resolve-names=never
     add_file "/etc/group"
 }
 


More information about the arch-commits mailing list