From 6325fb51cc8fff0a9c3cc2759126f38d6aa1fefe Mon Sep 17 00:00:00 2001 From: Jokul Date: Sun, 19 Jul 2026 16:43:55 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20install.sh=20=E6=B8=85=E7=90=86=20QML=20?= =?UTF-8?q?=E7=A3=81=E7=9B=98=E7=BC=93=E5=AD=98=E5=92=8C=E5=AE=89=E8=A3=85?= =?UTF-8?q?=E7=9B=AE=E5=BD=95=E6=AE=8B=E7=95=99=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- install.sh | 50 ++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 38 insertions(+), 12 deletions(-) diff --git a/install.sh b/install.sh index 74aba8a..08328a7 100755 --- a/install.sh +++ b/install.sh @@ -4,23 +4,49 @@ set -e -echo "Building JNetApplet..." +INSTALL_DIR="/usr/share/dde-shell/space.jokul.JNetApplet" +SO_DIR="/usr/lib/x86_64-linux-gnu/dde-shell" -# 清理旧的构建目录 +echo "=== JNetApplet 安装脚本 ===" + +# 1. 清理旧的构建目录 +echo "[1/6] 清理构建目录..." rm -rf build -# 配置CMake -cmake -Bbuild - -# 构建 +# 2. 配置 + 构建 +echo "[2/6] 配置 CMake 并构建..." +cmake -B build cmake --build build -echo "Installing JNetApplet (requires sudo)..." +# 3. 清理安装目录中残留的旧文件(包括之前重构产生的多余 QML 文件) +echo "[3/6] 清理安装目录中的旧文件..." +if [ -d "$INSTALL_DIR" ]; then + sudo rm -f "$INSTALL_DIR"/*.qml "$INSTALL_DIR"/*.qmlc +fi -# 安装 +# 4. 清理 Qt QML 磁盘缓存(关键!否则 dde-shell 可能使用旧的编译缓存) +echo "[4/6] 清理 QML 磁盘缓存..." +rm -rf ~/.cache/preloader/qmlcache/ 2>/dev/null || true +find ~/.cache -path "*/dde-shell*" -name "*.qmlc" -delete 2>/dev/null || true + +# 5. 安装 +echo "[5/6] 安装插件(需要 sudo)..." sudo cmake --install build -echo "Installation complete!" -echo "Restarting dde-shell..." -systemctl --user restart dde-shell@DDE -echo "Done! Plugin loaded." \ No newline at end of file +# 验证安装结果 +echo "" +echo "=== 安装验证 ===" +echo "QML 文件:" +ls -la "$INSTALL_DIR"/*.qml 2>/dev/null || echo " [警告] 未找到 QML 文件!" +echo "动态库:" +ls -la "$SO_DIR"/space.jokul.JNetApplet.so 2>/dev/null || echo " [警告] 未找到 .so 文件!" +echo "metadata.json 版本:" +grep '"Version"' "$INSTALL_DIR/metadata.json" 2>/dev/null || echo " [警告] 未找到 metadata.json!" +echo "" + +# 6. 重启 dde-shell +echo "[6/6] 重启 dde-shell..." +systemctl --user stop dde-shell@DDE 2>/dev/null || true +sleep 1 +systemctl --user start dde-shell@DDE +echo "完成!插件已加载。"