mirror of https://github.com/wulabing/Xray_onekey
parent
3bc132f088
commit
2e9e8af2ca
24
install.sh
24
install.sh
|
@ -7,6 +7,9 @@
|
||||||
# email: admin@wulabing.com
|
# email: admin@wulabing.com
|
||||||
#====================================================
|
#====================================================
|
||||||
|
|
||||||
|
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
||||||
|
stty erase ^?
|
||||||
|
|
||||||
cd "$(
|
cd "$(
|
||||||
cd "$(dirname "$0")" || exit
|
cd "$(dirname "$0")" || exit
|
||||||
pwd
|
pwd
|
||||||
|
@ -24,9 +27,8 @@ OK="${Green}[OK]${Font}"
|
||||||
ERROR="${Red}[ERROR]${Font}"
|
ERROR="${Red}[ERROR]${Font}"
|
||||||
|
|
||||||
# 变量
|
# 变量
|
||||||
shell_version="1.2.3"
|
shell_version="1.2.4"
|
||||||
github_branch="main"
|
github_branch="main"
|
||||||
version_cmp="/tmp/version_cmp.tmp"
|
|
||||||
xray_conf_dir="/usr/local/etc/xray"
|
xray_conf_dir="/usr/local/etc/xray"
|
||||||
website_dir="/www/xray_web/"
|
website_dir="/www/xray_web/"
|
||||||
xray_access_log="/var/log/xray/access.log"
|
xray_access_log="/var/log/xray/access.log"
|
||||||
|
@ -134,8 +136,8 @@ function nginx_install() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function dependency_install() {
|
function dependency_install() {
|
||||||
${INS} wget lsof
|
${INS} wget lsof tar
|
||||||
judge "安装 wget lsof"
|
judge "安装 wget lsof tar"
|
||||||
|
|
||||||
if [[ "${ID}" == "centos" ]]; then
|
if [[ "${ID}" == "centos" ]]; then
|
||||||
${INS} crontabs
|
${INS} crontabs
|
||||||
|
@ -242,9 +244,7 @@ function port_exist_check() {
|
||||||
}
|
}
|
||||||
function update_sh() {
|
function update_sh() {
|
||||||
ol_version=$(curl -L -s https://raw.githubusercontent.com/wulabing/Xray_onekey/${github_branch}/install.sh | grep "shell_version=" | head -1 | awk -F '=|"' '{print $3}')
|
ol_version=$(curl -L -s https://raw.githubusercontent.com/wulabing/Xray_onekey/${github_branch}/install.sh | grep "shell_version=" | head -1 | awk -F '=|"' '{print $3}')
|
||||||
echo "$ol_version" >$version_cmp
|
if [[ "$shell_version" != "$(echo -e "$shell_version\n$ol_version" | sort -rV | head -1)" ]]; then
|
||||||
echo "$shell_version" >>$version_cmp
|
|
||||||
if [[ "$shell_version" != "$(sort -rV $version_cmp | head -1)" ]]; then
|
|
||||||
print_ok "存在新版本,是否更新 [Y/N]?"
|
print_ok "存在新版本,是否更新 [Y/N]?"
|
||||||
read -r update_confirm
|
read -r update_confirm
|
||||||
case $update_confirm in
|
case $update_confirm in
|
||||||
|
@ -439,12 +439,8 @@ function ssl_judge_and_install() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function generate_certificate() {
|
function generate_certificate() {
|
||||||
openssl genrsa -des3 -passout pass:xxxx -out server.pass.key 2048
|
openssl genrsa -out $cert_dir/self_signed_key.pem 2048
|
||||||
openssl rsa -passin pass:xxxx -in server.pass.key -out "$cert_dir/self_signed_key.pem"
|
openssl req -new -x509 -days 3650 -key $cert_dir/self_signed_key.pem -out $cert_dir/self_signed_cert.pem -subj "/CN=$local_ip"
|
||||||
rm -rf server.pass.key
|
|
||||||
openssl req -new -key "$cert_dir/self_signed_key.pem" -out server.csr -subj "/CN=$local_ip"
|
|
||||||
openssl x509 -req -days 3650 -in server.csr -signkey "$cert_dir/self_signed_key.pem" -out "$cert_dir/self_signed_cert.pem"
|
|
||||||
rm -rf server.csr
|
|
||||||
[[ ! -f "$cert_dir/self_signed_cert.pem" || ! -f "$cert_dir/self_signed_key.pem" ]] && print_error "生成自签名证书失败"
|
[[ ! -f "$cert_dir/self_signed_cert.pem" || ! -f "$cert_dir/self_signed_key.pem" ]] && print_error "生成自签名证书失败"
|
||||||
print_ok "生成自签名证书成功"
|
print_ok "生成自签名证书成功"
|
||||||
chown nobody.$cert_group $cert_dir/self_signed_cert.pem
|
chown nobody.$cert_group $cert_dir/self_signed_cert.pem
|
||||||
|
@ -455,7 +451,7 @@ function configure_web() {
|
||||||
rm -rf /www/xray_web
|
rm -rf /www/xray_web
|
||||||
mkdir -p /www/xray_web
|
mkdir -p /www/xray_web
|
||||||
# 该处保留引用源
|
# 该处保留引用源
|
||||||
wget -O web.tar.gz https://github.com/jiuqi9997/xray-yes/raw/main/web.tar.gz
|
wget -O web.tar.gz https://github.com/jiuqi9997/Xray-yes/raw/main/web.tar.gz
|
||||||
tar xzf web.tar.gz -C /www/xray_web
|
tar xzf web.tar.gz -C /www/xray_web
|
||||||
judge "站点伪装"
|
judge "站点伪装"
|
||||||
rm -f web.tar.gz
|
rm -f web.tar.gz
|
||||||
|
|
Loading…
Reference in New Issue