1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/restic_ynh.git synced 2024-09-03 20:16:22 +02:00

fix: force restic binary replacement while installing

This commit is contained in:
Lionel Coupouchetty-Ramouchetty 2020-02-23 17:23:13 +01:00
parent 2d6bfe2af7
commit 759841b45d

View file

@ -11,21 +11,19 @@ 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 pushd /tmp
pushd /tmp wget https://github.com/restic/restic/releases/download/v${RESTIC_VERSION}/restic_${RESTIC_VERSION}_linux_amd64.bz2 -O /tmp/restic.bz2
wget https://github.com/restic/restic/releases/download/v${RESTIC_VERSION}/restic_${RESTIC_VERSION}_linux_amd64.bz2 -O /tmp/restic.bz2 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}/SHA256SUMS -O /tmp/restic-sha256sums expected_sum=$(grep restic_${RESTIC_VERSION}_linux_amd64.bz2 /tmp/restic-sha256sums | awk '{print $1}')
expected_sum=$(grep restic_${RESTIC_VERSION}_linux_amd64.bz2 /tmp/restic-sha256sums | awk '{print $1}') sum=$(sha256sum /tmp/restic.bz2 | awk '{print $1}')
sum=$(sha256sum /tmp/restic.bz2 | awk '{print $1}') if [ "$sum" == "$expected_sum" ];then
if [ "$sum" == "$expected_sum" ];then bunzip2 restic.bz2 -f -c > /usr/local/bin/restic
bunzip2 restic.bz2 -c > /usr/local/bin/restic chmod +x /usr/local/bin/restic
chmod +x /usr/local/bin/restic else
else echo -e "\e[91m \e[1m"
echo -e "\e[91m \e[1m" echo -e "\nDownloaded file does not match expected sha256 sum, aborting"
echo -e "\nDownloaded file does not match expected sha256 sum, aborting" echo -e "\e[22m"
echo -e "\e[22m" exit 1
exit 1
fi
fi fi
} }