geoip-geosite-with-ru-block.../update.sh
Neur0toxine f45297afe2
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
update readme && updater example
2023-11-11 22:34:30 +03:00

14 lines
802 B
Bash
Executable File

#!/bin/bash
set -euxo pipefail;
current=`curl 'https://gitea.neur0tx.site/api/v1/repos/xray-addons/geoip-geosite-with-ru-blocklist/releases/latest'`
geoipUrl=`echo "$current" | jq -r '.assets | map( { (.name|tostring): . } ) | add | ."geoip.dat".browser_download_url'`
geositeUrl=`echo "$current" | jq -r '.assets | map( { (.name|tostring): . } ) | add | ."geosite.dat".browser_download_url'`
[ -f geoip.dat ] && mv geoip.dat geoip.dat.bak
[ -f geosite.dat ] && mv geosite.dat geosite.dat.bak
curl -fsSL "$geoipUrl" -o geoip.dat
curl -fsSL "$geositeUrl" -o geosite.dat
[ -f geoip.dat ] && [ -f geoip.dat.bak ] && rm geoip.dat.bak
[ -f geosite.dat ] && [ -f geosite.dat.bak ] && rm geosite.dat.bak
[ ! -f geoip.dat ] && mv geoip.dat.bak geoip.dat
[ ! -f geosite.dat ] && mv geosite.dat.bak geosite.dat