summaryrefslogtreecommitdiffstats
path: root/src/home/homework-mount.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2021-11-05 15:26:29 +0100
committerLennart Poettering <lennart@poettering.net>2021-11-12 17:34:31 +0100
commit6309512c0239bd2c78b099c185b38c15fd096153 (patch)
tree7d0a5fe108f5cd8e6f3e81485401bddb12e57498 /src/home/homework-mount.c
parenthomework: default to btrfs compression (diff)
downloadsystemd-6309512c0239bd2c78b099c185b38c15fd096153.tar.xz
systemd-6309512c0239bd2c78b099c185b38c15fd096153.zip
homed: add env var for overriding default mount options
This adds an esay way to override the default mount options to use for LUKS home dirs via the env vars SYSTEMD_HOME_MOUNT_OPTIONS_EXT4, SYSTEMD_HOME_MOUNT_OPTIONS_BTRFS, SYSTEMD_HOME_MOUNT_OPTIONS_XFS. See: #15120
Diffstat (limited to 'src/home/homework-mount.c')
-rw-r--r--src/home/homework-mount.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/home/homework-mount.c b/src/home/homework-mount.c
index d73a908f1c..234b965dc8 100644
--- a/src/home/homework-mount.c
+++ b/src/home/homework-mount.c
@@ -20,6 +20,17 @@
#include "user-util.h"
static const char *mount_options_for_fstype(const char *fstype) {
+ const char *e;
+ char *n;
+
+ assert(fstype);
+
+ /* Allow overriding our built-in defaults with an environment variable */
+ n = strjoina("SYSTEMD_HOME_MOUNT_OPTIONS_", fstype);
+ e = getenv(ascii_strupper(n));
+ if (e)
+ return e;
+
if (streq(fstype, "ext4"))
return "noquota,user_xattr";
if (streq(fstype, "xfs"))