chiark / gitweb /
ask-password: also accept Backspace as first keypress as silent mode switch
[elogind.git] / src / mount.c
index 8a9ab167210373f0a4cbec4d2bb9665954c68c45..cc49b1993fc2a8bbf3184d531bdf6c7249b38986 100644 (file)
@@ -37,6 +37,7 @@
 #include "special.h"
 #include "bus-errors.h"
 #include "exit-status.h"
+#include "def.h"
 
 static const UnitActiveState state_translation_table[_MOUNT_STATE_MAX] = {
         [MOUNT_DEAD] = UNIT_INACTIVE,
@@ -289,9 +290,13 @@ static int mount_add_target_links(Mount *m) {
 
         noauto = !!mount_test_option(p->options, MNTOPT_NOAUTO);
         nofail = !!mount_test_option(p->options, "nofail");
-        handle = !!mount_test_option(p->options, "comment=systemd.mount") ||
+        handle =
+                mount_test_option(p->options, "comment=systemd.mount") ||
+                mount_test_option(p->options, "x-systemd-mount") ||
                 m->meta.manager->mount_auto;
-        automount = !!mount_test_option(p->options, "comment=systemd.automount");
+        automount =
+                mount_test_option(p->options, "comment=systemd.automount") ||
+                mount_test_option(p->options, "x-systemd-automount");
 
         if (mount_test_option(p->options, "_netdev") ||
             (p->fstype && fstype_is_network(p->fstype))) {
@@ -408,9 +413,22 @@ static int mount_add_default_dependencies(Mount *m) {
 
         if (m->meta.manager->running_as == MANAGER_SYSTEM &&
             !path_equal(m->where, "/")) {
+                MountParameters *p;
 
-                if ((r = unit_add_dependency_by_name(UNIT(m), UNIT_BEFORE, SPECIAL_QUOTACHECK_SERVICE, NULL, true)) < 0)
-                        return r;
+                if (m->from_fragment)
+                        p = &m->parameters_fragment;
+                else if (m->from_etc_fstab)
+                        p = &m->parameters_etc_fstab;
+                else
+                        p = NULL;
+
+                if (!p ||
+                    (!mount_test_option(p->options, "_netdev") &&
+                    !(p->fstype && fstype_is_network(p->fstype)) &&
+                    (mount_test_option(p->options, "usrquota") || mount_test_option(p->options, "grpquota"))))
+                        if ((r = unit_add_two_dependencies_by_name(UNIT(m), UNIT_BEFORE, UNIT_WANTS, SPECIAL_QUOTACHECK_SERVICE, NULL, true)) < 0 ||
+                            (r = unit_add_two_dependencies_by_name(UNIT(m), UNIT_BEFORE, UNIT_WANTS, SPECIAL_QUOTAON_SERVICE, NULL, true)) < 0)
+                                return r;
 
                 if ((r = unit_add_two_dependencies_by_name(UNIT(m), UNIT_BEFORE, UNIT_CONFLICTS, SPECIAL_UMOUNT_TARGET, NULL, true)) < 0)
                         return r;
@@ -826,6 +844,10 @@ static void mount_enter_mounting(Mount *m) {
 
         mkdir_p(m->where, m->directory_mode);
 
+        /* create the source directory for bind-mounts if needed */
+        if (m->parameters_fragment.fstype && strcmp(m->parameters_fragment.fstype, "bind") == 0)
+                mkdir_p(m->parameters_fragment.what, m->directory_mode);
+
         if (m->from_fragment)
                 r = exec_command_set(
                                 m->control_command,