summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas Weißschuh <thomas@t-8ch.de>2013-03-29 22:01:11 +0000
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-04-01 00:37:48 -0400
commit9ece938a676eb80a9d6834c1957b85b884419f8b (patch)
tree9dad8984f30cb95643038776da4ba4fb2b8e56f4 /src
parentd7607eac6318ae8ff1c00ef5705fd55a614cd495 (diff)
cryptsetup: RequiresMountsFor if source is a file
Fixes: https://bugzilla.novell.com/show_bug.cgi?id=730496 https://bugs.freedesktop.org/show_bug.cgi?id=60821
Diffstat (limited to 'src')
-rw-r--r--src/cryptsetup/cryptsetup-generator.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/cryptsetup/cryptsetup-generator.c b/src/cryptsetup/cryptsetup-generator.c
index 8959bf51c8..a8c856f7df 100644
--- a/src/cryptsetup/cryptsetup-generator.c
+++ b/src/cryptsetup/cryptsetup-generator.c
@@ -102,18 +102,17 @@ static int create_disk(
return -errno;
}
- fprintf(f,
+ fputs(
"# Automatically generated by systemd-cryptsetup-generator\n\n"
"[Unit]\n"
- "Description=Cryptography Setup for %%I\n"
+ "Description=Cryptography Setup for %I\n"
"Documentation=man:systemd-cryptsetup@.service(8) man:crypttab(5)\n"
"SourcePath=/etc/crypttab\n"
"Conflicts=umount.target\n"
"DefaultDependencies=no\n"
- "BindsTo=%s dev-mapper-%%i.device\n"
- "After=systemd-readahead-collect.service systemd-readahead-replay.service %s\n"
- "Before=umount.target\n",
- d, d);
+ "BindsTo=dev-mapper-%i.device\n"
+ "After=systemd-readahead-collect.service systemd-readahead-replay.service\n",
+ f);
if (!nofail)
fprintf(f,
@@ -126,6 +125,17 @@ static int create_disk(
else
fputs("Before=local-fs.target\n", f);
+ if (is_device_path(u))
+ fprintf(f,
+ "BindsTo=%s\n"
+ "After=%s\n"
+ "Before=umount.target\n",
+ d, d);
+ else
+ fprintf(f,
+ "RequiresMountsFor=%s\n",
+ u);
+
fprintf(f,
"\n[Service]\n"
"Type=oneshot\n"