15 lines
823 B
Bash
Executable File
15 lines
823 B
Bash
Executable File
#!/bin/bash
|
|
set -euxo pipefail;
|
|
cd "$(dirname "$0")"
|
|
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
|