app_audit/build.sh

32 lines
967 B
Bash
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# app_audit module build script
# 链接 wwwroot 到宿主应用Sage 或 pipeline
# 审计表在宿主部署期由 create_tables.py 建owner.audit 角色由 import_init.py 从 init/data.json 导入。
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# 查找宿主应用根目录(含 wwwroot 目录)
APP_ROOT=""
for candidate in "$SCRIPT_DIR/../.." "$HOME/repos/sage" "$HOME/sage" "$HOME/work/repos/sage"; do
if [ -d "$candidate/wwwroot" ]; then
APP_ROOT="$(cd "$candidate" && pwd)"
break
fi
done
if [ -z "$APP_ROOT" ]; then
echo "ERROR: host app root not found"
exit 1
fi
echo "Host app root: $APP_ROOT"
# 链接 wwwroot 到宿主应用
rm -f "$APP_ROOT/wwwroot/app_audit"
ln -sf "$SCRIPT_DIR/wwwroot" "$APP_ROOT/wwwroot/app_audit"
echo "app_audit module build complete (wwwroot linked)."
echo "提示Python 包需 pip install . RBAC 权限用 scripts/load_path.py 注册。"