uengine-runner/new-deb-build/DEBIAN/postinst

67 lines
4.2 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# 使用 pip 安装所需库
echo 安装组件
python3 -m pip install --upgrade ttkthemes --break-system-packages --trusted-host https://repo.huaweicloud.com -i https://repo.huaweicloud.com/repository/pypi/simple > /dev/null 2>&1 | true
python3 -m pip install --upgrade pyautogui --break-system-packages --trusted-host https://repo.huaweicloud.com -i https://repo.huaweicloud.com/repository/pypi/simple > /dev/null 2>&1 | true
python3 -m pip install --upgrade keyboard --break-system-packages --trusted-host https://repo.huaweicloud.com -i https://repo.huaweicloud.com/repository/pypi/simple > /dev/null 2>&1 | true
python3 -m pip install --upgrade pillow --break-system-packages --trusted-host https://repo.huaweicloud.com -i https://repo.huaweicloud.com/repository/pypi/simple > /dev/null 2>&1 | true
echo 执行完成
# 建立软链接
ln -s /opt/apps/com.gitee.uengine.runner.spark/files/uengine-runner /usr/bin/uengine-runner
ln -s /opt/apps/com.gitee.uengine.runner.spark/files/uengine-apk-builder /usr/bin/uengine-apk-builder
ln -s /opt/apps/com.gitee.uengine.runner.spark/files/uengine-app-uninstall /usr/bin/uengine-app-uninstall
ln -s /opt/apps/com.gitee.uengine.runner.spark/files/uengine-app-install /usr/bin/uengine-app-install
ln -s /opt/apps/com.gitee.uengine.runner.spark/files/uengine-clean /usr/bin/uengine-clean
ln -s /opt/apps/com.gitee.uengine.runner.spark/files/uengine-runner-about /usr/bin/uengine-runner-about
ln -s /opt/apps/com.gitee.uengine.runner.spark/files/uengine-keyboard /usr/bin/uengine-keyboard
ln -s /opt/apps/com.gitee.uengine.runner.spark/files/uengine-useadb /usr/bin/uengine-useadb
ln -s /opt/apps/com.gitee.uengine.runner.spark/files/uengine-runner-launch.sh /usr/bin/uengine-runner-launch.sh
ln -s /opt/apps/com.gitee.uengine.runner.spark/files/uengine-runner-update-bug /usr/bin/uengine-runner-update-bug
ln -s /opt/apps/com.gitee.uengine.runner.spark/files/root-uengine /usr/bin/uengine-root
ln -s /opt/apps/com.gitee.uengine.runner.spark/files/AutoShell/main.py /usr/bin/uengine-runner-auto-install-bash
ln -s /opt/apps/com.gitee.uengine.runner.spark/files/uengine-runner-applist-launch.sh /usr/bin/uengine-runner-applist-launch.sh
# 移除安装错误的 UEngine Ubuntu 补丁
which uengine
if [[ $? != 0 ]] && [[ -f /usr/bin/uengine-loading-ubuntu ]]; then
echo 移除错误的 UEngine Ubuntu 补丁
# 移除补丁
rm /usr/share/applications/uengine-loading-ubuntu.desktop
rm /etc/xdg/autostart/uengine-loading-ubuntu.desktop
rm /usr/bin/uengine-loading-ubuntu
for username in $(ls /home)
do
echo /home/$username
rm /home/$username/uengine-launch/run_daemon.sh
done
fi
# 更新 uengine-loading-ubuntu如果存在
if [[ -f /usr/bin/uengine-loading-ubuntu ]] || [[ -f /usr/bin/uengine-loading-binder ]]; then
echo 更新 uengine-loading-ubuntu
cp /opt/apps/com.gitee.uengine.runner.spark/files/LoadingBinder/load.sh /usr/bin/uengine-loading-binder
if [ -f /tmp/upgrade-uengine-loading-ubuntu ]; then
rm /tmp/upgrade-uengine-loading-ubuntu
fi
# 下载新版
aria2c -x 16 -s 16 -d /tmp -o upgrade-uengine-loading-ubuntu http://uengine-runner.gfdgdxi.top/shell/run_daemon.sh
if [ $? == 0 ]; then
# 替换
cp /tmp/upgrade-uengine-loading-ubuntu /usr/bin/uengine-loading-ubuntu
else
cp /opt/apps/com.gitee.uengine.runner.spark/files/Help/shell/run_daemon.sh /usr/bin/uengine-loading-ubuntu
fi
chmod 755 /usr/bin/uengine-loading-ubuntu
for username in $(ls /home)
do
echo /home/$username
cp /usr/bin/uengine-loading-ubuntu /home/$username/uengine-launch/run_daemon.sh
chmod 755 /home/$username/uengine-launch/run_daemon.sh
done
rm -f /tmp/upgrade-uengine-loading-ubuntu
fi
# 刷新图标缓存
# 因为 Ubuntu 的问题,省略
gtk-update-icon-cache /usr/share/icons/bloom > /dev/null | true
# 向服务器返回安装数加1不显示内容且忽略错误
python3 /opt/apps/com.gitee.uengine.runner.spark/files/Download.py 2.1.1 > /dev/null | true