systemd/storage-after-cryptsetup.patch
Stephan Kulow 823ad04eff Accepting request 139710 from openSUSE:Factory:Staging:Systemd
- Add var-run-lock.patch: make sure /var/run and /var/lock are
  handled as bind mount if they aren't symlinks.
- Update storage-after-cryptsetup.patch with new systemctl path.
- Migrate broken symlinks in /etc/systemd/system due to new systemd
  location.

- Update to release 195:
  + journalctl agained --since and --until, as well as filtering
    for units with --unit=/-u.
  + allow ExecReload properly for Type=oneshot (needed for
    iptables.service, rpc-nfsd.service).
  + journal daemon supports time-based rotation and vaccuming.
  + journalctl -F allow to list all values of a certain field in
    journal database.
  + new commandline clients for timedated, locald and hostnamed
  + new tool systemd-coredumpctl to list and extract coredumps from
    journal.
  + improve gatewayd: follow mode, filtering, support for
    HTML5/JSON Server-Sent-Events.
  + reload support in SysV initscripts is now detected when file is
    parted.
  + "systemctl status --follow" as been removed, use "journalctl -fu
    instead"
  + journald.conf RuntimeMinSize and PersistentMinSize settings
    have been removed.
- Add compatibility symlink for systemd-ask-password and systemctl
  in /bin.

- Add var-run-lock.patch: make sure /var/run and /var/lock are
  handled as bind mount if they aren't symlinks.

OBS-URL: https://build.opensuse.org/request/show/139710
OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=301
2012-10-29 18:55:30 +00:00

104 lines
3.0 KiB
Diff

From b9841589cf16950af7d123ecd128b84464d15a1d Mon Sep 17 00:00:00 2001
From: Frederic Crozat <fcrozat@suse.com>
Date: Mon, 7 Nov 2011 18:04:20 +0100
Subject: [PATCH] force lvm restart after cryptsetup target is reached
---
src/cryptsetup-generator.c | 80 ++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 80 insertions(+), 0 deletions(-)
Index: systemd-194/src/cryptsetup/cryptsetup-generator.c
===================================================================
--- systemd-194.orig/src/cryptsetup/cryptsetup-generator.c
+++ systemd-194/src/cryptsetup/cryptsetup-generator.c
@@ -22,6 +22,7 @@
#include <string.h>
#include <errno.h>
#include <unistd.h>
+#include <stdlib.h>
#include "log.h"
#include "util.h"
@@ -64,6 +65,71 @@ static bool has_option(const char *hayst
return false;
}
+static int create_storage_after_cryptsetup (void) {
+ int r;
+ char *to = NULL, *p = NULL;
+ FILE *f = NULL;
+
+ if (asprintf(&p, "%s/storage-after-cryptsetup.service", arg_dest) < 0) {
+ r = -ENOMEM;
+ log_error("Failed to allocate unit file name.");
+ goto fail;
+ }
+
+ if (!(f = fopen(p, "wxe"))) {
+ r = -errno;
+ log_error("Failed to create unit file: %m");
+ goto fail;
+ }
+
+ fprintf(f,
+ "[Unit]\n"
+ "Description=Restart storage after cryptsetup\n"
+ "DefaultDependencies=no\n"
+ "After=cryptsetup.target\n"
+ "Wants=cryptsetup.target\n"
+ "Before=local-fs.target\n"
+ "Before=shutdown.target\n");
+
+ fprintf(f,
+ "\n[Service]\n"
+ "RemainAfterExit=true\n"
+ "Type=oneshot\n"
+ "TimeoutSec=0\n"
+ "ExecStart=/usr/bin/systemctl restart lvm.service\n");
+
+ fflush(f);
+
+ if (ferror(f)) {
+ r = -errno;
+ log_error("Failed to write file: %m");
+ goto fail;
+ }
+
+ if (asprintf(&to, "%s/local-fs.target.wants/storage-after-cryptsetup.service", arg_dest) < 0) {
+ r = -ENOMEM;
+ goto fail;
+ }
+
+ mkdir_parents(to, 0755);
+
+ if (symlink("../storage-after-cryptsetup.service", to) < 0) {
+ log_error("Failed to create symlink ../storage-after-cryptsetup.service to '%s': %m", to);
+ r = -errno;
+ goto fail;
+ }
+
+ r=0;
+fail:
+ free(p);
+ free(to);
+
+ if (f)
+ fclose(f);
+
+ return r;
+}
+
static int create_disk(
const char *name,
const char *device,
@@ -439,6 +505,9 @@ int main(int argc, char *argv[]) {
free(options);
}
+ if ((r == EXIT_SUCCESS) && (create_storage_after_cryptsetup () < 0))
+ r = EXIT_FAILURE;
+
finish:
if (f)
fclose(f);