From 8abd65e058aca0d83bda535a211f9c9246b1a171 Mon Sep 17 00:00:00 2001 From: Michael Walker Date: Sun, 15 Dec 2024 12:32:12 +0000 Subject: [PATCH] Use RuntimeDirectory forbookdb-remote-sync-send --- shared/bookdb/remote-sync-send.nix | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/shared/bookdb/remote-sync-send.nix b/shared/bookdb/remote-sync-send.nix index ee0b9360..37056d49 100644 --- a/shared/bookdb/remote-sync-send.nix +++ b/shared/bookdb/remote-sync-send.nix @@ -15,11 +15,13 @@ let ExecStart = pkgs.writeShellScript "bookdb-sync" '' set -ex - /run/wrappers/bin/sudo ${pkgs.coreutils}/bin/cp -r ${config.systemd.services.bookdb.environment.BOOKDB_UPLOADS_DIR}/ ~/bookdb-covers - trap "/run/wrappers/bin/sudo ${pkgs.coreutils}/bin/rm -rf ~/bookdb-covers" EXIT + cd $RUNTIME_DIRECTORY + + /run/wrappers/bin/sudo ${pkgs.coreutils}/bin/cp -r ${config.systemd.services.bookdb.environment.BOOKDB_UPLOADS_DIR}/ bookdb-covers + trap "/run/wrappers/bin/sudo ${pkgs.coreutils}/bin/rm -rf bookdb-covers" EXIT rsync -az\ -e "ssh -i $SSH_KEY_FILE -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" \ - ~/bookdb-covers/ \ + bookdb-covers/ \ bookdb-remote-sync-receive@${target}:~/bookdb-covers/ ssh -i "$SSH_KEY_FILE" \ -o UserKnownHostsFile=/dev/null \ @@ -36,6 +38,7 @@ let receive-elasticsearch ''; User = config.users.users.bookdb-remote-sync-send.name; + RuntimeDirectory = "bookdb-sync-${target}"; }; environment = { ES_HOST = config.systemd.services.bookdb.environment.ES_HOST; @@ -48,8 +51,6 @@ in config = mkIf cfg.enable { users.users.bookdb-remote-sync-send = { uid = 985; - home = "/var/lib/bookdb-remote-sync-send"; - createHome = true; isSystemUser = true; shell = pkgs.bashInteractive; group = "nogroup";