14 lines
802 B
Bash
14 lines
802 B
Bash
|
#!/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
|