This commit is contained in:
Twaik Yont 2021-10-08 11:49:55 +03:00
parent 1cb26e4ee8
commit 3589a91b3f
2 changed files with 17 additions and 19 deletions

View File

@ -37,19 +37,6 @@ Depends: xwayland
Description: Companion package for termux-x11 app
EOF
cat <<EOF > $CONTROL_DIR/postinst
#!/data/data/com.termux/files/usr/bin/bash
[ -z "\$PREFIX" ] && PREFIX=/data/data/com.termux/files/usr
ABI=
case \`dpkg --print-architecture\` in
arm) ABI=armeabi-v7a;;
aarch64) ABI=arm64-v8a;;
i686) ABI=x86;;
x86_64) ABI=x86_64;;
esac
mv \$PREFIX/libexec/termux-x11/\$ABI/libstarter.so \$PREFIX/libexec/termux-x11/
EOF
mkdir -p $PACKAGE_DIR
echo 2.0 > $PACKAGE_DIR/debian-binary
tar -cJf $PACKAGE_DIR/data.tar.xz -C $DATA_DIR .

View File

@ -22,6 +22,7 @@ import android.annotation.SuppressLint;
import android.app.PendingIntent;
import android.content.ComponentName;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
@ -295,13 +296,23 @@ public class Starter {
Looper.prepare();
handler = new Handler();
boolean loaded = false;
@SuppressLint("SdCardPath")
final String libPath = "/data/data/com.termux/files/usr/libexec/termux-x11/libstarter.so";
final File libFile = new File(libPath);
if (libFile.exists()) {
Runtime.getRuntime().load(libPath);
} else {
System.err.println(libPath + " does not exist. Please, check termux-x11 package installation.");
final String DistDir = "/data/data/com.termux/files/usr/libexec/termux-x11";
for (int i = 0; i < Build.SUPPORTED_ABIS.length; i++) {
@SuppressLint("SdCardPath")
final String libPath = DistDir + "/" + Build.SUPPORTED_ABIS[i] + "/libstarter.so";
File libFile = new File(libPath);
if (libFile.exists()) {
Runtime.getRuntime().load(libPath);
loaded = true;
break;
} else System.err.println(libPath + "not found");
}
if (!loaded) {
System.err.println("Can not find some core libraries.");
System.err.println("Please, check termux-x11 package installation.");
System.exit(1);
}
}