forked from pool/systemd
8b6afdd7bf
- Reinstate and improve (remove huge indents from) tty-ask-password-agent-on-console.patch, 0014-journald-with-journaling-FS.patch, rootsymlink_generator. OBS-URL: https://build.opensuse.org/request/show/286310 OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=847
68 lines
2.1 KiB
Diff
68 lines
2.1 KiB
Diff
---
|
|
src/fstab-generator/fstab-generator.c | 45 +++++++++++++++++++++++++++++++++-
|
|
1 file changed, 44 insertions(+), 1 deletion(-)
|
|
|
|
Index: systemd/src/fstab-generator/fstab-generator.c
|
|
===================================================================
|
|
--- systemd.orig/src/fstab-generator/fstab-generator.c
|
|
+++ systemd/src/fstab-generator/fstab-generator.c
|
|
@@ -48,6 +48,49 @@ static char *arg_usr_what = NULL;
|
|
static char *arg_usr_fstype = NULL;
|
|
static char *arg_usr_options = NULL;
|
|
|
|
+static int check_crypttab(const char *what) {
|
|
+ _cleanup_fclose_ FILE *f = NULL;
|
|
+ unsigned n = 0;
|
|
+
|
|
+ f = fopen("/etc/crypttab", "re");
|
|
+ if (!f) {
|
|
+ if (errno != ENOENT)
|
|
+ log_error("Failed to open /etc/crypttab: %m");
|
|
+
|
|
+ return 1;
|
|
+ }
|
|
+
|
|
+
|
|
+ for (;;) {
|
|
+ char line[LINE_MAX], *l;
|
|
+ _cleanup_free_ char *name = NULL, *device = NULL, *password = NULL, *options = NULL;
|
|
+ int k;
|
|
+
|
|
+ if (!fgets(line, sizeof(line), f))
|
|
+ break;
|
|
+
|
|
+ n++;
|
|
+
|
|
+ l = strstrip(line);
|
|
+ if (*l == '#' || *l == 0)
|
|
+ continue;
|
|
+
|
|
+ k = sscanf(l, "%ms %ms %ms %ms", &name, &device, &password, &options);
|
|
+ if (k < 2 || k > 4) {
|
|
+ log_error("Failed to parse /etc/crypttab:%u, ignoring.", n);
|
|
+ continue;
|
|
+ }
|
|
+
|
|
+ if (strcmp((what + 12), name) == 0) {
|
|
+ if (options && strstr(options, "noauto"))
|
|
+ return 0;
|
|
+
|
|
+ return 1;
|
|
+ }
|
|
+ }
|
|
+ return 1;
|
|
+}
|
|
+
|
|
static int add_swap(
|
|
const char *what,
|
|
struct mntent *me,
|
|
@@ -118,7 +161,7 @@ static int add_swap(
|
|
if (r < 0)
|
|
return r;
|
|
|
|
- if (!noauto) {
|
|
+ if (!noauto && check_crypttab(what) != 0) {
|
|
lnk = strjoin(arg_dest, "/" SPECIAL_SWAP_TARGET,
|
|
nofail ? ".wants/" : ".requires/", name, NULL);
|
|
if (!lnk)
|