geoip-geosite-with-ru-block.../update.sh

14 lines
802 B
Bash
Raw Normal View History

2023-11-11 22:34:30 +03:00
#!/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