commit
a05206b2bb
10
README.md
10
README.md
|
@ -31,24 +31,28 @@ installed: /etc/systemd/system/v2ray@.service
|
||||||
### 安裝 cURL
|
### 安裝 cURL
|
||||||
|
|
||||||
```
|
```
|
||||||
|
# apt update
|
||||||
# apt install curl
|
# apt install curl
|
||||||
```
|
```
|
||||||
|
|
||||||
or
|
or
|
||||||
|
|
||||||
```
|
```
|
||||||
|
# yum makecache
|
||||||
# yum install curl
|
# yum install curl
|
||||||
```
|
```
|
||||||
|
|
||||||
or
|
or
|
||||||
|
|
||||||
```
|
```
|
||||||
|
# dnf makecache
|
||||||
# dnf install curl
|
# dnf install curl
|
||||||
```
|
```
|
||||||
|
|
||||||
or
|
or
|
||||||
|
|
||||||
```
|
```
|
||||||
|
# zypper refresh
|
||||||
# zypper install curl
|
# 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
|
-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
|
-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) 分支進行,以避免對主分支造成破壞。
|
||||||
|
|
||||||
|
待確定無誤後,兩分支將進行合併。
|
||||||
|
|
|
@ -17,6 +17,14 @@ 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"
|
||||||
|
|
||||||
|
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() {
|
download_geoip() {
|
||||||
if ! curl -L -H 'Cache-Control: no-cache' -o "${V2RAY}geoip.dat.new" "$DOWNLOAD_LINK_GEOIP"; then
|
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.'
|
echo 'error: Download failed! Please check your network or try again.'
|
||||||
|
@ -53,13 +61,14 @@ download_geosite() {
|
||||||
|
|
||||||
rename_new() {
|
rename_new() {
|
||||||
for DAT in 'geoip' 'geosite'; do
|
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.new"
|
||||||
rm "${V2RAY}$DAT.dat.sha256sum.new"
|
rm "${V2RAY}$DAT.dat.sha256sum.new"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
|
check_if_running_as_root
|
||||||
download_geoip
|
download_geoip
|
||||||
download_geosite
|
download_geosite
|
||||||
rename_new
|
rename_new
|
||||||
|
|
|
@ -12,6 +12,14 @@
|
||||||
# If the script executes incorrectly, go to:
|
# If the script executes incorrectly, go to:
|
||||||
# https://github.com/v2fly/fhs-install-v2ray/issues
|
# 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() {
|
identify_the_operating_system_and_architecture() {
|
||||||
if [[ "$(uname)" == 'Linux' ]]; then
|
if [[ "$(uname)" == 'Linux' ]]; then
|
||||||
case "$(uname -m)" in
|
case "$(uname -m)" in
|
||||||
|
@ -318,7 +326,7 @@ install_file() {
|
||||||
if [[ "$NAME" == 'v2ray' ]] || [[ "$NAME" == 'v2ctl' ]]; then
|
if [[ "$NAME" == 'v2ray' ]] || [[ "$NAME" == 'v2ctl' ]]; then
|
||||||
install -m 755 "${TMP_DIRECTORY}$NAME" "/usr/local/bin/$NAME"
|
install -m 755 "${TMP_DIRECTORY}$NAME" "/usr/local/bin/$NAME"
|
||||||
elif [[ "$NAME" == 'geoip.dat' ]] || [[ "$NAME" == 'geosite.dat' ]]; then
|
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
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -362,8 +370,8 @@ install_startup_service_file() {
|
||||||
echo 'error: Failed to start service file download! Please check your network or try again.'
|
echo 'error: Failed to start service file download! Please check your network or try again.'
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
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 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
|
||||||
SYSTEMD='1'
|
SYSTEMD='1'
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -453,6 +461,7 @@ show_help() {
|
||||||
}
|
}
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
|
check_if_running_as_root
|
||||||
identify_the_operating_system_and_architecture
|
identify_the_operating_system_and_architecture
|
||||||
judgment_parameters "$@"
|
judgment_parameters "$@"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue