forked from Sophia/thelinuxlist
42 lines
1.4 KiB
Bash
42 lines
1.4 KiB
Bash
#!/usr/bin/env bash
|
|
trap 'exit 130' INT
|
|
while true
|
|
do
|
|
read -r -p "Would you like to install traefik? [Y/n] " input
|
|
|
|
case $input in
|
|
[yY][eE][sS]|[yY])
|
|
break
|
|
;;
|
|
[nN][oO]|[nN])
|
|
break
|
|
;;
|
|
*)
|
|
echo "That wasn't an option..."
|
|
;;
|
|
esac
|
|
done
|
|
if [ ! -x /usr/bin/curl ] ; then
|
|
CURL_NOT_EXIST=1
|
|
apt install -y curl
|
|
else
|
|
CURL_NOT_EXIST=0
|
|
fi
|
|
rm -rf /tmp/traefik/
|
|
mkdir /tmp/traefik/
|
|
VER=$(curl --silent "https://api.github.com/repos/traefik/traefik/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/' | sed 's|[v,]||g' )
|
|
if [ -n "$(uname -a | grep x86_64)" ]; then
|
|
curl -fsSL -o "/tmp/traefik/traefik_"$VER"_linux_amd64.tar.gz" "https://github.com/traefik/traefik/releases/download/v$VER/traefik_"$VER"_linux_amd64.tar.gz"
|
|
fi
|
|
|
|
if [ -n "$(uname -a | grep armv6l)" ]; then
|
|
curl -fsSL -o "/tmp/traefik/traefik_"$VER"_linux_armv6.tar.gz" "https://github.com/traefik/traefik/releases/download/v$VER/traefik_"$VER"_linux_armv6.tar.gz"
|
|
fi
|
|
|
|
if [ -n "$(uname -a | grep armv7l)" ]; then
|
|
curl -fsSL -o "/tmp/traefik/traefik_"$VER"_linux_arm64.tar.gz" "https://github.com/traefik/traefik/releases/download/v$VER/traefik_"$VER"_linux_arm64.tar.gz"
|
|
fi
|
|
cd /tmp/traefik/
|
|
tar -xzf /tmp/traefik/*.tar.gz
|
|
sudo mv /tmp/traefik/traefik /usr/local/bin
|
|
cd ~ |