</variablelist>
</refsect1>
+ <refsect1>
+ <title>Credentials</title>
+
+ <para><command>systemd-quotacheck</command> supports the service credentials logic as implemented by
+ <varname>ImportCredential=</varname>/<varname>LoadCredential=</varname>/<varname>SetCredential=</varname>
+ (see <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry> for
+ details). The following credentials are used when passed in:</para>
+
+ <variablelist class='system-credentials'>
+ <varlistentry>
+ <term><varname>quotacheck.mode</varname></term>
+
+ <listitem>
+ <para>The contents of the credential is parsed as same as the kernel command line option with the
+ same name. See above for more details.</para>
+
+ <xi:include href="version-info.xml" xpointer="v258"/>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+
+ <para>Note that by default the <filename>systemd-quotacheck@.service</filename> and
+ <filename>systemd-quotacheck-root.service</filename> unit files are set up to inherit
+ <varname>quotacheck.mode</varname> credential from the service manager.</para>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<para><simplelist type="inline">
<xi:include href="version-info.xml" xpointer="v258"/>
</listitem>
</varlistentry>
+
+ <varlistentry>
+ <term><varname>quotacheck.*</varname></term>
+
+ <listitem>
+ <para>Read by <filename>systemd-quotacheck@.service</filename> and
+ <filename>systemd-quotacheck-root.service</filename>. See
+ <citerefentry><refentrytitle>systemd-quotacheck</refentrytitle><manvolnum>8</manvolnum></citerefentry>
+ for more details.</para>
+
+ <xi:include href="version-info.xml" xpointer="v258"/>
+ </listitem>
+ </varlistentry>
</variablelist>
</refsect1>
#include <sys/stat.h>
#include <unistd.h>
+#include "creds-util.h"
#include "log.h"
#include "main-func.h"
#include "proc-cmdline.h"
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;
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;
RemainAfterExit=yes
ExecStart={{LIBEXECDIR}}/systemd-quotacheck /
TimeoutSec=infinity
+ImportCredential=quotacheck.*
RemainAfterExit=yes
ExecStart={{LIBEXECDIR}}/systemd-quotacheck %f
TimeoutSec=infinity
+ImportCredential=quotacheck.*