Skip to content

Commit

Permalink
fix: osx script
Browse files Browse the repository at this point in the history
  • Loading branch information
trueai-org committed Jun 20, 2024
1 parent 619e9c1 commit 3f62a38
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dotnet-osx-arm64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
run: |
mkdir -p temp_publish
cp -r src/MDriveSync.Client.API/bin/Release/net8.0/osx-arm64/publish/* temp_publish/
cp scripts/run_app.sh temp_publish/
cp scripts/run_app_osx.sh temp_publish/
- name: 压缩构建产物为 tar.gz
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dotnet-osx-x64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
run: |
mkdir -p temp_publish
cp -r src/MDriveSync.Client.API/bin/Release/net8.0/osx-x64/publish/* temp_publish/
cp scripts/run_app.sh temp_publish/
cp scripts/run_app_osx.sh temp_publish/
- name: 压缩构建产物为 tar.gz
run: |
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ d. 启动方式2: chmod +x run_app.sh && ./run_app.sh
```bash
a. 通过 https://github.com/trueai-org/mdrive/releases 下载 macOS 最新免安装版,例如:MDrive-osx-x64.zip
b. 解压到当前目录: tar -xzf MDrive-osx-x64-<VERSION>.tar.gz
c. 执行: run_app.sh
c. 启动方式1: sh run_app.sh
d. 启动方式2: chmod +x run_app.sh && ./run_app.sh
c. 执行: run_app_osx.sh
c. 启动方式1: sh run_app_osx.sh
d. 启动方式2: chmod +x run_app_osx.sh && ./run_app_osx.sh
```

### 在线预览
Expand Down
2 changes: 1 addition & 1 deletion scripts/run_app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ if [ $? -ne 0 ]; then
exit 1
else
echo "应用程序执行成功。"
fi
fi
30 changes: 30 additions & 0 deletions scripts/run_app_osx.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash

# 获取脚本所在目录
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

# 应用程序名称
APP_NAME="MDriveSync.Client.API"

# 检查应用程序文件是否存在
if [ ! -f "$DIR/$APP_NAME" ]; then
echo "错误:应用程序文件 $DIR/$APP_NAME 不存在。"
exit 1
fi

# 移除应用程序的隔离属性
xattr -d com.apple.quarantine "$DIR/$APP_NAME"

# 赋予应用程序执行权限
chmod +x "$DIR/$APP_NAME"

# 执行应用程序
"$DIR/$APP_NAME"

# 检查应用程序退出状态
if [ $? -ne 0 ]; then
echo "错误:应用程序执行失败。"
exit 1
else
echo "应用程序执行成功。"
fi

0 comments on commit 3f62a38

Please sign in to comment.