mirror of
https://github.com/YunoHost-Apps/restic_ynh.git
synced 2024-09-03 20:16:22 +02:00
Merge branch 'feature/install-checksum'
This commit is contained in:
commit
17d5d45c14
2 changed files with 12 additions and 5 deletions
|
@ -57,7 +57,7 @@
|
||||||
"fr": "Un chemin complet ou relatif vers un répertoire existant sur le serveur distant et accessible en écriture au compte utilisé pour la sauvegarde. Répertoire d'accueil par défaut"
|
"fr": "Un chemin complet ou relatif vers un répertoire existant sur le serveur distant et accessible en écriture au compte utilisé pour la sauvegarde. Répertoire d'accueil par défaut"
|
||||||
},
|
},
|
||||||
"example": "./backups",
|
"example": "./backups",
|
||||||
"default": "./"
|
"default": "."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "ssh_user",
|
"name": "ssh_user",
|
||||||
|
|
|
@ -11,11 +11,18 @@ pkg_dependencies="expect"
|
||||||
|
|
||||||
# Install restic if restic is not here
|
# Install restic if restic is not here
|
||||||
install_restic () {
|
install_restic () {
|
||||||
if [ ! -f /usr/local/bin/restic ];then
|
wget https://github.com/restic/restic/releases/download/v${RESTIC_VERSION}/restic_${RESTIC_VERSION}_linux_amd64.bz2 -O /tmp/restic.bz2
|
||||||
pushd /tmp
|
wget https://github.com/restic/restic/releases/download/v${RESTIC_VERSION}/SHA256SUMS -O /tmp/restic-sha256sums
|
||||||
wget https://github.com/restic/restic/releases/download/v${RESTIC_VERSION}/restic_${RESTIC_VERSION}_linux_amd64.bz2 -O /tmp/restic.bz2
|
expected_sum=$(grep restic_${RESTIC_VERSION}_linux_amd64.bz2 /tmp/restic-sha256sums | awk '{print $1}')
|
||||||
bunzip2 restic.bz2 -c > /usr/local/bin/restic
|
sum=$(sha256sum /tmp/restic.bz2 | awk '{print $1}')
|
||||||
|
if [ "$sum" == "$expected_sum" ];then
|
||||||
|
bunzip2 /tmp/restic.bz2 -f -c > /usr/local/bin/restic
|
||||||
chmod +x /usr/local/bin/restic
|
chmod +x /usr/local/bin/restic
|
||||||
|
else
|
||||||
|
echo -e "\e[91m \e[1m"
|
||||||
|
echo -e "\nDownloaded file does not match expected sha256 sum, aborting"
|
||||||
|
echo -e "\e[22m"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue