694480f2ae
ci/woodpecker/push/woodpecker Pipeline was successful
- Replace LOG_D calls with debug() function - Replace LOG_I calls with info() function - Maintain echo() in build-time overrides script - Fix 'command not found' errors for LOG_I function - Ensure consistent logging format across all runtime scripts Modified files: - customer/usr/local/bin/common.sh: 4 LOG_D -> debug calls - customer/usr/local/bin/setup.sh: 3 LOG_I -> info, 1 LOG_D -> debug calls - customer/usr/local/bin/run.sh: 2 LOG_I -> info calls - customer/usr/local/bin/entry.sh: already using info() calls (no changes needed)
36 lines
1.5 KiB
Bash
Executable File
36 lines
1.5 KiB
Bash
Executable File
#!/bin/bash
|
|
# Ver: 1.3 by Endial Fang (endial@126.com)
|
|
#
|
|
# 应用环境及依赖文件设置脚本;当前脚本以‘root’用户执行
|
|
|
|
# 设置 shell 执行参数,可使用'-'(打开)'+'(关闭)控制。常用:
|
|
# -e: 命令执行错误则报错(errexit); -u: 变量未定义则报错(nounset); -x: 打印实际待执行的命令行; -o pipefail: 设置管道中命令遇到失败则报错
|
|
set -euo pipefail
|
|
|
|
. /usr/local/lib/libcommon.sh # 加载通用函数库
|
|
. /usr/local/lib/libfs.sh # 加载文件操作函数库
|
|
. /usr/local/lib/libos.sh # 加载系统管理函数库
|
|
|
|
. /usr/local/bin/environment.sh # 设置环境变量
|
|
. /usr/local/bin/common.sh # 应用专用函数库
|
|
|
|
info "** Processing setup.sh **"
|
|
|
|
APP_DIRS=(/var/log/${APP_NAME} /var/run/${APP_NAME} /var/cache/${APP_NAME} ${APP_HOME})
|
|
APP_DIRS+=(${APP_HOME}/conf ${APP_HOME}/data ${APP_HOME}/cert ${APP_HOME}/log)
|
|
|
|
info "Ensure directory exists: ${APP_DIRS[@]}"
|
|
for dir in ${APP_DIRS[@]}; do
|
|
ensure_dir_exists ${dir}
|
|
done
|
|
|
|
# 检测指定文件是否在配置文件存储目录存在,如果不存在则拷贝(新挂载数据卷、手动删除都会导致不存在)
|
|
info "Check config files in: ${APP_CONF_DIR}"
|
|
if [[ -z "$(ls -A "${APP_CONF_DIR}")" ]]; then
|
|
app_ensure_config_file_exist "${APP_CONF_DIR}" "${APP_DEF_DIR}" $(ls -A "${APP_DEF_DIR}")
|
|
fi
|
|
|
|
# 解决使用non-root后,[emerg] open() "/dev/stdout" failed (13: Permission denied)
|
|
debug "Change permissions of stdout/stderr to 0662"
|
|
chmod 0662 /dev/stdout /dev/stderr
|