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 Description: Companion package for termux-x11 app
EOF 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 mkdir -p $PACKAGE_DIR
echo 2.0 > $PACKAGE_DIR/debian-binary echo 2.0 > $PACKAGE_DIR/debian-binary
tar -cJf $PACKAGE_DIR/data.tar.xz -C $DATA_DIR . 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.app.PendingIntent;
import android.content.ComponentName; import android.content.ComponentName;
import android.content.Intent; import android.content.Intent;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.IBinder; import android.os.IBinder;
@ -295,13 +296,23 @@ public class Starter {
Looper.prepare(); Looper.prepare();
handler = new Handler(); handler = new Handler();
boolean loaded = false;
@SuppressLint("SdCardPath") @SuppressLint("SdCardPath")
final String libPath = "/data/data/com.termux/files/usr/libexec/termux-x11/libstarter.so"; final String DistDir = "/data/data/com.termux/files/usr/libexec/termux-x11";
final File libFile = new File(libPath); for (int i = 0; i < Build.SUPPORTED_ABIS.length; i++) {
if (libFile.exists()) { @SuppressLint("SdCardPath")
Runtime.getRuntime().load(libPath); final String libPath = DistDir + "/" + Build.SUPPORTED_ABIS[i] + "/libstarter.so";
} else { File libFile = new File(libPath);
System.err.println(libPath + " does not exist. Please, check termux-x11 package installation."); 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); System.exit(1);
} }
} }