Skip to content

Commit c80be46

Browse files
committed
Fix samsung issues
1 parent 90be3dc commit c80be46

File tree

1 file changed

+28
-3
lines changed

1 file changed

+28
-3
lines changed

lib/workflow.dart

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,9 +189,27 @@ class Util {
189189
return null;
190190
}
191191

192-
//获取预制可执行文件路径
193-
static String elf(String value) {
194-
return "applib/libexec_$value.so";
192+
static Future<bool> isXServerReady(String host, int port, {int timeoutSeconds = 5}) async {
193+
try {
194+
final socket = await Socket.connect(host, port, timeout: Duration(seconds: timeoutSeconds));
195+
await socket.close();
196+
return true;
197+
} catch (e) {
198+
return false;
199+
}
200+
}
201+
202+
static Future<void> waitForXServer() async {
203+
const host = '127.0.0.1';
204+
const port = 7897;
205+
206+
while (true) {
207+
bool isReady = await isXServerReady(host, port);
208+
if (isReady) {
209+
return;
210+
}
211+
await Future.delayed(Duration(seconds: 1));
212+
}
195213
}
196214

197215
}
@@ -613,6 +631,8 @@ export DATA_DIR=${G.dataPath}
613631
export LD_LIBRARY_PATH=\$DATA_DIR/lib
614632
cd \$DATA_DIR
615633
ln -sf ../applib/libexec_busybox.so \$DATA_DIR/bin/busybox
634+
ln -sf ../applib/libexec_busybox.so \$DATA_DIR/bin/sh
635+
ln -sf ../applib/libexec_busybox.so \$DATA_DIR/bin/cat
616636
ln -sf ../applib/libexec_busybox.so \$DATA_DIR/bin/xz
617637
ln -sf ../applib/libexec_busybox.so \$DATA_DIR/bin/gzip
618638
ln -sf ../applib/libexec_proot.so \$DATA_DIR/bin/proot
@@ -654,6 +674,7 @@ chmod 1777 tmp
654674
await Util.execute(
655675
"""
656676
export DATA_DIR=${G.dataPath}
677+
export PATH=\$DATA_DIR/bin:\$PATH
657678
export LD_LIBRARY_PATH=\$DATA_DIR/lib
658679
export CONTAINER_DIR=\$DATA_DIR/containers/0
659680
export EXTRA_OPT=""
@@ -754,6 +775,7 @@ sed -i -E "s@^(VNC_RESOLUTION)=.*@\\1=${w}x${h}@" \$(command -v startvnc)""";
754775
);
755776
G.audioPty!.write(const Utf8Encoder().convert("""
756777
export DATA_DIR=${G.dataPath}
778+
export PATH=\$DATA_DIR/bin:\$PATH
757779
export LD_LIBRARY_PATH=\$DATA_DIR/lib
758780
\$DATA_DIR/bin/busybox sed "s/4713/${Util.getGlobal("defaultAudioPort") as int}/g" \$DATA_DIR/bin/pulseaudio.conf > \$DATA_DIR/bin/pulseaudio.conf.tmp
759781
rm -rf \$DATA_DIR/pulseaudio_tmp/*
@@ -780,6 +802,7 @@ exit
780802
if (Util.getGlobal("virgl")) {
781803
Util.execute("""
782804
export DATA_DIR=${G.dataPath}
805+
export PATH=\$DATA_DIR/bin:\$PATH
783806
export LD_LIBRARY_PATH=\$DATA_DIR/lib
784807
export CONTAINER_DIR=\$DATA_DIR/containers/${G.currentContainer}
785808
${G.dataPath}/bin/virgl_test_server ${Util.getGlobal("defaultVirglCommand")}""");
@@ -799,6 +822,7 @@ ${G.dataPath}/bin/virgl_test_server ${Util.getGlobal("defaultVirglCommand")}""")
799822
Util.termWrite(
800823
"""
801824
export DATA_DIR=${G.dataPath}
825+
export PATH=\$DATA_DIR/bin:\$PATH
802826
export LD_LIBRARY_PATH=\$DATA_DIR/lib
803827
export CONTAINER_DIR=\$DATA_DIR/containers/${G.currentContainer}
804828
export EXTRA_MOUNT="$extraMount"
@@ -871,6 +895,7 @@ clear""");
871895
launchCurrentContainer();
872896
if (Util.getGlobal("autoLaunchVnc") as bool) {
873897
if (G.wasX11Enabled) {
898+
await Util.waitForXServer();
874899
launchX11();
875900
return;
876901
}

0 commit comments

Comments
 (0)