1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2025-12-30 07:03:40 +00:00

Updated linux behavior, so when finding X when it can't use ldconfig, it will try to load the library to make sure it works first. Previously, it would return the first result, which could cause problems the first result is for the wrong platform, ie 32 bit vs 64 bit

This commit is contained in:
Bryan Roe
2019-10-10 10:24:50 -07:00
parent b5e0074392
commit fa6c77f4e4
2 changed files with 62 additions and 16 deletions

View File

@@ -185,36 +185,82 @@ function monitorinfo()
var files = fs.readdirSync('/usr/lib');
var files2;
for (var i in files) {
try {
if (files[i].split('libX11.so.').length > 1 && files[i].split('.').length == 3) {
for (var i = 0; i < files.length; ++i)
{
try
{
if (files[i].split('libX11.so.').length > 1 && files[i].split('.').length == 3)
{
require('_GenericMarshal').CreateNativeProxy('/usr/lib/' + files[i]);
Object.defineProperty(this, 'Location_X11LIB', { value: '/usr/lib/' + files[i] });
}
if (files[i].split('libXtst.so.').length > 1 && files[i].split('.').length == 3) {
if (files[i].split('libXtst.so.').length > 1 && files[i].split('.').length == 3)
{
require('_GenericMarshal').CreateNativeProxy('/usr/lib/' + files[i]);
Object.defineProperty(this, 'Location_X11TST', { value: '/usr/lib/' + files[i] });
}
if (files[i].split('libXext.so.').length > 1 && files[i].split('.').length == 3) {
if (files[i].split('libXext.so.').length > 1 && files[i].split('.').length == 3)
{
require('_GenericMarshal').CreateNativeProxy('/usr/lib/' + files[i]);
Object.defineProperty(this, 'Location_X11EXT', { value: '/usr/lib/' + files[i] });
}
if (files[i].split('libXfixes.so.').length > 1 && files[i].split('.').length == 3)
{
require('_GenericMarshal').CreateNativeProxy('/usr/lib/' + files[i]);
Object.defineProperty(this, 'Location_X11FIXES', { value: '/usr/lib/' + files[i] });
}
if (files[i].split('-linux-').length > 1) {
if (files[i].split('-linux-').length > 1)
{
files2 = fs.readdirSync('/usr/lib/' + files[i]);
for (j in files2) {
if (files2[j].split('libX11.so.').length > 1 && files2[j].split('.').length == 3) {
for (j = 0; j < files2.length; ++j)
{
if (files2[j].split('libX11.so.').length > 1 && files2[j].split('.').length == 3)
{
try
{
require('_GenericMarshal').CreateNativeProxy('/usr/lib/' + files[i] + '/' + files2[j]);
}
catch (xx)
{
break;
}
Object.defineProperty(this, 'Location_X11LIB', { value: '/usr/lib/' + files[i] + '/' + files2[j] });
}
if (files2[j].split('libXtst.so.').length > 1 && files2[j].split('.').length == 3) {
if (files2[j].split('libXtst.so.').length > 1 && files2[j].split('.').length == 3)
{
try
{
require('_GenericMarshal').CreateNativeProxy('/usr/lib/' + files[i] + '/' + files2[j]);
}
catch (xx)
{
break;
}
Object.defineProperty(this, 'Location_X11TST', { value: '/usr/lib/' + files[i] + '/' + files2[j] });
}
if (files2[j].split('libXext.so.').length > 1 && files2[j].split('.').length == 3) {
if (files2[j].split('libXext.so.').length > 1 && files2[j].split('.').length == 3)
{
try
{
require('_GenericMarshal').CreateNativeProxy('/usr/lib/' + files[i] + '/' + files2[j]);
}
catch (xx)
{
break;
}
Object.defineProperty(this, 'Location_X11EXT', { value: '/usr/lib/' + files[i] + '/' + files2[j] });
}
if (files2[j].split('libXfixes.so.').length > 1 && files2[j].split('.').length == 3)
{
try
{
require('_GenericMarshal').CreateNativeProxy('/usr/lib/' + files[i] + '/' + files2[j]);
}
catch (xx)
{
break;
}
Object.defineProperty(this, 'Location_X11FIXES', { value: '/usr/lib/' + files[i] + '/' + files2[j] });
}
}