From acf170434951cf0e8fdb958feb9398c887e726ea Mon Sep 17 00:00:00 2001 From: Akatsukiro Date: Sun, 21 Apr 2024 11:21:46 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=85=A8=E8=87=AA=E5=8A=A8=E5=AE=89?= =?UTF-8?q?=E8=A3=85=20=E9=85=8D=E7=BD=AE=E6=95=B0=E6=8D=AE=E5=BA=93?= =?UTF-8?q?=E9=83=A8=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- install.sh | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/install.sh b/install.sh index 14e7d1f..fd71d0b 100644 --- a/install.sh +++ b/install.sh @@ -236,21 +236,26 @@ install_maraidb setup_database() { echo -e "${green}开始配置数据库${plain}" echo -e "${yellow}请无比妥善保存以下信息${plain}" - echo "自动生成数据库信息请输入1,手动输入请输入2,其他情况自动生成" - read -e -r -p "请输入您的选择: " dbFlag - if [[ $dbFlag == "1" ]]; then - db_user="lsky_$(openssl rand -base64 12 | tr -dc 'a-z0-9' | fold -w 8 | head -n 1)" - db_name="lsky_$(openssl rand -base64 12 | tr -dc 'a-z0-9' | fold -w 8 | head -n 1)" - db_password="$(openssl rand -base64 32 | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)" - elif [[ $dbFlag == "2" ]]; then - read -e -r -p "请输入数据库用户名: " db_user - read -e -r -p "请输入数据库名称: " db_name - read -e -r -p "请输入数据库密码: " db_password + if [[autoFlag == "0" ]] + echo "自动生成数据库信息请输入1,手动输入请输入2,其他情况自动生成" + read -e -r -p "请输入您的选择: " dbFlag + if [[ $dbFlag == "1" ]]; then + db_user="lsky_$(openssl rand -base64 12 | tr -dc 'a-z0-9' | fold -w 8 | head -n 1)" + db_name="lsky_$(openssl rand -base64 12 | tr -dc 'a-z0-9' | fold -w 8 | head -n 1)" + db_password="$(openssl rand -base64 32 | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)" + elif [[ $dbFlag == "2" ]]; then + read -e -r -p "请输入数据库用户名: " db_user + read -e -r -p "请输入数据库名称: " db_name + read -e -r -p "请输入数据库密码: " db_password + else + db_user="lsky_$(openssl rand -base64 12 | tr -dc 'a-z0-9' | fold -w 8 | head -n 1)" + db_name="lsky_$(openssl rand -base64 12 | tr -dc 'a-z0-9' | fold -w 8 | head -n 1)" + db_password="$(openssl rand -base64 32 | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)" + fi else db_user="lsky_$(openssl rand -base64 12 | tr -dc 'a-z0-9' | fold -w 8 | head -n 1)" db_name="lsky_$(openssl rand -base64 12 | tr -dc 'a-z0-9' | fold -w 8 | head -n 1)" db_password="$(openssl rand -base64 32 | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)" - fi echo -e "${yellow}数据库用户名: ${db_user}${plain}" echo -e "${yellow}数据库名称: ${db_name}${plain}" echo -e "${yellow}数据库密码: ${db_password}${plain}"