2021-04-11 17:02:34 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2021-04-17 15:57:15 +02:00
|
|
|
shopt -s nocaseglob
|
|
|
|
|
2021-04-11 17:02:34 +02:00
|
|
|
OUT_FILE=/usr/local/bin/autorestic
|
|
|
|
|
2021-04-17 15:57:15 +02:00
|
|
|
# Type
|
|
|
|
NATIVE_OS=$(uname | tr '[:upper:]' '[:lower:]')
|
|
|
|
if [[ $NATIVE_OS == *"linux"* ]]; then
|
|
|
|
OS=linux
|
|
|
|
elif [[ $NATIVE_OS == *"darwin"* ]]; then
|
|
|
|
OS=darwin
|
|
|
|
else
|
|
|
|
echo "Could not determine OS automatically, please check the release page manually: https://github.com/cupcakearmy/autorestic/releases"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
echo $OS
|
|
|
|
|
|
|
|
NATIVE_ARCH=$(uname -m)
|
|
|
|
if [[ $NATIVE_ARCH == *"x86_64"* ]]; then
|
|
|
|
ARCH=amd64
|
|
|
|
elif [[ $NATIVE_ARCH == *"x86"* ]]; then
|
|
|
|
ARCH=386
|
2021-04-11 17:02:34 +02:00
|
|
|
else
|
2021-04-17 15:57:15 +02:00
|
|
|
echo "Could not determine Architecure automatically, please check the release page manually: https://github.com/cupcakearmy/autorestic/releases"
|
2021-04-11 17:02:34 +02:00
|
|
|
exit 1
|
|
|
|
fi
|
2021-04-17 15:57:15 +02:00
|
|
|
echo $ARCH
|
2021-04-11 17:02:34 +02:00
|
|
|
|
|
|
|
curl -s https://api.github.com/repos/cupcakearmy/autorestic/releases/latest \
|
2021-04-17 15:57:15 +02:00
|
|
|
| grep "browser_download_url.*_${OS}_${ARCH}" \
|
2021-04-11 17:02:34 +02:00
|
|
|
| cut -d : -f 2,3 \
|
|
|
|
| tr -d \" \
|
2021-04-17 15:57:15 +02:00
|
|
|
| wget -O "${OUT_FILE}.bz2" -i -
|
|
|
|
bzip2 -fd "${OUT_FILE}.bz2"
|
2021-04-11 17:02:34 +02:00
|
|
|
chmod +x ${OUT_FILE}
|
|
|
|
|
|
|
|
autorestic install
|
|
|
|
echo "Succefsully installed autorestic"
|