Skip to content

Commit

Permalink
feat: Rename and add some comments
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
dctxmei committed Apr 29, 2020
1 parent 3bacbce commit f1ce0cb
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions install-release-dat.sh → install-dat-release.sh
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down

0 comments on commit f1ce0cb

Please sign in to comment.