From d46259560030851e9a0ea73375779b9bf56e3b92 Mon Sep 17 00:00:00 2001 From: Michishige Kaito Date: Mon, 26 Mar 2018 12:39:00 +0100 Subject: [PATCH] Add support for tarsnap options -H and -L A new option `explicitSymlinks` will set `-H` when creating an archive. This option makes tarsnap follow any symlinks specified explicitly on the commandline, but not any found inside the file tree. A new option `followSymlinks` will set `-L` when creating an archive. This option makes tarsnap follow any symlinks found anywhere in the file tree instead of storing them as-is. --- nixos/modules/services/backup/tarsnap.nix | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/nixos/modules/services/backup/tarsnap.nix b/nixos/modules/services/backup/tarsnap.nix index 59e9d122fb5..c33aeb76cb0 100644 --- a/nixos/modules/services/backup/tarsnap.nix +++ b/nixos/modules/services/backup/tarsnap.nix @@ -238,6 +238,20 @@ in Whether to produce verbose logging output. ''; }; + explicitSymlinks = mkOption { + type = types.bool; + default = false; + description = '' + Whether to follow symlinks specified as archives. + ''; + }; + followSymlinks = mkOption { + type = types.bool; + default = false; + description = '' + Whether to follow all symlinks in archive trees. + ''; + }; }; } )); @@ -304,6 +318,8 @@ in let run = ''tarsnap --configfile "/etc/tarsnap/${name}.conf" \ -c -f "${name}-$(date +"%Y%m%d%H%M%S")" \ ${optionalString cfg.verbose "-v"} \ + ${optionalString cfg.explicitSymlinks "-H"} \ + ${optionalString cfg.followSymlinks "-L"} \ ${concatStringsSep " " cfg.directories}''; in if (cfg.cachedir != null) then '' mkdir -p ${cfg.cachedir}