From 005daeed2bcf665a5bdf268b4a18ea923c9de527 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 5 Nov 2021 18:03:05 +0100 Subject: homed: add env var to override dir where we fine stored user records This adds an env var which we can use to redirect where homed stores and looks for user records kept on the host. This is useful for debugging purposes so that one can easily run another homed instnce that doesn't interfere with the main instance. --- src/home/homed-home.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/home/homed-home.c') diff --git a/src/home/homed-home.c b/src/home/homed-home.c index c111bfa782..10bb96a797 100644 --- a/src/home/homed-home.c +++ b/src/home/homed-home.c @@ -300,9 +300,9 @@ int home_save_record(Home *h) { return r; (void) mkdir("/var/lib/systemd/", 0755); - (void) mkdir("/var/lib/systemd/home/", 0700); + (void) mkdir(home_record_dir(), 0700); - fn = strjoina("/var/lib/systemd/home/", h->user_name, ".identity"); + fn = strjoina(home_record_dir(), "/", h->user_name, ".identity"); r = write_string_file(fn, text, WRITE_STRING_FILE_ATOMIC|WRITE_STRING_FILE_CREATE|WRITE_STRING_FILE_MODE_0600|WRITE_STRING_FILE_SYNC); if (r < 0) @@ -316,7 +316,7 @@ int home_unlink_record(Home *h) { assert(h); - fn = strjoina("/var/lib/systemd/home/", h->user_name, ".identity"); + fn = strjoina(home_record_dir(), "/", h->user_name, ".identity"); if (unlink(fn) < 0 && errno != ENOENT) return -errno; -- cgit v1.2.3