Merge pull request #12 from v2fly/develop

feat: Branch merge
pull/23/head
Dct Mei 2020-06-13 13:03:12 +00:00 committed by GitHub
commit a05206b2bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 32 additions and 4 deletions

View File

@ -31,24 +31,28 @@ installed: /etc/systemd/system/v2ray@.service
### 安裝 cURL
```
# apt update
# apt install curl
```
or
```
# yum makecache
# yum install curl
```
or
```
# dnf makecache
# dnf install curl
```
or
```
# zypper refresh
# zypper install curl
```
@ -94,3 +98,9 @@ usage: install-release.sh [--remove | --version number | -c | -f | -h | -l | -p]
-l, --local Install V2Ray from a local file
-p, --proxy Download through a proxy server, e.g., -p http://127.0.0.1:8118 or -p socks5://127.0.0.1:1080
```
## 維護
請於 [develop](https://github.com/v2fly/fhs-install-v2ray/tree/develop) 分支進行,以避免對主分支造成破壞。
待確定無誤後,兩分支將進行合併。

View File

@ -17,6 +17,14 @@ 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"
check_if_running_as_root() {
# If you want to run as another user, please modify $UID to be owned by this user
if [[ "$UID" -ne '0' ]]; then
echo "error: You must run this script as root!"
exit 1
fi
}
download_geoip() {
if ! curl -L -H 'Cache-Control: no-cache' -o "${V2RAY}geoip.dat.new" "$DOWNLOAD_LINK_GEOIP"; then
echo 'error: Download failed! Please check your network or try again.'
@ -53,13 +61,14 @@ download_geosite() {
rename_new() {
for DAT in 'geoip' 'geosite'; do
install -m 755 "${V2RAY}$DAT.dat.new" "${V2RAY}$DAT.dat"
install -m 644 "${V2RAY}$DAT.dat.new" "${V2RAY}$DAT.dat"
rm "${V2RAY}$DAT.dat.new"
rm "${V2RAY}$DAT.dat.sha256sum.new"
done
}
main() {
check_if_running_as_root
download_geoip
download_geosite
rename_new

View File

@ -12,6 +12,14 @@
# If the script executes incorrectly, go to:
# https://github.com/v2fly/fhs-install-v2ray/issues
check_if_running_as_root() {
# If you want to run as another user, please modify $UID to be owned by this user
if [[ "$UID" -ne '0' ]]; then
echo "error: You must run this script as root!"
exit 1
fi
}
identify_the_operating_system_and_architecture() {
if [[ "$(uname)" == 'Linux' ]]; then
case "$(uname -m)" in
@ -318,7 +326,7 @@ install_file() {
if [[ "$NAME" == 'v2ray' ]] || [[ "$NAME" == 'v2ctl' ]]; then
install -m 755 "${TMP_DIRECTORY}$NAME" "/usr/local/bin/$NAME"
elif [[ "$NAME" == 'geoip.dat' ]] || [[ "$NAME" == 'geosite.dat' ]]; then
install -m 755 "${TMP_DIRECTORY}$NAME" "/usr/local/lib/v2ray/$NAME"
install -m 644 "${TMP_DIRECTORY}$NAME" "/usr/local/lib/v2ray/$NAME"
fi
}
@ -362,8 +370,8 @@ install_startup_service_file() {
echo 'error: Failed to start service file download! Please check your network or try again.'
exit 1
fi
install -m 755 "${TMP_DIRECTORY}systemd/system/v2ray.service" /etc/systemd/system/v2ray.service
install -m 755 "${TMP_DIRECTORY}systemd/system/v2ray@.service" /etc/systemd/system/v2ray@.service
install -m 644 "${TMP_DIRECTORY}systemd/system/v2ray.service" /etc/systemd/system/v2ray.service
install -m 644 "${TMP_DIRECTORY}systemd/system/v2ray@.service" /etc/systemd/system/v2ray@.service
SYSTEMD='1'
fi
}
@ -453,6 +461,7 @@ show_help() {
}
main() {
check_if_running_as_root
identify_the_operating_system_and_architecture
judgment_parameters "$@"