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
Dct Mei 2020-04-29 14:09:23 +08:00
parent 3bacbce44a
commit f1ce0cb4c0
No known key found for this signature in database
GPG Key ID: 50BF8B712DCAD7EA
1 changed files with 11 additions and 4 deletions

View File

@ -1,16 +1,23 @@
#!/bin/bash #!/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/" V2RAY="/usr/local/lib/v2ray/"
DOWNLOAD_LINK_GEOIP="https://github.com/v2ray/geoip/releases/latest/download/geoip.dat" 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_LINK_GEOSITE="https://github.com/v2ray/domain-list-community/releases/latest/download/dlc.dat"
download_geoip() { 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 if [ "$?" -ne '0' ]; then
echo 'error: Download failed! Please check your network or try again.' echo 'error: Download failed! Please check your network or try again.'
exit 1 exit 1
fi 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 if [ "$?" -ne '0' ]; then
echo 'error: Download failed! Please check your network or try again.' echo 'error: Download failed! Please check your network or try again.'
exit 1 exit 1
@ -24,12 +31,12 @@ download_geoip() {
} }
download_geosite() { 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 if [ "$?" -ne '0' ]; then
echo 'error: Download failed! Please check your network or try again.' echo 'error: Download failed! Please check your network or try again.'
exit 1 exit 1
fi 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 if [ "$?" -ne '0' ]; then
echo 'error: Download failed! Please check your network or try again.' echo 'error: Download failed! Please check your network or try again.'
exit 1 exit 1