diff --git a/man/systemd-quotacheck@.service.xml b/man/systemd-quotacheck@.service.xml
index 503df381e0..56397ff7bd 100644
--- a/man/systemd-quotacheck@.service.xml
+++ b/man/systemd-quotacheck@.service.xml
@@ -62,6 +62,32 @@
+
+ Credentials
+
+ systemd-quotacheck supports the service credentials logic as implemented by
+ ImportCredential=/LoadCredential=/SetCredential=
+ (see systemd.exec5 for
+ details). The following credentials are used when passed in:
+
+
+
+ quotacheck.mode
+
+
+ The contents of the credential is parsed as same as the kernel command line option with the
+ same name. See above for more details.
+
+
+
+
+
+
+ Note that by default the systemd-quotacheck@.service and
+ systemd-quotacheck-root.service unit files are set up to inherit
+ quotacheck.mode credential from the service manager.
+
+
See Also
diff --git a/man/systemd.system-credentials.xml b/man/systemd.system-credentials.xml
index 0411061ca3..fd0d12320d 100644
--- a/man/systemd.system-credentials.xml
+++ b/man/systemd.system-credentials.xml
@@ -524,6 +524,19 @@
+
+
+ quotacheck.*
+
+
+ Read by systemd-quotacheck@.service and
+ systemd-quotacheck-root.service. See
+ systemd-quotacheck8
+ for more details.
+
+
+
+
diff --git a/src/quotacheck/quotacheck.c b/src/quotacheck/quotacheck.c
index 49d63d77d0..f686621348 100644
--- a/src/quotacheck/quotacheck.c
+++ b/src/quotacheck/quotacheck.c
@@ -3,6 +3,7 @@
#include
#include
+#include "creds-util.h"
#include "log.h"
#include "main-func.h"
#include "proc-cmdline.h"
@@ -45,6 +46,20 @@ static int parse_proc_cmdline_item(const char *key, const char *value, void *dat
return 0;
}
+static void parse_credentials(void) {
+ _cleanup_free_ char *value = NULL;
+ int r;
+
+ r = read_credential("quotacheck.mode", (void**) &value, /* ret_size = */ NULL);
+ if (r < 0)
+ log_debug_errno(r, "Failed to read credential 'quotacheck.mode', ignoring: %m");
+ else {
+ arg_mode = quota_check_mode_from_string(value);
+ if (arg_mode < 0)
+ log_warning_errno(arg_mode, "Invalid 'quotacheck.mode' credential, ignoring: %s", value);
+ }
+}
+
static int run(int argc, char *argv[]) {
int r;
@@ -60,6 +75,8 @@ static int run(int argc, char *argv[]) {
if (r < 0)
log_warning_errno(r, "Failed to parse kernel command line, ignoring: %m");
+ parse_credentials();
+
if (arg_mode == QUOTA_CHECK_SKIP)
return 0;
diff --git a/units/systemd-quotacheck-root.service.in b/units/systemd-quotacheck-root.service.in
index 4792e5bdd5..eea656c562 100644
--- a/units/systemd-quotacheck-root.service.in
+++ b/units/systemd-quotacheck-root.service.in
@@ -23,3 +23,4 @@ Type=oneshot
RemainAfterExit=yes
ExecStart={{LIBEXECDIR}}/systemd-quotacheck /
TimeoutSec=infinity
+ImportCredential=quotacheck.*
diff --git a/units/systemd-quotacheck@.service.in b/units/systemd-quotacheck@.service.in
index b38450ed09..7569052d82 100644
--- a/units/systemd-quotacheck@.service.in
+++ b/units/systemd-quotacheck@.service.in
@@ -25,3 +25,4 @@ Type=oneshot
RemainAfterExit=yes
ExecStart={{LIBEXECDIR}}/systemd-quotacheck %f
TimeoutSec=infinity
+ImportCredential=quotacheck.*