tarsnap service: add 'verbose' config option (#25353)

This commit is contained in:
Renzo Carbonara 2017-05-01 17:09:45 +02:00 committed by Joachim F
parent b69d04c798
commit 9a5916dc47

View File

@ -230,6 +230,14 @@ in
Download bandwidth rate limit in bytes. Download bandwidth rate limit in bytes.
''; '';
}; };
verbose = mkOption {
type = types.bool;
default = false;
description = ''
Whether to produce verbose logging output.
'';
};
}; };
} }
)); ));
@ -293,7 +301,10 @@ in
''; '';
script = script =
let run = ''tarsnap --configfile "/etc/tarsnap/${name}.conf" -c -f "${name}-$(date +"%Y%m%d%H%M%S")" ${concatStringsSep " " cfg.directories}''; let run = ''tarsnap --configfile "/etc/tarsnap/${name}.conf" \
-c -f "${name}-$(date +"%Y%m%d%H%M%S")" \
${optionalString cfg.verbose "-v"} \
${concatStringsSep " " cfg.directories}'';
in if (cfg.cachedir != null) then '' in if (cfg.cachedir != null) then ''
mkdir -p ${cfg.cachedir} mkdir -p ${cfg.cachedir}
chmod 0700 ${cfg.cachedir} chmod 0700 ${cfg.cachedir}