支持使用Exagear的容器

This commit is contained in:
gfdgd xi 2023-07-11 18:10:51 +08:00
parent 00245232bf
commit d3790780dd
3 changed files with 58 additions and 9 deletions

27
WineLib/run-more.sh Executable file
View File

@ -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}"

View File

@ -4,12 +4,22 @@ if [[ ! -d "$CURRENT_DIR/usr" ]]; then
zenity --info --text=未安装运行库,无法运行 --no-wrap zenity --info --text=未安装运行库,无法运行 --no-wrap
exit exit
fi 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 if [[ ! -f /lib64 ]] && [[ ! -d /lib64 ]] && [[ ! -L /lib64 ]]; then
pkexec mkdir /lib64 -p pkexec mkdir /lib64 -p
fi fi
bwrap --dev-bind / / \ bwrap --dev-bind / / \
--ro-bind "$CURRENT_DIR/lib" /lib \ --ro-bind "$CURRENT_DIR/usr/lib" /lib \
--ro-bind "$CURRENT_DIR/lib64" /lib \ --ro-bind "$CURRENT_DIR/usr/lib64" /lib \
--ro-bind "$CURRENT_DIR/usr" /usr \ --ro-bind "$CURRENT_DIR/usr" /usr \
--ro-bind /usr/share /usr/share \ --ro-bind /usr/share /usr/share \
--ro-bind /usr/bin /usr/bin \ --ro-bind /usr/bin /usr/bin \

View File

@ -2347,14 +2347,14 @@ def CheckWine():
if os.path.exists("/opt/exagear/bin/ubt_x64a64_al"): if os.path.exists("/opt/exagear/bin/ubt_x64a64_al"):
nameValue.append( nameValue.append(
[ [
"使用 64 位 exagear 运行", "使用 ubt_x64a64_al 运行",
"/opt/exagear/bin/ubt_x64a64_al -- " "/opt/exagear/bin/ubt_x64a64_al -- "
] ]
) )
if os.path.exists("/opt/exagear/bin/ubt_x32a64_al"): if os.path.exists("/opt/exagear/bin/ubt_x32a64_al"):
nameValue.append( nameValue.append(
[ [
"使用 32 位 exagear 运行", "使用 ubt_x32a64_al 运行",
"/opt/exagear/bin/ubt_x32a64_al -- " "/opt/exagear/bin/ubt_x32a64_al -- "
] ]
) )
@ -2404,11 +2404,23 @@ def CheckWine():
canUseWine.append(f"{get_home()}/.deepinwine/{i}/bin/wine64") canUseWine.append(f"{get_home()}/.deepinwine/{i}/bin/wine64")
except: except:
traceback.print_exc() traceback.print_exc()
for i in canUseWine[:]: try:
if os.path.exists(f"{programPath}/WineLib/usr/lib/ld-linux-x86-64.so.2"): canUseWineOld = canUseWine[:]
wine[f"使用运行器的运行库运行 {i}"] = f"bash '{programPath}/WineLib/run.sh' {wine[i]}" for i in canUseWineOld:
canUseWine.append(f"使用运行器的运行库运行 {i}") if os.path.exists(f"{programPath}/WineLib/usr/lib/ld-linux-x86-64.so.2"):
untipsWine.append(f"使用运行器的运行库运行 {i}") 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: except:
traceback.print_exc() traceback.print_exc()
app = QtWidgets.QApplication(sys.argv) app = QtWidgets.QApplication(sys.argv)