Files
salt-states/restic/files/install.sh
2023-12-06 00:27:44 -05:00

15 lines
467 B
Bash

#!/bin/bash
{% set arch = 'arm' if salt.grains.get('cpuarch').startswith('arm') else 'amd64' %}
{% set restic_version = salt.pillar.get("restic:version") %}
URL="https://github.com/restic/restic/releases/download/v{{ restic_version }}/restic_{{ restic_version }}_linux_{{ arch }}.bz2"
wget --quiet "${URL}" -O - | bzip2 -cd > /bin/restic.tmp
if [ $? -eq 0 ]; then
chmod +x /bin/restic.tmp
mv /bin/restic.tmp /bin/restic
else
rm -f /bin/restic.tmp
exit 1
fi