feat: Rename and add some comments
1. I originally planned to use Python, and after thinking about it, I still used Bash. 2. The script depends on cURL, but you need to solve it yourself.pull/9/head
parent
3bacbce44a
commit
f1ce0cb4c0
|
@ -1,16 +1,23 @@
|
|||
#!/bin/bash
|
||||
|
||||
# This Bash script to install the latest release of geoip.dat and geosite.dat:
|
||||
|
||||
# https://github.com/v2ray/geoip
|
||||
# https://github.com/v2ray/domain-list-community
|
||||
|
||||
# Need cURL, please solve it by yourself
|
||||
|
||||
V2RAY="/usr/local/lib/v2ray/"
|
||||
DOWNLOAD_LINK_GEOIP="https://github.com/v2ray/geoip/releases/latest/download/geoip.dat"
|
||||
DOWNLOAD_LINK_GEOSITE="https://github.com/v2ray/domain-list-community/releases/latest/download/dlc.dat"
|
||||
|
||||
download_geoip() {
|
||||
curl -L -H 'Cache-Control: no-cache' -o "${V2RAY}geoip.dat.new" "$DOWNLOAD_LINK_GEOIP" -#
|
||||
curl -L -H 'Cache-Control: no-cache' -o "${V2RAY}geoip.dat.new" "$DOWNLOAD_LINK_GEOIP"
|
||||
if [ "$?" -ne '0' ]; then
|
||||
echo 'error: Download failed! Please check your network or try again.'
|
||||
exit 1
|
||||
fi
|
||||
curl -L -H 'Cache-Control: no-cache' -o "${V2RAY}geoip.dat.sha256sum.new" "$DOWNLOAD_LINK_GEOIP.sha256sum" -#
|
||||
curl -L -H 'Cache-Control: no-cache' -o "${V2RAY}geoip.dat.sha256sum.new" "$DOWNLOAD_LINK_GEOIP.sha256sum"
|
||||
if [ "$?" -ne '0' ]; then
|
||||
echo 'error: Download failed! Please check your network or try again.'
|
||||
exit 1
|
||||
|
@ -24,12 +31,12 @@ download_geoip() {
|
|||
}
|
||||
|
||||
download_geosite() {
|
||||
curl -L -H 'Cache-Control: no-cache' -o "${V2RAY}geosite.dat.new" "$DOWNLOAD_LINK_GEOSITE" -#
|
||||
curl -L -H 'Cache-Control: no-cache' -o "${V2RAY}geosite.dat.new" "$DOWNLOAD_LINK_GEOSITE"
|
||||
if [ "$?" -ne '0' ]; then
|
||||
echo 'error: Download failed! Please check your network or try again.'
|
||||
exit 1
|
||||
fi
|
||||
curl -L -H 'Cache-Control: no-cache' -o "${V2RAY}geosite.dat.sha256sum.new" "$DOWNLOAD_LINK_GEOSITE.sha256sum" -#
|
||||
curl -L -H 'Cache-Control: no-cache' -o "${V2RAY}geosite.dat.sha256sum.new" "$DOWNLOAD_LINK_GEOSITE.sha256sum"
|
||||
if [ "$?" -ne '0' ]; then
|
||||
echo 'error: Download failed! Please check your network or try again.'
|
||||
exit 1
|
Loading…
Reference in New Issue