2023-08-12 19:44:48 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
if [[ $UID != 0 ]]; then
|
|
|
|
exit 255
|
|
|
|
fi
|
|
|
|
|
|
|
|
caddy_tmp_install="/tmp/caddy"
|
|
|
|
caddy_install="/usr/local/bin/caddy"
|
|
|
|
|
|
|
|
if [[ -f "$caddy_tmp_install" ]]; then
|
|
|
|
rm "$caddy_tmp_install"
|
|
|
|
fi
|
|
|
|
|
|
|
|
wget "https://caddyserver.com/api/download?os=linux&arch=amd64&p=github.com%2Fcaddy-dns%2Fcloudflare" -O "$caddy_tmp_install"
|
|
|
|
|
|
|
|
chmod +x "$caddy_tmp_install"
|
|
|
|
caddy_version="$(/tmp/caddy version)"
|
|
|
|
caddy_version_array=($caddy_version)
|
|
|
|
caddy_version="${caddy_version_array[0]}"
|
|
|
|
|
|
|
|
mv "$caddy_tmp_install" "$caddy_install-$caddy_version"
|
|
|
|
|
2023-08-12 19:49:10 +02:00
|
|
|
rm -f "$caddy_install"
|
|
|
|
ln -s -f "$caddy_install-$caddy_version" "$caddy_install"
|
|
|
|
chmod +x "$caddy_install"
|