zio-update-caddy: add script
parent
571b21326c
commit
2122f81fe8
|
@ -27,4 +27,5 @@
|
|||
!/usr/local/bin/
|
||||
/usr/local/bin/*
|
||||
!/usr/local/bin/zio-backup
|
||||
!/usr/local/bin/zio-update-caddy
|
||||
!/usr/local/bin/zio-update-rootfs
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
#!/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"
|
||||
|
||||
if
|
||||
ln -s -f "$caddy_install-$caddy_version" "$caddy_install"
|
||||
|
||||
if [[ ! -L "$caddy_install" ]] && [[ ! -e "$caddy_install" ]]; then
|
||||
rm -f "$caddy_install"
|
||||
ln -s -f "$caddy_install-$caddy_version" "$caddy_install"
|
||||
chmod +x "$caddy_install"
|
||||
fi
|
Loading…
Reference in New Issue