#!/usr/bin/env nix-shell
#!nix-shell -i bash -p bash -p duplicity

# N.B. must be run as root

set -ex

dest_path="$1"
source_path="$2"

# source the URL; hack to satisfy resholve
external_cmd="source /run/secrets/duplicity_passphrase.env"
$external_cmd
duplicity restore --archive-dir /var/lib/duplicity --file-to-restore "$source_path" $DUPLICITY_URL "$dest_path"
