Files
daiyongkang 76f266645d Initial commit: 风影 OA 全栈源码(API/Web/Flutter/IM)
含 Phase 1.1 IM seq 排序、断线重连、多端已读同步与微信式语音转文字 UI。
排除 node_modules、构建产物、安装包与 .env 密钥。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-02 10:04:03 +00:00

108 lines
3.4 KiB
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.
#!/usr/bin/env bash
# 构建 Linux .deb(Ubuntu / Debian / Deepin 25 amd64)
set -euo pipefail
cd "$(dirname "$0")/.."
export PATH="/opt/flutter/bin:$PATH"
export PUB_HOSTED_URL="${PUB_HOSTED_URL:-https://pub.dev}"
export FLUTTER_STORAGE_BASE_URL="${FLUTTER_STORAGE_BASE_URL:-https://storage.googleapis.com}"
APP_ID="com.fysxkj.fengying_oa"
APP_NAME="风影办公"
VERSION="${1:-3.1.10}"
BUILD="${2:-324}"
PKG="fengying-oa"
DEB="${PKG}_${VERSION}-${BUILD}_amd64.deb"
echo "== Flutter build linux ${VERSION}+${BUILD} =="
flutter pub get
flutter build linux --release --build-name="$VERSION" --build-number="$BUILD"
BUNDLE="build/linux/x64/release/bundle"
STAGE="build/deb-stage"
rm -rf "$STAGE"
mkdir -p "$STAGE/DEBIAN"
mkdir -p "$STAGE/opt/${PKG}"
mkdir -p "$STAGE/usr/bin"
mkdir -p "$STAGE/usr/share/applications"
mkdir -p "$STAGE/usr/share/icons/hicolor/256x256/apps"
cp -a "$BUNDLE/." "$STAGE/opt/${PKG}/"
# 图标:优先用 bundle 内 icon,否则占位
if [ -f "$BUNDLE/data/flutter_assets/assets/icon.png" ]; then
cp "$BUNDLE/data/flutter_assets/assets/icon.png" "$STAGE/usr/share/icons/hicolor/256x256/apps/${APP_ID}.png"
elif [ -f "assets/icon.png" ]; then
cp "assets/icon.png" "$STAGE/usr/share/icons/hicolor/256x256/apps/${APP_ID}.png"
else
convert -size 256x256 xc:'#07C160' -fill white -gravity center -pointsize 48 -annotate 0 '风影' \
"$STAGE/usr/share/icons/hicolor/256x256/apps/${APP_ID}.png" 2>/dev/null || \
cp "$BUNDLE/fengying_oa" "$STAGE/usr/share/icons/hicolor/256x256/apps/${APP_ID}.png" 2>/dev/null || true
fi
cat > "$STAGE/usr/share/applications/${APP_ID}.desktop" <<EOF
[Desktop Entry]
Name=${APP_NAME}
Comment=风影智慧办公综合平台
Exec=/usr/bin/${PKG}
Icon=${APP_ID}
Terminal=false
Type=Application
Categories=Office;Network;
StartupWMClass=fengying_oa
EOF
cat > "$STAGE/usr/bin/${PKG}" <<'EOF'
#!/bin/sh
APP_DIR="/opt/fengying-oa"
export LD_LIBRARY_PATH="${APP_DIR}/lib:${LD_LIBRARY_PATH:-}"
cd "$APP_DIR" || exit 1
exec "$APP_DIR/fengying_oa" "$@"
EOF
chmod 755 "$STAGE/usr/bin/${PKG}"
cat > "$STAGE/DEBIAN/control" <<EOF
Package: ${PKG}
Version: ${VERSION}-${BUILD}
Section: office
Priority: optional
Architecture: amd64
Maintainer: 江苏风影随行科技有限公司 <13142801138@fysxkj.com>
Homepage: https://oa.fysxkj.com
Depends: libgtk-3-0, libglib2.0-0, libgstreamer1.0-0, libgstreamer-plugins-base1.0-0, libsecret-1-0, libsqlite3-0, libstdc++6, ca-certificates, zenity | kdialog
Description: 风影智慧办公综合平台
企业微信风格桌面客户端,支持消息、工作台、审批、考勤等。
适配 Ubuntu 22.04+、Debian 12+、Deepin 25 等 amd64 系统。
EOF
cat > "$STAGE/DEBIAN/postinst" <<'EOF'
#!/bin/sh
set -e
if command -v update-desktop-database >/dev/null 2>&1; then
update-desktop-database /usr/share/applications || true
fi
if command -v gtk-update-icon-cache >/dev/null 2>&1; then
gtk-update-icon-cache -f -t /usr/share/icons/hicolor 2>/dev/null || true
fi
EOF
chmod 755 "$STAGE/DEBIAN/postinst"
cat > "$STAGE/DEBIAN/prerm" <<'EOF'
#!/bin/sh
set -e
exit 0
EOF
chmod 755 "$STAGE/DEBIAN/prerm"
mkdir -p build
rm -f "build/${DEB}"
dpkg-deb --root-owner-group --build "$STAGE" "build/${DEB}"
cp "build/${DEB}" "build/fengying-oa_amd64.deb"
echo "Built: build/${DEB}"
echo "Stable URL copy: build/fengying-oa_amd64.deb"
ls -lh "build/${DEB}" "build/fengying-oa_amd64.deb"
# 同时保留 tar.gz 便于手动解压
tar -czf "build/fengying-oa-linux.tar.gz" -C "$BUNDLE" .
echo "Also: build/fengying-oa-linux.tar.gz"