2021-04-11 15:02:34 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2021-04-17 13:57:15 +00:00
|
|
|
shopt -s nocaseglob
|
|
|
|
|
2021-04-11 15:02:34 +00:00
|
|
|
OUT_FILE=/usr/local/bin/autorestic
|
|
|
|
|
2021-04-17 13:57:15 +00:00
|
|
|
# Type
|
|
|
|
NATIVE_OS=$(uname | tr '[:upper:]' '[:lower:]')
|
|
|
|
if [[ $NATIVE_OS == *"linux"* ]]; then
|
|
|
|
OS=linux
|
|
|
|
elif [[ $NATIVE_OS == *"darwin"* ]]; then
|
|
|
|
OS=darwin
|
2024-08-28 15:19:13 +00:00
|
|
|
elif [[ $NATIVE_OS == *"freebsd"* ]]; then
|
|
|
|
OS=freebsd
|
2021-04-17 13:57:15 +00:00
|
|
|
else
|
|
|
|
echo "Could not determine OS automatically, please check the release page manually: https://github.com/cupcakearmy/autorestic/releases"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
echo $OS
|
|
|
|
|
2021-04-26 11:15:58 +00:00
|
|
|
NATIVE_ARCH=$(uname -m | tr '[:upper:]' '[:lower:]')
|
2024-08-28 15:19:13 +00:00
|
|
|
if [[ $NATIVE_ARCH == *"x86_64"* || $NATIVE_ARCH == *"amd64"* ]]; then
|
2021-04-17 13:57:15 +00:00
|
|
|
ARCH=amd64
|
2021-04-26 11:15:58 +00:00
|
|
|
elif [[ $NATIVE_ARCH == *"arm64"* || $NATIVE_ARCH == *"aarch64"* ]]; then
|
|
|
|
ARCH=arm64
|
2021-04-17 13:57:15 +00:00
|
|
|
elif [[ $NATIVE_ARCH == *"x86"* ]]; then
|
|
|
|
ARCH=386
|
2021-05-25 20:57:42 +00:00
|
|
|
elif [[ $NATIVE_ARCH == *"armv7"* ]]; then
|
|
|
|
ARCH=arm
|
2021-04-11 15:02:34 +00:00
|
|
|
else
|
2021-04-17 13:57:15 +00:00
|
|
|
echo "Could not determine Architecure automatically, please check the release page manually: https://github.com/cupcakearmy/autorestic/releases"
|
2021-04-11 15:02:34 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
2021-04-17 13:57:15 +00:00
|
|
|
echo $ARCH
|
2021-04-11 15:02:34 +00:00
|
|
|
|
2022-10-18 14:17:35 +00:00
|
|
|
if ! command -v bzip2 &>/dev/null; then
|
|
|
|
echo "Missing bzip2 command. Please install the bzip2 package for your system."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2021-10-30 12:38:53 +00:00
|
|
|
wget -qO - https://api.github.com/repos/cupcakearmy/autorestic/releases/latest \
|
2021-04-17 13:57:15 +00:00
|
|
|
| grep "browser_download_url.*_${OS}_${ARCH}" \
|
2021-04-11 15:02:34 +00:00
|
|
|
| cut -d : -f 2,3 \
|
|
|
|
| tr -d \" \
|
2021-04-17 13:57:15 +00:00
|
|
|
| wget -O "${OUT_FILE}.bz2" -i -
|
|
|
|
bzip2 -fd "${OUT_FILE}.bz2"
|
2021-04-11 15:02:34 +00:00
|
|
|
chmod +x ${OUT_FILE}
|
|
|
|
|
|
|
|
autorestic install
|
2021-04-21 18:32:11 +00:00
|
|
|
echo "Successfully installed autorestic"
|