From 32fce0adb6f182ccdf71f6dc7519aec335303414 Mon Sep 17 00:00:00 2001 From: Zzm0809 <934230207@qq.com> Date: Sun, 8 Dec 2024 23:34:23 +0800 Subject: [PATCH] Fix automation script path issue --- script/bin/auto.sh | 13 +++++++++++++ script/bin/init_tools_main.sh | 35 +++++++++++++++++++++++++++++------ 2 files changed, 42 insertions(+), 6 deletions(-) diff --git a/script/bin/auto.sh b/script/bin/auto.sh index 37b10141f3..306eaee08c 100644 --- a/script/bin/auto.sh +++ b/script/bin/auto.sh @@ -11,6 +11,19 @@ export CYAN='\033[36m' export RESET='\033[0m' +ENV_FILE="/etc/profile.d/dinky_env" +if [ -f "${ENV_FILE}" ]; then + source "${ENV_FILE}" +fi + +DB_ENV_FILE="/etc/profile.d/dinky_db" +if [ -f "${DB_ENV_FILE}" ]; then + source "${DB_ENV_FILE}" +fi + +source /etc/profile + + if [ -z "${DINKY_HOME}" ]; then echo -e "${RED}DINKY_HOME environment variable is not set. Attempting to determine the correct path...${RESET}" diff --git a/script/bin/init_tools_main.sh b/script/bin/init_tools_main.sh index fb35daea5e..7c5b1a35ca 100644 --- a/script/bin/init_tools_main.sh +++ b/script/bin/init_tools_main.sh @@ -324,9 +324,32 @@ while true; do esac done echo -e "${GREEN} ====================== Database configuration file initialization script -> End ====================== ${RESET}" -echo -echo -echo -e "${RED}Note: To make these changes permanent, you may need to restart your terminal or run 'source $DB_ENV_FILE && source $ENV_FILE' ${RESET}" -echo -e "${RED}Note: To make these changes permanent, you may need to restart your terminal or run 'source $DB_ENV_FILE && source $ENV_FILE' ${RESET}" -echo -e "${RED}Note: To make these changes permanent, you may need to restart your terminal or run 'source $DB_ENV_FILE && source $ENV_FILE' ${RESET}" -echo + +while true; do + read -p "Do you need to start the Dinky service?(yes/no/exit)" is_start + is_start=$(echo "$is_start" | tr '[:upper:]' '[:lower:]' | tr -d '[:space:]') + case $is_start in + yes | y ) + # Use source transparent transmission in debug mode + source "${APP_HOME}/bin/auto.sh restart" + break + ;; + no | n ) + echo -e "${RED}Note: To make these changes permanent, you may need to restart your terminal or run 'source $DB_ENV_FILE && source $ENV_FILE' ${RESET}" + echo -e "${RED}Note: To make these changes permanent, you may need to restart your terminal or run 'source $DB_ENV_FILE && source $ENV_FILE' ${RESET}" + echo -e "${RED}Note: To make these changes permanent, you may need to restart your terminal or run 'source $DB_ENV_FILE && source $ENV_FILE' ${RESET}" + echo + echo -e "${GREEN}The Dinky service startup script has been skipped, 请先执行上述命令,然后手动启动服务 -> ${APP_HOME}/bin/auto.sh restart | start。${RESET}" + break + ;; + exit | e ) + echo -e "${GREEN}If you choose exit, the program will exit。${RESET}" + exit 0 + ;; + *) + echo -e "${RED}Invalid input, please re-enter yes/no/exit。${RESET}" + ;; + esac +done + +echo -e "${GREEN} ====================== Dinky initialization script execution completed ====================== ${RESET}"