From d3790780ddc55a7b339acb056d382bfbb9013a81 Mon Sep 17 00:00:00 2001 From: gfdgd_xi <3025613752@qq.com> Date: Tue, 11 Jul 2023 18:10:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=E4=BD=BF=E7=94=A8Exagear?= =?UTF-8?q?=E7=9A=84=E5=AE=B9=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WineLib/run-more.sh | 27 +++++++++++++++++++++++++++ WineLib/run.sh | 14 ++++++++++++-- mainwindow.py | 26 +++++++++++++++++++------- 3 files changed, 58 insertions(+), 9 deletions(-) create mode 100755 WineLib/run-more.sh diff --git a/WineLib/run-more.sh b/WineLib/run-more.sh new file mode 100755 index 0000000..20ae375 --- /dev/null +++ b/WineLib/run-more.sh @@ -0,0 +1,27 @@ +#!/bin/bash +CURRENT_DIR=$1 +if [[ ! -d "$CURRENT_DIR/usr" ]]; then + zenity --info --text=未安装运行库,无法运行 --no-wrap + exit +fi +if [[ ! -d "$CURRENT_DIR/usr/lib64" ]]; then + bwrap --dev-bind / / \ + --ro-bind "$CURRENT_DIR/usr/lib" /lib \ + --ro-bind "$CURRENT_DIR/usr" /usr \ + --ro-bind /usr/share /usr/share \ + --ro-bind /usr/bin /usr/bin \ + --ro-bind /usr/sbin /usr/sbin \ + -- "${@:2}" + exit +fi +if [[ ! -f /lib64 ]] && [[ ! -d /lib64 ]] && [[ ! -L /lib64 ]]; then + pkexec mkdir /lib64 -p +fi +bwrap --dev-bind / / \ + --ro-bind "$CURRENT_DIR/usr/lib" /lib \ + --ro-bind "$CURRENT_DIR/usr/lib64" /lib \ + --ro-bind "$CURRENT_DIR/usr" /usr \ + --ro-bind /usr/share /usr/share \ + --ro-bind /usr/bin /usr/bin \ + --ro-bind /usr/sbin /usr/sbin \ + -- "${@:2}" diff --git a/WineLib/run.sh b/WineLib/run.sh index 67d314e..aa64548 100755 --- a/WineLib/run.sh +++ b/WineLib/run.sh @@ -4,12 +4,22 @@ if [[ ! -d "$CURRENT_DIR/usr" ]]; then zenity --info --text=未安装运行库,无法运行 --no-wrap exit fi +if [[ ! -d "$CURRENT_DIR/usr/lib64" ]]; then + bwrap --dev-bind / / \ + --ro-bind "$CURRENT_DIR/usr/lib" /lib \ + --ro-bind "$CURRENT_DIR/usr" /usr \ + --ro-bind /usr/share /usr/share \ + --ro-bind /usr/bin /usr/bin \ + --ro-bind /usr/sbin /usr/sbin \ + -- "$@" + exit +fi if [[ ! -f /lib64 ]] && [[ ! -d /lib64 ]] && [[ ! -L /lib64 ]]; then pkexec mkdir /lib64 -p fi bwrap --dev-bind / / \ - --ro-bind "$CURRENT_DIR/lib" /lib \ - --ro-bind "$CURRENT_DIR/lib64" /lib \ + --ro-bind "$CURRENT_DIR/usr/lib" /lib \ + --ro-bind "$CURRENT_DIR/usr/lib64" /lib \ --ro-bind "$CURRENT_DIR/usr" /usr \ --ro-bind /usr/share /usr/share \ --ro-bind /usr/bin /usr/bin \ diff --git a/mainwindow.py b/mainwindow.py index 73346be..2b88ddb 100755 --- a/mainwindow.py +++ b/mainwindow.py @@ -2347,14 +2347,14 @@ def CheckWine(): if os.path.exists("/opt/exagear/bin/ubt_x64a64_al"): nameValue.append( [ - "使用 64 位 exagear 运行", + "使用 ubt_x64a64_al 运行", "/opt/exagear/bin/ubt_x64a64_al -- " ] ) if os.path.exists("/opt/exagear/bin/ubt_x32a64_al"): nameValue.append( [ - "使用 32 位 exagear 运行", + "使用 ubt_x32a64_al 运行", "/opt/exagear/bin/ubt_x32a64_al -- " ] ) @@ -2404,11 +2404,23 @@ def CheckWine(): canUseWine.append(f"{get_home()}/.deepinwine/{i}/bin/wine64") except: traceback.print_exc() - for i in canUseWine[:]: - if os.path.exists(f"{programPath}/WineLib/usr/lib/ld-linux-x86-64.so.2"): - wine[f"使用运行器的运行库运行 {i}"] = f"bash '{programPath}/WineLib/run.sh' {wine[i]}" - canUseWine.append(f"使用运行器的运行库运行 {i}") - untipsWine.append(f"使用运行器的运行库运行 {i}") + try: + canUseWineOld = canUseWine[:] + for i in canUseWineOld: + if os.path.exists(f"{programPath}/WineLib/usr/lib/ld-linux-x86-64.so.2"): + wine[f"使用运行器的运行库运行 {i}"] = f"bash '{programPath}/WineLib/run.sh' {wine[i]}" + canUseWine.append(f"使用运行器的运行库运行 {i}") + untipsWine.append(f"使用运行器的运行库运行 {i}") + if os.path.exists("/opt/exagear/images"): + for k in os.listdir("/opt/exagear/images"): + if not os.path.isdir(f"/opt/exagear/images/{k}"): + continue + for i in canUseWineOld: + wine[f"使用Exagear容器运行库运行 {i}"] = f"bash '{programPath}/WineLib/run-more.sh' '/opt/exagear/images/{k}' {wine[i]}" + canUseWine.append(f"使用Exagear容器运行库运行 {i}") + untipsWine.append(f"使用Exagear容器运行库运行 {i}") + except: + traceback.print_exc() except: traceback.print_exc() app = QtWidgets.QApplication(sys.argv)