Skip to content

Commit

Permalink
适配自动化测试
Browse files Browse the repository at this point in the history
  • Loading branch information
Mzdyl committed Jan 21, 2024
1 parent 3568c8e commit 9ce0d8e
Showing 1 changed file with 24 additions and 5 deletions.
29 changes: 24 additions & 5 deletions install_linux.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
echo "请输入您的密码以提升权限:"
sudo -v
#!/bin/bash

if [ "$GITHUB_ACTIONS" == "true" ]; then
echo "Detected GitHub Actions environment. Setting default values for non-interactive mode."
# 设置在 GitHub Actions 环境中的默认值
custompluginsDir="$HOME/.config/LiteLoader-Plugins"
modify_env_choice="y"
else
# 如果不在 GitHub Actions 环境中,继续使用用户输入
echo "请输入您的密码以提升权限:"
sudo -v

read -p "是否通过环境变量修改插件目录 (y/N): " modify_env_choice

if [ "$modify_env_choice" = "y" ] || [ "$modify_env_choice" = "Y" ]; then
read -p "请输入LiteLoader插件目录(默认为$HOME/.config/LiteLoader-Plugins): " custompluginsDir
custompluginsDir=${custompluginsDir:-"$HOME/.config/LiteLoader-Plugins"}
echo "插件目录: $custompluginsDir"
fi

fi

echo "正在拉取最新版本的仓库..."
cd /tmp
Expand All @@ -9,6 +28,7 @@ git clone https://github.com/LiteLoaderQQNT/LiteLoaderQQNT.git LiteLoader
# 移动到安装目录
echo "拉取完成,正在安装LiteLoader..."
sudo cp -f LiteLoader/src/preload.js /opt/QQ/resources/app/application/preload.js

# 如果目标目录存在且不为空,则先备份处理
if [ -e "/opt/QQ/resources/app/LiteLoader" ]; then
# 删除上次的备份
Expand All @@ -18,6 +38,7 @@ if [ -e "/opt/QQ/resources/app/LiteLoader" ]; then
mv "/opt/QQ/resources/app/LiteLoader" "/opt/QQ/resources/app/LiteLoader_bak"
echo "已将原LiteLoader目录备份为LiteLoader_bak"
fi

# 移动LiteLoader
sudo mv -f LiteLoader /opt/QQ/resources/app

Expand All @@ -33,8 +54,7 @@ if [ -d "/opt/QQ/resources/app/LiteLoader_bak/data" ]; then
echo "已将 LiteLoader_bak 中旧数据复制到新的 LiteLoader 目录"
fi

read -p "是否通过环境变量修改插件目录 (y/N): " modify_env_choice
if [ "$modify_env_choice" = "y" ] || [ "$modify_env_choice" = "Y" ]; then
if [ "$modify_env_choice" = "y" ] || [ "$modify_env_choice" = "Y" ]; then
# 自定义插件,默认为~/.config/LiteLoader-Plugins
read -p "请输入LiteLoader插件目录(默认为$HOME/.config/LiteLoader-Plugins): " custompluginsDir
pluginsDir=${custompluginsDir:-"$HOME/.config/LiteLoader-Plugins"}
Expand Down Expand Up @@ -67,7 +87,6 @@ fi

source $config_file


# 进入安装目录
cd /opt/QQ/resources/app/app_launcher

Expand Down

0 comments on commit 9ce0d8e

Please sign in to comment.