2
0
Fork 0
rootfs/usr/local/bin/zio-update-caddy

26 lines
634 B
Plaintext
Raw Normal View History

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"
rm -f "$caddy_install"
ln -s -f "$caddy_install-$caddy_version" "$caddy_install"
chmod +x "$caddy_install"