Update install-release.sh

Add func enable v2ray
pull/77/head
DolorHunter 2020-09-02 20:02:55 +08:00 committed by GitHub
parent 639d31a791
commit 6be7268d0a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 0 deletions

View File

@ -423,6 +423,21 @@ EOF
fi
}
enable_v2ray() {
if [[ -f '/etc/systemd/system/v2ray.service' ]]; then
if [[ -z "$V2RAY_CUSTOMIZE" ]]; then
systemctl enable v2ray
else
systemctl enable "$V2RAY_CUSTOMIZE"
fi
fi
if [[ "$?" -ne 0 ]]; then
echo 'error: Failed to enable V2Ray service.'
exit 1
fi
echo 'info: Enable the V2Ray service.'
}
start_v2ray() {
if [[ -f '/etc/systemd/system/v2ray.service' ]]; then
if [[ -z "$V2RAY_CUSTOMIZE" ]]; then
@ -604,6 +619,7 @@ main() {
echo "info: V2Ray $RELEASE_VERSION is installed."
echo "You may need to execute a command to remove dependent software: $PACKAGE_MANAGEMENT_REMOVE curl unzip"
if [[ "$V2RAY_RUNNING" -eq '1' ]]; then
enable_v2ray
start_v2ray
else
echo 'Please execute the command: systemctl enable v2ray; systemctl start v2ray'