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

feat: handle multiple proc architectures

This commit is contained in:
Lionel Coupouchetty-Ramouchetty 2020-02-23 18:42:14 +01:00
parent 17d5d45c14
commit 9db6bf1f92

View file

@ -11,9 +11,26 @@ pkg_dependencies="expect"
# Install restic if restic is not here # Install restic if restic is not here
install_restic () { install_restic () {
wget https://github.com/restic/restic/releases/download/v${RESTIC_VERSION}/restic_${RESTIC_VERSION}_linux_amd64.bz2 -O /tmp/restic.bz2 architecture=$(uname -m)
arch=''
case $architecture in
i386|i686)
arch="386"
;;
x86_64)
arch=amd64
;;
armv*)
arch=arm
;;
*)
echo "Unsupported architecture \"$architecture\""
exit 1
;;
esac
wget https://github.com/restic/restic/releases/download/v${RESTIC_VERSION}/restic_${RESTIC_VERSION}_linux_${arch}.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_${arch}.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 /tmp/restic.bz2 -f -c > /usr/local/bin/restic bunzip2 /tmp/restic.bz2 -f -c > /usr/local/bin/restic