|
|
@ -15,9 +15,7 @@ _get_latest_version() { |
|
|
|
|
|
|
|
|
|
|
|
_download_v2ray_file() { |
|
|
|
_download_v2ray_file() { |
|
|
|
_get_latest_version |
|
|
|
_get_latest_version |
|
|
|
[[ -d /tmp/v2ray ]] && rm -rf /tmp/v2ray |
|
|
|
v2ray_tmp_file="/tmp/v2ray.zip" |
|
|
|
mkdir -p /tmp/v2ray |
|
|
|
|
|
|
|
v2ray_tmp_file="/tmp/v2ray/v2ray.zip" |
|
|
|
|
|
|
|
v2ray_download_link="https://github.com/v2ray/v2ray-core/releases/download/$v2ray_latest_ver/v2ray-linux-${v2ray_bit}.zip" |
|
|
|
v2ray_download_link="https://github.com/v2ray/v2ray-core/releases/download/$v2ray_latest_ver/v2ray-linux-${v2ray_bit}.zip" |
|
|
|
|
|
|
|
|
|
|
|
if ! wget --no-check-certificate -O "$v2ray_tmp_file" $v2ray_download_link; then |
|
|
|
if ! wget --no-check-certificate -O "$v2ray_tmp_file" $v2ray_download_link; then |
|
|
@ -26,26 +24,15 @@ _download_v2ray_file() { |
|
|
|
" && exit 1 |
|
|
|
" && exit 1 |
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
unzip $v2ray_tmp_file -d "/tmp/v2ray/" |
|
|
|
unzip -o $v2ray_tmp_file -d "/usr/bin/v2ray/" |
|
|
|
mkdir -p /usr/bin/v2ray |
|
|
|
chmod +x /usr/bin/v2ray/{v2ray,v2ctl} |
|
|
|
cp -f "/tmp/v2ray/v2ray" "/usr/bin/v2ray/v2ray" |
|
|
|
|
|
|
|
chmod +x "/usr/bin/v2ray/v2ray" |
|
|
|
|
|
|
|
echo "alias v2ray=$_v2ray_sh" >>/root/.bashrc |
|
|
|
echo "alias v2ray=$_v2ray_sh" >>/root/.bashrc |
|
|
|
cp -f "/tmp/v2ray/v2ctl" "/usr/bin/v2ray/v2ctl" |
|
|
|
|
|
|
|
chmod +x "/usr/bin/v2ray/v2ctl" |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
_install_v2ray_service() { |
|
|
|
_install_v2ray_service() { |
|
|
|
if [[ $systemd ]]; then |
|
|
|
cp -f "/usr/bin/v2ray/systemd/v2ray.service" "/lib/systemd/system/" |
|
|
|
cp -f "/tmp/v2ray/systemd/v2ray.service" "/lib/systemd/system/" |
|
|
|
sed -i "s/on-failure/always/" /lib/systemd/system/v2ray.service |
|
|
|
sed -i "s/on-failure/always/" /lib/systemd/system/v2ray.service |
|
|
|
systemctl enable v2ray |
|
|
|
systemctl enable v2ray |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
apt-get install -y daemon |
|
|
|
|
|
|
|
cp "/tmp/v2ray/systemv/v2ray" "/etc/init.d/v2ray" |
|
|
|
|
|
|
|
chmod +x "/etc/init.d/v2ray" |
|
|
|
|
|
|
|
update-rc.d -f v2ray defaults |
|
|
|
|
|
|
|
fi |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
_update_v2ray_version() { |
|
|
|
_update_v2ray_version() { |
|
|
|