2022-06-12 22:25:02 +08:00
|
|
|
|
#/bin/bash
|
2023-02-11 19:39:41 +08:00
|
|
|
|
# 判断安装条件
|
|
|
|
|
CheckEnv(){
|
|
|
|
|
# 检测是不是 Ubuntu
|
|
|
|
|
lsb_release -i | grep -i ubuntu
|
|
|
|
|
if [[ $? != 0 ]]; then
|
|
|
|
|
zenity --error --no-wrap '--text=您的系统无法安装 UEngine,原因:此脚本只支持 Ubuntu'
|
|
|
|
|
exit
|
|
|
|
|
fi
|
|
|
|
|
# 检测架构
|
|
|
|
|
if [[ `arch` != "x86_64" ]]; then
|
|
|
|
|
zenity --error --no-wrap '--text=您的系统无法安装 UEngine,原因:暂不支持非 X86 架构'
|
|
|
|
|
exit
|
|
|
|
|
fi
|
|
|
|
|
# 检测内核
|
2023-05-02 17:00:20 +08:00
|
|
|
|
sudo modprobe binder_linux
|
|
|
|
|
lsmod | grep -e binder_linux
|
2023-05-02 12:58:06 +08:00
|
|
|
|
if [[ $? != 0 ]]; then
|
|
|
|
|
zenity --error --no-wrap '--text=您的系统无法安装 UEngine,原因:当前内核不支持 binder 模块,请安装支持 binder 模块的 Linux 内核'
|
|
|
|
|
exit
|
2023-02-11 19:39:41 +08:00
|
|
|
|
fi
|
2023-05-02 12:58:06 +08:00
|
|
|
|
#kernel=`uname -r`
|
|
|
|
|
#python3 "${programPath}/CompareVersion.py" "${kernel}" "5.17.3"
|
|
|
|
|
#if [[ $? == 0 ]]; then
|
|
|
|
|
# zenity --warning --no-wrap "--text=提示:您当前使用的内核版本是${kernel},而一会将会安装内核 5.17.3\n如果要使用 UEngine,请在重启后选择该版本内核启动,否则无法启动"
|
|
|
|
|
#fi
|
2023-02-11 19:39:41 +08:00
|
|
|
|
#exit
|
|
|
|
|
}
|
|
|
|
|
programPath=$(cd $(dirname $0); pwd)
|
|
|
|
|
# 先判断是否符合安装条件
|
|
|
|
|
CheckEnv
|
|
|
|
|
echo 1
|
|
|
|
|
#exit
|
2023-01-12 18:59:29 +08:00
|
|
|
|
# 在 Shenmo 制作的脚本的基础上进行了修改,修复在 Wayland 下运行错误和无法安装程序的问题
|
|
|
|
|
# 建议在 Ubuntu 22.04 及以上版本安装,最好在此之前先安装星火应用商店并将系统和星火应用商店更新到最新版本
|
2023-01-15 10:08:29 +08:00
|
|
|
|
#is_tar_checked="0"
|
2022-06-12 22:25:02 +08:00
|
|
|
|
rm -rf /tmp/uengine
|
2023-01-12 18:59:29 +08:00
|
|
|
|
# 不再从网盘下载,直接从 Gitlink 拉取安装包
|
2023-01-11 11:43:00 +08:00
|
|
|
|
#until [ "$is_tar_checked" = "1" ];do
|
2022-09-10 18:42:42 +08:00
|
|
|
|
#echo "请拖入uengine.tar.xz并回车确认,可在 https://cowtransfer.com/s/44656ada129e42 下载获取。"
|
|
|
|
|
#read tar_path
|
|
|
|
|
mkdir -p /tmp/uengine
|
2023-01-15 10:08:29 +08:00
|
|
|
|
# 区分是下载 Root 镜像还是普通镜像
|
2023-01-18 15:29:44 +08:00
|
|
|
|
if [[ $1 == "SuperSU" ]]; then
|
2023-05-02 17:03:24 +08:00
|
|
|
|
aria2c -x 16 -s 16 -d /tmp/uengine -o uenginetar.xz https://code.gitlink.org.cn/gfdgd_xi/uengine-installer/raw/branch/master/uengine2.1.2.2007-supersu.tar.xz
|
|
|
|
|
else
|
2023-05-02 15:10:01 +08:00
|
|
|
|
# 改为 Github
|
|
|
|
|
aria2c -x 16 -s 16 -d /tmp/uengine -o uenginetar.xz https://github.com/rain-gfd/uengine-installer-package/releases/download/uengine2.1.2.2010/uengine2.1.2.2010.tar.xz
|
2023-01-15 10:08:29 +08:00
|
|
|
|
fi
|
2022-09-10 18:42:42 +08:00
|
|
|
|
tar_path="/tmp/uengine/uenginetar.xz"
|
2022-06-12 22:25:02 +08:00
|
|
|
|
tar_path=`echo "$tar_path" | sed $'s/\'//g'`
|
2023-01-15 10:08:29 +08:00
|
|
|
|
# 忽略md5校验
|
2022-09-10 18:42:42 +08:00
|
|
|
|
#echo "路径为 $tar_path"
|
2023-01-15 10:08:29 +08:00
|
|
|
|
#tar_md5sum=`md5sum $tar_path`
|
|
|
|
|
#tar_md5sum=`echo ${tar_md5sum%%/*}`
|
2023-01-12 18:59:29 +08:00
|
|
|
|
# 忽略 md5 校验
|
2023-01-10 17:48:01 +08:00
|
|
|
|
#if [ "$tar_md5sum" = "5668b6bb54d28406e527989348126982" ];then
|
2023-01-15 10:08:29 +08:00
|
|
|
|
#is_tar_checked="1"
|
2023-01-10 17:48:01 +08:00
|
|
|
|
#else
|
|
|
|
|
#echo $tar_md5sum
|
|
|
|
|
#echo "md5完整性检查失败,请检查是否是这个文件"
|
|
|
|
|
#sleep 3
|
|
|
|
|
#reset
|
|
|
|
|
#fi
|
|
|
|
|
#done
|
2022-06-12 22:25:02 +08:00
|
|
|
|
|
2023-01-10 17:48:01 +08:00
|
|
|
|
#echo "完整性检查通过,开始部署。部署过程会需要root权限,完成后会要求重启。请注意不要在安装过程中安装或卸载其他软件"
|
|
|
|
|
echo "开始部署。部署过程会需要root权限,完成后会要求重启。请注意不要在安装过程中安装或卸载其他软件"
|
2022-06-12 22:25:02 +08:00
|
|
|
|
cd /tmp
|
|
|
|
|
tar -xf "$tar_path"
|
2023-05-02 13:41:33 +08:00
|
|
|
|
if [[ $? != 0 ]]; then
|
|
|
|
|
echo 解压错误,无法继续
|
|
|
|
|
zenity --error --no-wrap '--text=安装错误,原因:资源解压失败!'
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
2023-01-15 16:50:11 +08:00
|
|
|
|
# 移除包内旧版的run_daemon.sh(如果有的话)
|
2023-05-02 13:09:24 +08:00
|
|
|
|
aria2c -x 16 -s 16 -d /tmp -o run_daemon.sh http://uengine-runner.gfdgdxi.top/shell/run_daemon.sh
|
2023-01-15 16:50:11 +08:00
|
|
|
|
if [[ $? == 0 ]]; then
|
|
|
|
|
# 如果下载成功,就使用下载好的 run_daemon.sh
|
|
|
|
|
if [[ -f /tmp/run_daemon.sh ]]; then
|
|
|
|
|
rm -rfv /tmp/uengine/run_daemon.sh
|
|
|
|
|
mv -v /tmp/run_daemon.sh /tmp/uengine/run_daemon.sh
|
|
|
|
|
fi
|
|
|
|
|
fi
|
2023-01-12 18:59:29 +08:00
|
|
|
|
# 拷贝到每个用户目录
|
|
|
|
|
for username in $(ls /home)
|
|
|
|
|
do
|
|
|
|
|
echo /home/$username
|
2023-01-13 19:00:40 +08:00
|
|
|
|
sudo mkdir -p /home/$username/uengine
|
|
|
|
|
sudo mkdir -p /home/$username/uengine-launch
|
|
|
|
|
sudo cp /tmp/uengine/run_daemon.sh /home/$username/uengine-launch
|
2023-01-12 18:59:29 +08:00
|
|
|
|
# 赋予可执行权限
|
2023-01-13 19:00:40 +08:00
|
|
|
|
sudo chmod +x /home/$username/uengine-launch/run_daemon.sh
|
2023-01-12 18:59:29 +08:00
|
|
|
|
#cp /tmp/uengine/launch_uengine.sh $username/uengine-launch
|
|
|
|
|
done
|
|
|
|
|
# 单独拷贝一份到 /usr/bin 下以做到每次开机自动化调用
|
|
|
|
|
sudo cp /tmp/uengine/run_daemon.sh /usr/bin/uengine-loading-ubuntu
|
2023-01-13 19:00:40 +08:00
|
|
|
|
sudo chmod 755 /usr/bin/uengine-loading-ubuntu
|
2023-01-12 18:59:29 +08:00
|
|
|
|
#mkdir -p $HOME/uengine
|
|
|
|
|
#mkdir -p $HOME/uengine-launch
|
|
|
|
|
#cp /tmp/uengine/run_daemon.sh $HOME/uengine-launch
|
|
|
|
|
#cp /tmp/uengine/launch_uengine.sh $HOME/uengine-launch
|
2022-06-12 22:25:02 +08:00
|
|
|
|
cd /tmp/uengine
|
2023-01-21 13:14:35 +08:00
|
|
|
|
# 刷新 APT 依赖防止出现问题
|
|
|
|
|
sudo apt update
|
2022-06-12 22:25:02 +08:00
|
|
|
|
/tmp/uengine/install.sh
|
2023-01-12 18:59:29 +08:00
|
|
|
|
# 安装所需依赖
|
2023-01-13 16:07:02 +08:00
|
|
|
|
sudo apt install -y libkf5globalaccel5 libqt5multimedia5 libqt5sensors5 libegl1-mesa-dev
|
2023-05-02 12:58:06 +08:00
|
|
|
|
# 启动内核 binder 模块
|
|
|
|
|
sudo modprobe binder_linux
|
|
|
|
|
sudo mkdir /dev/binderfs
|
|
|
|
|
sudo mount -t binder binder /dev/binderfs
|
2023-01-15 16:50:11 +08:00
|
|
|
|
# 用于修复 UEngine 在 Ubuntu 无法安装 APK 的问题
|
2023-01-12 13:11:13 +08:00
|
|
|
|
sudo mkdir -p /var/lib/uengine
|
|
|
|
|
sudo ln -s /data/uengine/data/data/ /var/lib/uengine/data
|
2023-01-12 21:33:21 +08:00
|
|
|
|
# 拷贝快捷方式
|
2023-01-13 16:07:02 +08:00
|
|
|
|
cd `dirname $0`
|
2023-01-12 21:33:21 +08:00
|
|
|
|
sudo cp uengine-loading-ubuntu.desktop /usr/share/applications
|
|
|
|
|
sudo cp uengine-loading-ubuntu.desktop /etc/xdg/autostart
|
2023-01-13 19:00:40 +08:00
|
|
|
|
sudo chmod 755 /etc/xdg/autostart/uengine-loading-ubuntu.desktop
|
2023-02-11 19:43:24 +08:00
|
|
|
|
# 检测最后安装是否成功
|
|
|
|
|
which uengine
|
|
|
|
|
if [[ $? != 0 ]]; then
|
|
|
|
|
# 安装失败
|
|
|
|
|
sudo rm /usr/share/applications/uengine-loading-ubuntu.desktop
|
|
|
|
|
sudo rm /etc/xdg/autostart/uengine-loading-ubuntu.desktop
|
|
|
|
|
sudo rm /usr/bin/uengine-loading-ubuntu
|
|
|
|
|
for username in $(ls /home)
|
|
|
|
|
do
|
|
|
|
|
echo /home/$username
|
2023-02-11 21:47:38 +08:00
|
|
|
|
sudo rm /home/$username/uengine-launch/run_daemon.sh
|
2023-02-11 19:43:24 +08:00
|
|
|
|
done
|
|
|
|
|
zenity --error --no-wrap '--text=抱歉,UEngine 安装失败,已移除安装时进行的修改'
|
|
|
|
|
exit
|
|
|
|
|
fi
|
2023-05-02 13:38:06 +08:00
|
|
|
|
# 拷贝 binder loader
|
2023-05-02 17:13:26 +08:00
|
|
|
|
sudo cp "${programPath}/LoadingBinder/load.sh" /usr/bin/uengine-loading-binder -v
|
2023-05-02 17:21:13 +08:00
|
|
|
|
sudo chmod +r /usr/bin/uengine-loading-binder
|
2023-05-02 17:13:26 +08:00
|
|
|
|
sudo cp "${programPath}/pkexec/com.deepin.pkexec.binder.loader.policy" /usr/share/polkit-1/actions/ -v
|
2023-01-12 19:12:52 +08:00
|
|
|
|
# echo "重启后在$HOME/uengine-launch执行launch_uengine.sh即可打开uengine守护进程。随后即可安装和使用安卓应用"
|
2023-01-12 18:59:29 +08:00
|
|
|
|
# 这里直接运行 run_daemon.sh,运行 launch_uengine.sh 好像不行
|
2023-01-12 21:33:21 +08:00
|
|
|
|
echo "重启后在$HOME/uengine-launch执行run_daemon.sh或在启动器手动运行或执行命令uengine-loading-ubuntu即可打开uengine守护进程。随后即可安装和使用安卓应用"
|
2022-06-12 22:25:02 +08:00
|
|
|
|
echo "你需要在每次启动安卓应用之前打开这个脚本。打开后可安全关闭"
|
2023-01-12 18:59:29 +08:00
|
|
|
|
echo "不过一般情况下会自动开启,无需手动启动。"
|
2022-06-12 22:25:02 +08:00
|
|
|
|
echo "按回车重启"
|
|
|
|
|
read
|
|
|
|
|
reboot
|