2021-08-14 21:31:02 +00:00
|
|
|
[Unit]
|
2021-08-28 11:51:11 +00:00
|
|
|
Description=Restore from Backup for Container Volume %I
|
2021-08-14 21:31:02 +00:00
|
|
|
ConditionFileNotEmpty=%S/backups/coreos-home-server/%i/%i-latest.tar.gz
|
|
|
|
|
|
|
|
[Service]
|
|
|
|
Type=oneshot
|
2021-08-28 18:16:29 +00:00
|
|
|
SyslogIdentifier=%N
|
2021-12-26 13:31:32 +00:00
|
|
|
ExecStart=/bin/podman run --replace --rm --name %p-%i --entrypoint /bin/bash \
|
|
|
|
--volume %i:/data:z \
|
2021-08-14 21:31:02 +00:00
|
|
|
--volume %S/backups/coreos-home-server/%i:/backups:z,ro \
|
2021-12-26 13:31:32 +00:00
|
|
|
docker.io/debian:bullseye-slim -c \
|
|
|
|
'test -n "$(ls -A /data)" && echo "Volume %i is not empty, skipping." && exit 0; \
|
|
|
|
tar -xvpf "/backups/%i-latest.tar.gz" -C /data'
|
2021-08-14 21:31:02 +00:00
|
|
|
|
|
|
|
[Install]
|
|
|
|
WantedBy=multi-user.target
|