···
requires = [ "network-online.target" ];
after = [ "network-online.target" ];
307
-
path = [ pkgs.iputils pkgs.tarsnap pkgs.utillinux ];
307
+
path = with pkgs; [ iputils tarsnap utillinux ];
# In order for the persistent tarsnap timer to work reliably, we have to
# make sure that the tarsnap server is reachable after systemd starts up
···
while ! ping -q -c 1 v1-0-0-server.tarsnap.com &> /dev/null; do sleep 3; done
318
-
let run = ''tarsnap --configfile "/etc/tarsnap/${name}.conf" \
319
-
-c -f "${name}-$(date +"%Y%m%d%H%M%S")" \
318
+
tarsnap = ''tarsnap --configfile "/etc/tarsnap/${name}.conf"'';
319
+
run = ''${tarsnap} -c -f "${name}-$(date +"%Y%m%d%H%M%S")" \
${optionalString cfg.verbose "-v"} \
${optionalString cfg.explicitSymlinks "-H"} \
${optionalString cfg.followSymlinks "-L"} \
···
if [ ! -e ${cfg.cachedir}/firstrun ]; then
332
-
tarsnap --configfile "/etc/tarsnap/${name}.conf" --fsck
) 10>${cfg.cachedir}/firstrun
···
description = "Tarsnap restore '${name}'";
requires = [ "network-online.target" ];
354
-
path = [ pkgs.iputils pkgs.tarsnap pkgs.utillinux ];
358
-
while ! ping -q -c 1 v1-0-0-server.tarsnap.com &> /dev/null; do sleep 3; done
354
+
path = with pkgs; [ iputils tarsnap utillinux ];
tarsnap = ''tarsnap --configfile "/etc/tarsnap/${name}.conf"'';
lastArchive = ''$(${tarsnap} --list-archives | sort | tail -1)'';
run = ''${tarsnap} -x -f "${lastArchive}" ${optionalString cfg.verbose "-v"}'';
367
-
in if (cfg.cachedir != null) then ''
368
-
mkdir -p ${cfg.cachedir}
369
-
chmod 0700 ${cfg.cachedir}
361
+
in if (cfg.cachedir != null) then ''
362
+
mkdir -p ${cfg.cachedir}
363
+
chmod 0700 ${cfg.cachedir}
372
-
if [ ! -e ${cfg.cachedir}/firstrun ]; then
377
-
) 10>${cfg.cachedir}/firstrun
379
-
) 9>${cfg.cachedir}/lockf
366
+
if [ ! -e ${cfg.cachedir}/firstrun ]; then
371
+
) 10>${cfg.cachedir}/firstrun
373
+
) 9>${cfg.cachedir}/lockf
381
-
exec flock ${cfg.cachedir}/firstrun ${run}
382
-
'' else "exec ${run}";
375
+
exec flock ${cfg.cachedir}/firstrun ${run}
376
+
'' else "exec ${run}";