Update install.sh

This commit is contained in:
MasoudKhz 2023-07-04 11:00:34 +03:30 committed by GitHub
parent af4b94ab0a
commit 3da562a65d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -80,16 +80,16 @@ config_after_install() {
read -p "Please set up the panel port:" config_port
echo -e "${yellow}Your panel port is:${config_port}${plain}"
echo -e "${yellow}Initializing, please wait...${plain}"
/usr/local/3x-ui-p1/x-ui setting -username ${config_account} -password ${config_password}
/usr/local/x-ui/x-ui setting -username ${config_account} -password ${config_password}
echo -e "${yellow}Account name and password set successfully!${plain}"
/usr/local/3x-ui-p1/x-ui setting -port ${config_port}
/usr/local/x-ui/x-ui setting -port ${config_port}
echo -e "${yellow}Panel port set successfully!${plain}"
else
echo -e "${red}cancel...${plain}"
if [[ ! -f "/etc/x-ui/x-ui.db" ]]; then
local usernameTemp=$(head -c 6 /dev/urandom | base64)
local passwordTemp=$(head -c 6 /dev/urandom | base64)
/usr/local/3x-ui-p1/x-ui setting -username ${usernameTemp} -password ${passwordTemp}
/usr/local/x-ui/x-ui setting -username ${usernameTemp} -password ${passwordTemp}
echo -e "this is a fresh installation,will generate random login info for security concerns:"
echo -e "###############################################"
echo -e "${green}username:${usernameTemp}${plain}"
@ -100,7 +100,7 @@ config_after_install() {
echo -e "${red} this is your upgrade,will keep old settings,if you forgot your login info,you can type x-ui and then type 7 to check${plain}"
fi
fi
/usr/local/3x-ui-p1/x-ui migrate
/usr/local/x-ui/x-ui migrate
}
install_x-ui() {
@ -114,7 +114,7 @@ install_x-ui() {
exit 1
fi
echo -e "Got x-ui latest version: ${last_version}, beginning the installation..."
wget -N --no-check-certificate -O /usr/local/x-ui-linux-$(arch3xui).tar.gz https://github.com/MasoudKhz/3x-ui/archive/refs/tags/p1.tar.gz
wget -N --no-check-certificate -O /usr/local/x-ui.tar.gz https://github.com/MasoudKhz/3x-ui/archive/refs/tags/p1.tar.gz
if [[ $? -ne 0 ]]; then
echo -e "${red}Downloading x-ui failed, please be sure that your server can access Github ${plain}"
exit 1
@ -123,14 +123,14 @@ install_x-ui() {
last_version=$1
url="https://github.com/MasoudKhz/3x-ui/archive/refs/tags/p1.tar.gz"
echo -e "Begining to install x-ui $1"
wget -N --no-check-certificate -O /usr/local/x-ui-linux-$(arch3xui).tar.gz ${url}
wget -N --no-check-certificate -O /usr/local/x-ui.tar.gz ${url}
if [[ $? -ne 0 ]]; then
echo -e "${red}Download x-ui $1 failed,please check the version exists ${plain}"
exit 1
fi
fi
if [[ -e /usr/local/3x-ui-p1/ ]]; then
rm /usr/local/3x-ui-p1/ -rf
if [[ -e /usr/local/x-ui/ ]]; then
rm /usr/local/x-ui/ -rf
fi
tar zxvf x-ui-linux-$(arch3xui).tar.gz
@ -139,7 +139,7 @@ install_x-ui() {
chmod +x x-ui bin/xray-linux-$(arch3xui)
cp -f x-ui.service /etc/systemd/system/
wget --no-check-certificate -O /usr/bin/x-ui https://raw.githubusercontent.com/MasoudKhz/3x-ui/main/x-ui.sh
chmod +x /usr/local/3x-ui-p1/x-ui.sh
chmod +x /usr/local/x-ui/x-ui.sh
chmod +x /usr/bin/x-ui
config_after_install
#echo -e "If it is a new installation, the default web port is ${green}2053${plain}, The username and password are ${green}admin${plain} by default"