#!/bin/bash if [[ "$EUID" -ne 0 ]]; then echo "Needs to be run as root" exit 1 fi podman run --rm \ --name=restic \ --hostname="$HOSTNAME" \ -v /root/.restic.password:/restic-password:ro \ {%- if pillar.restic.repository is defined %} -v {{ pillar.restic.mount }}{{ pillar.restic.suffix }}:/repo \ {%- endif %} -v /root:/root \ {{ pillar.restic.image.url }}:{{ pillar.restic.image.tag }} \ restic \ --password-file=/restic-password \ {%- if pillar.restic.repository is defined %} --repo=/repo \ {%- else %} -r sftp:{{ pillar.restic.user }}@{{ pillar.restic.host }}:{{ pillar.restic.mount }}{{ pillar.restic.suffix }} \ {%- endif %} "$@"