diff --git a/README.md b/README.md index 0dd0481..be78f89 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,11 @@ ## 2. 安装 ### Release 下载 -直接前往 [Release](https://github.com/Ericwyn/EzeTranslate/releases) 下载即可 +直接前往 [Release](https://github.com/Ericwyn/EzeTranslate/releases) 下载即可, 提供以下类型安装包 +- 二进制执行文件安装包 + - 解压之后可直接运行 +- .deb 安装包, 需要 `sudo dpkg -i` 方式安装 + - ubuntu 22 / ubuntu 20 上测试通过 ### 编译安装 ```shell diff --git a/RELEASE_LOG.md b/RELEASE_LOG.md index 7b7a1dc..d10ea5d 100644 --- a/RELEASE_LOG.md +++ b/RELEASE_LOG.md @@ -1,4 +1,9 @@ # EzeTranslate Release Log +## V1.4 +- 发布: 2024-03-01 +- 说明 + 1. 更新 Fyne 版本 + 2. 支持 debian 安装包 ## V1.4 - 发布: 2022-11-22 diff --git a/build-deb.sh b/build-deb.sh index bc89d6d..6c21739 100644 --- a/build-deb.sh +++ b/build-deb.sh @@ -25,7 +25,10 @@ echo "" # 复制 deb-build-tpl 到 $TARGET_DIR/EzeTranslate-deb 里面 # 复制 EzeTranslate, config.yaml, res-static/ 到 $TARGET_DIR/EzeTranslate-deb/opt/EzeTranslate/ 里 cp -r "./deb-build-tpl" "$TARGET_DIR/eze-translate" -cp -r "./EzeTranslate" "./config.yaml" "./res-static" "$TARGET_DIR/eze-translate/opt/EzeTranslate" +mkdir -p "$TARGET_DIR/eze-translate/opt/EzeTranslate" + +cp -r "./EzeTranslate" "./res-static" "$TARGET_DIR/eze-translate/opt/EzeTranslate" +cp "./config.yaml" "$TARGET_DIR/eze-translate/opt/EzeTranslate/default-config.yaml" # 开始 build deb cd "$TARGET_DIR" diff --git a/deb-build-tpl/DEBIAN/postinst b/deb-build-tpl/DEBIAN/postinst index 4df60be..51f9357 100755 --- a/deb-build-tpl/DEBIAN/postinst +++ b/deb-build-tpl/DEBIAN/postinst @@ -3,4 +3,12 @@ # 创建符号链接, 使得安装之后可以在命令行调用 EzeTranslate ln -sf /opt/EzeTranslate/EzeTranslate /usr/bin/EzeTranslate +# 检查 config.yaml 是否存在 +CONFIG_PATH="/opt/EzeTranslate/config.yaml" +if [ ! -f "$CONFIG_PATH" ]; then + # 如果 config.yaml 不存在,则复制或创建文件 + # 假设您的默认配置文件位于 DEBIAN/config.yaml + cp /opt/EzeTranslate/default-config.yaml "$CONFIG_PATH" +fi + exit 0 diff --git a/ui/resource/loader.go b/ui/resource/loader.go index ea38b3c..805b571 100644 --- a/ui/resource/loader.go +++ b/ui/resource/loader.go @@ -15,6 +15,13 @@ var runnerPath = "" func GetRunnerPath() string { if runnerPath == "" { + // 如果 /opt/EzeTranslate/config.yaml 存在的话, 优先使用 /opt/EzeTranslate/ 作为 runPath + if _, err := os.Stat("/opt/EzeTranslate/config.yaml"); err == nil { + runnerPath = "/opt/EzeTranslate/" + log.D("程序运行目录:" + runnerPath) + return runnerPath + } + //返回绝对路径 filepath.Dir(os.Args[0])去除最后一个元素的路径 log.D("os.Args[0]:" + os.Args[0])