mirror of
https://gitcode.com/JianFeeeee/TrulyMEM-TrueHumanMEM.git
synced 2026-10-15 12:15:32 +00:00
feat: 日志持久化(6h归档) + purge增强(source_type/source_has_status过滤)
- ActivityRecorder 新增 LogPersister 后台线程,每10s增量写入logs/operations.*.log - 日志每6小时自动gzip压缩归档 - memory_purge 新增 source_type / target_type / source_has_status 过滤条件 - 支持精准清理已归档任务的残留 HAS_STATE 关系
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
set -euo pipefail
|
||||
|
||||
echo "===== Building TrulyMEM AppImage ====="
|
||||
|
||||
@ -11,39 +11,65 @@ echo "Project root: $PROJECT_ROOT"
|
||||
APP_NAME="TrulyMEM"
|
||||
APP_DIR="$PROJECT_ROOT/build/appimage-build"
|
||||
|
||||
echo "Cleaning..."
|
||||
rm -rf "$APP_DIR" dist/ build/trulymem/ 2>/dev/null || true
|
||||
# ── Step 1: 复用 build_linux.sh 完成 PyInstaller 构建 ──
|
||||
echo ""
|
||||
echo "Step 1: Running build_linux.sh (PyInstaller build)..."
|
||||
bash "$SCRIPT_DIR/build_linux.sh"
|
||||
|
||||
# Step 1: Build with PyInstaller (uses icon from .spec)
|
||||
echo "Step 1: PyInstaller build..."
|
||||
python3 -m PyInstaller --clean build/trulymem.spec --noconfirm
|
||||
# ── Step 2: 检查 dist/ 中是否有二进制 ──
|
||||
echo ""
|
||||
echo "Step 2: Checking PyInstaller output..."
|
||||
if [ ! -f "dist/$APP_NAME" ]; then
|
||||
echo "Error: dist/$APP_NAME not found after build_linux.sh"; exit 1
|
||||
fi
|
||||
echo "✅ Found dist/$APP_NAME ($(ls -lh "dist/$APP_NAME" | awk '{print $5}'))"
|
||||
|
||||
# Step 2: Prepare AppDir structure
|
||||
echo "Step 2: Preparing AppDir..."
|
||||
# ── Step 3: 组织 AppDir 结构 ──
|
||||
echo ""
|
||||
echo "Step 3: Preparing AppDir structure..."
|
||||
rm -rf "$APP_DIR" 2>/dev/null || true
|
||||
mkdir -p "$APP_DIR/usr/bin"
|
||||
mkdir -p "$APP_DIR/usr/share/applications"
|
||||
mkdir -p "$APP_DIR/usr/share/icons/hicolor/256x256/apps"
|
||||
mkdir -p "$APP_DIR/usr/share/icons/hicolor/48x48/apps"
|
||||
|
||||
cp "dist/$APP_NAME" "$APP_DIR/usr/bin/"
|
||||
|
||||
# 图标处理
|
||||
ICON_SOURCE=""
|
||||
if [ -f "pic/image.png" ]; then
|
||||
cp "pic/image.png" "$APP_DIR/usr/share/icons/hicolor/256x256/apps/${APP_NAME}.png"
|
||||
cp "pic/image.png" "$APP_DIR/${APP_NAME}.png"
|
||||
else
|
||||
echo -n "" > "$APP_DIR/${APP_NAME}.png"
|
||||
ICON_SOURCE="pic/image.png"
|
||||
elif [ -f "pic/TrulyMEM.ico" ]; then
|
||||
echo "⚠️ No pic/image.png found; .ico will not display as AppImage icon"
|
||||
echo " To generate a PNG: convert pic/TrulyMEM.ico pic/image.png"
|
||||
fi
|
||||
|
||||
if [ -n "$ICON_SOURCE" ]; then
|
||||
cp "$ICON_SOURCE" "$APP_DIR/usr/share/icons/hicolor/256x256/apps/${APP_NAME}.png"
|
||||
cp "$ICON_SOURCE" "$APP_DIR/usr/share/icons/hicolor/48x48/apps/${APP_NAME}.png"
|
||||
cp "$ICON_SOURCE" "$APP_DIR/${APP_NAME}.png"
|
||||
echo "✅ Icon: $ICON_SOURCE"
|
||||
else
|
||||
echo "⚠️ No icon found, creating placeholder"
|
||||
touch "$APP_DIR/${APP_NAME}.png"
|
||||
fi
|
||||
|
||||
# .desktop 文件
|
||||
cat > "$APP_DIR/${APP_NAME}.desktop" <<EOF
|
||||
[Desktop Entry]
|
||||
Name=${APP_NAME}
|
||||
Comment=True Human Memory - TUI & Web Mode
|
||||
Exec=${APP_NAME}
|
||||
Icon=${APP_NAME}
|
||||
Type=Application
|
||||
Categories=Utility;
|
||||
Categories=Utility;Office;
|
||||
Terminal=true
|
||||
StartupNotify=true
|
||||
EOF
|
||||
|
||||
cp "$APP_DIR/${APP_NAME}.desktop" "$APP_DIR/usr/share/applications/"
|
||||
|
||||
# AppRun 入口
|
||||
cat > "$APP_DIR/AppRun" <<'APPRUN'
|
||||
#!/bin/bash
|
||||
HERE="$(dirname "$(readlink -f "$0")")"
|
||||
@ -51,15 +77,24 @@ exec "$HERE/usr/bin/TrulyMEM" "$@"
|
||||
APPRUN
|
||||
chmod +x "$APP_DIR/AppRun"
|
||||
|
||||
# Step 3: Build AppImage (requires appimagetool)
|
||||
echo "Step 3: Building AppImage..."
|
||||
# ── Step 4: 打包 AppImage ──
|
||||
echo ""
|
||||
echo "Step 4: Building AppImage..."
|
||||
if command -v appimagetool &> /dev/null; then
|
||||
appimagetool "$APP_DIR" "dist/${APP_NAME}.AppImage"
|
||||
echo "AppImage: dist/${APP_NAME}.AppImage"
|
||||
ls -la "dist/${APP_NAME}.AppImage"
|
||||
ARCH="${ARCH:-$(uname -m)}" appimagetool "$APP_DIR" "dist/${APP_NAME}.AppImage"
|
||||
echo "✅ AppImage: dist/${APP_NAME}.AppImage"
|
||||
ls -lh "dist/${APP_NAME}.AppImage"
|
||||
else
|
||||
echo "appimagetool not found. AppDir ready at: $APP_DIR"
|
||||
echo "Install appimagetool and run: appimagetool '$APP_DIR' 'dist/${APP_NAME}.AppImage'"
|
||||
echo "⚠️ appimagetool not found. AppDir ready at: $APP_DIR"
|
||||
echo ""
|
||||
echo "To complete manually, install appimagetool:"
|
||||
echo " wget https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-$(uname -m).AppImage"
|
||||
echo " chmod +x appimagetool-*.AppImage"
|
||||
echo " ./appimagetool-*.AppImage '$APP_DIR' 'dist/${APP_NAME}.AppImage'"
|
||||
echo ""
|
||||
echo "AppDir contents:"
|
||||
find "$APP_DIR" -type f | head -20
|
||||
fi
|
||||
|
||||
echo "===== AppImage Build Complete ====="
|
||||
echo ""
|
||||
echo "===== AppImage Build Complete ====="
|
||||
|
||||
Reference in New Issue
Block a user