From f515968ebfdc182b857772e0b599b9f7988aa8bc Mon Sep 17 00:00:00 2001 From: 233boy <31657650+233boy@users.noreply.github.com> Date: Sat, 22 Jun 2019 10:57:43 +0800 Subject: [PATCH] fix #249 --- install.sh | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/install.sh b/install.sh index adbd94b..05e1c2c 100644 --- a/install.sh +++ b/install.sh @@ -126,7 +126,32 @@ _load() { local _dir="/etc/v2ray/233boy/v2ray/src/" . "${_dir}$@" } +_sys_timezone() { + IS_OPENVZ= + if hostnamectl status | grep -q openvz; then + IS_OPENVZ=1 + fi + echo + timedatectl set-timezone Asia/Shanghai + timedatectl set-ntp true + echo "已将你的主机设置为Asia/Shanghai时区并通过systemd-timesyncd自动同步时间。" + echo + + if [[ $IS_OPENVZ ]]; then + echo + echo -e "你的主机环境为 ${yellow}Openvz${none} ,建议使用${yellow}v2ray mkcp${none}系列协议。" + echo -e "注意:${yellow}Openvz${none} 系统时间无法由虚拟机内程序控制同步。" + echo -e "如果主机时间跟实际相差${yellow}超过90秒${none},v2ray将无法正常通信,请发ticket联系vps主机商调整。" + fi +} + +_sys_time() { + echo -e "\n主机时间:${yellow}" + timedatectl status | sed -n '1p;4p' + echo -e "${none}" + [[ $IS_OPENV ]] && pause +} v2ray_config() { # clear echo @@ -754,14 +779,16 @@ caddy_config() { install_v2ray() { $cmd update -y if [[ $cmd == "apt-get" ]]; then - $cmd install -y lrzsz git zip unzip curl wget qrencode libcap2-bin + $cmd install -y lrzsz git zip unzip curl wget qrencode libcap2-bin dbus else # $cmd install -y lrzsz git zip unzip curl wget qrencode libcap iptables-services $cmd install -y lrzsz git zip unzip curl wget qrencode libcap fi ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime [ -d /etc/v2ray ] && rm -rf /etc/v2ray - date -s "$(curl -sI g.cn | grep Date | cut -d' ' -f3-6)Z" + # date -s "$(curl -sI g.cn | grep Date | cut -d' ' -f3-6)Z" + _sys_timezone + _sys_time if [[ $local_install ]]; then if [[ ! -d $(pwd)/config ]]; then