From 8f3f4d0b4963dee1414031833fd868d7a4aae30d Mon Sep 17 00:00:00 2001 From: 233boy <31657650+233boy@users.noreply.github.com> Date: Mon, 25 Mar 2019 12:57:00 +0800 Subject: [PATCH] oh...shit.. --- install.sh | 110 +++++++++++++++++++++++++++++++++++++------------ src/install.sh | 61 --------------------------- 2 files changed, 83 insertions(+), 88 deletions(-) delete mode 100644 src/install.sh diff --git a/install.sh b/install.sh index e43f8e2..142ddb9 100755 --- a/install.sh +++ b/install.sh @@ -8,10 +8,10 @@ magenta='\e[95m' cyan='\e[96m' none='\e[0m' _red() { echo -e ${red}$*${none}; } -_green() { echo -e ${green}$*${none}; } -_yellow() { echo -e ${yellow}$*${none}; } +_green() { echo -e ${green}$*${none}; } +_yellow() { echo -e ${yellow}$*${none}; } _magenta() { echo -e ${magenta}$*${none}; } -_cyan() { echo -e ${cyan}$*${none}; } +_cyan() { echo -e ${cyan}$*${none}; } author=233boy # Root @@ -115,30 +115,29 @@ _load() { . "${_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 + 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 "\n主机时间:${yellow}" + timedatectl status | sed -n '1p;4p' echo -e "${none}" [[ $IS_OPENV ]] && pause } @@ -762,8 +761,65 @@ caddy_config() { install_v2ray() { ## install - _load install.sh - _do_install + echo + echo + echo -e "$yellow 同步系统仓库并安装必须组件,请骚吼~~~~~~~~~ $none" + echo + echo + if [[ $cmd == "apt-get" ]]; then + $cmd update -y + $cmd install -y socat lrzsz git zip unzip curl wget qrencode libcap2-bin patch diffutils jq dbus + else + # $cmd install -y lrzsz git zip unzip curl wget qrencode libcap iptables-services + $cmd install -y socat lrzsz git zip unzip curl wget qrencode libcap patch diffutils + if [[ ! $(command -v jq) ]]; then + pushd /tmp + if curl -sL -o jq https://github.com/stedolan/jq/releases/download/jq-1.6/jq-${_jqArch}; then + install -m 755 jq /usr/local/bin/ + rm -f jq + else + echo + _red "安装 jq 失败..." + echo + exit 1 + fi + popd + fi + fi + ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime + _disableselinux + _sys_timezone + _sys_time + echo + echo + [ -d /etc/v2ray ] && rm -rf /etc/v2ray + + if [[ $local_install ]]; then + if [[ ! -d $(pwd)/config ]]; then + echo + echo -e "$red 哎呀呀...安装失败了咯...$none" + echo + echo -e " 请确保你有完整的上传 $author 的 V2Ray 一键安装脚本 & 管理脚本到当前 ${green}$(pwd) $none目录下" + echo + exit 1 + fi + mkdir -p /etc/v2ray/233boy/v2ray + cp -rf $(pwd) /etc/v2ray/233boy/v2ray/ + else + pushd /tmp + git clone --depth=1 https://github.com/233boy/v2ray -b "$_gitbranch" /etc/v2ray/233boy/v2ray + popd + + fi + + if [[ ! -d /etc/v2ray/233boy/v2ray ]]; then + echo + echo -e "$red 哎呀呀...克隆脚本仓库出错了...$none" + echo + echo -e " 温馨提示..... 请尝试自行安装 Git: ${green}$cmd install -y git $none 之后再安装此脚本" + echo + exit 1 + fi # download v2ray file then install _load download-v2ray.sh @@ -846,12 +902,12 @@ backup_config() { _first_backup caddy fi - ## ban ad + ## ban ad if [[ $ban_ad ]]; then _first_backup +ad fi - ## ws+tls / http2, path + ## ws+tls / http2, path if [[ $is_path ]]; then _first_backup +path fi diff --git a/src/install.sh b/src/install.sh deleted file mode 100644 index d2ee4ff..0000000 --- a/src/install.sh +++ /dev/null @@ -1,61 +0,0 @@ -_do_install() { - echo - echo - echo -e "$yellow 同步系统仓库并安装必须组件,请骚吼~~~~~~~~~ $none" - echo - echo - if [[ $cmd == "apt-get" ]]; then - $cmd update -y - $cmd install -y socat lrzsz git zip unzip curl wget qrencode libcap2-bin patch diffutils jq dbus - else - # $cmd install -y lrzsz git zip unzip curl wget qrencode libcap iptables-services - $cmd install -y socat lrzsz git zip unzip curl wget qrencode libcap patch diffutils - if [[ ! $(command -v jq) ]]; then - pushd /tmp - if curl -sL -o jq https://github.com/stedolan/jq/releases/download/jq-1.6/jq-${_jqArch}; then - install -m 755 jq /usr/local/bin/ - rm -f jq - else - echo - _red "安装 jq 失败..." - echo - exit 1 - fi - popd - fi - fi - ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime - _disableselinux - _sys_timezone - _sys_time - echo - echo - [ -d /etc/v2ray ] && rm -rf /etc/v2ray - - if [[ $local_install ]]; then - if [[ ! -d $(pwd)/config ]]; then - echo - echo -e "$red 哎呀呀...安装失败了咯...$none" - echo - echo -e " 请确保你有完整的上传 $author 的 V2Ray 一键安装脚本 & 管理脚本到当前 ${green}$(pwd) $none目录下" - echo - exit 1 - fi - mkdir -p /etc/v2ray/233boy/v2ray - cp -rf $(pwd) /etc/v2ray/233boy/v2ray/ - else - pushd /tmp - git clone --depth=1 https://github.com/233boy/v2ray -b "$_gitbranch" /etc/v2ray/233boy/v2ray - popd - - fi - - if [[ ! -d /etc/v2ray/233boy/v2ray ]]; then - echo - echo -e "$red 哎呀呀...克隆脚本仓库出错了...$none" - echo - echo -e " 温馨提示..... 请尝试自行安装 Git: ${green}$cmd install -y git $none 之后再安装此脚本" - echo - exit 1 - fi -}