SHA256
1
0
forked from pool/systemd
systemd/parse-crypttab-for-noauto-option.patch
Dominique Leuenberger a4023d0c37 Accepting request 333777 from Base:System
- Fix patch tty-ask-password-agent-on-console.patch not to crash
  away but enable it to ask on all devices of /dev/console

- Avoid "file not found /etc/udev/rules.d/70-persistent-net.rules"
  waring occurring in %post

- Add patch let-vconsole-setup-get-properties-only-once-to-copy-them.patch
  to avoid broken virtual console mapping due stressed ioctl API
  for the virtual consoles (boo#904214)

- Fix last change that is use the new name for udev packages in %pretrans. 

- restore usage of LUA in %pretrans.

- Try to generate the systemd users and groups always in same order
  to avoid republish other packages (boo#944660) 

- cleanup specfile by removing commands that were dealing with systemd
  pre-generated files: we're now using systemd tarball generated directly
  from the git repo which doesn't contain any of these files.
- there's no point in using LUA in %pretrans

- Drop 0009-make-xsltproc-use-correct-ROFF-links.patch
This patch was initialy added to workaround bsc#842844. But it
appears that man(1) was fixed (included since 13.2 at least) to
handle manual pages that consist only of a .so directive such as
'.so <page>'.

- Change use-rndaddentropy-ioctl-to-load-random-seed.patch to
  make it work on big endian

OBS-URL: https://build.opensuse.org/request/show/333777
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=223
2015-09-27 12:32:31 +00:00

68 lines
2.2 KiB
Diff

---
src/fstab-generator/fstab-generator.c | 45 +++++++++++++++++++++++++++++++++-
1 file changed, 44 insertions(+), 1 deletion(-)
Index: systemd-221/src/fstab-generator/fstab-generator.c
===================================================================
--- systemd-221.orig/src/fstab-generator/fstab-generator.c
+++ systemd-221/src/fstab-generator/fstab-generator.c
@@ -47,6 +47,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,
@@ -108,7 +151,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)