Skip to content

Commit 6573f05

Browse files
authored
fix(): Bionic Lib check and copy fix for upgraded installs (utkarshdalal#1472)
* fix(): Fix the issue where bionic lib wasn't being copied correctly when upgrading * fix(): Fix calling signature and issues ensureBionicLib. Now need to figure out why it's not copying still. * fix(): Popped in a quick check for ensureBionicLib for installIfNeededFuture
1 parent 8cccd0e commit 6573f05

1 file changed

Lines changed: 17 additions & 8 deletions

File tree

app/src/main/java/com/winlator/xenvironment/ImageFsInstaller.java

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,19 @@ public static void installWineFromDownloads(final Context context) {
8989
}
9090
}
9191

92+
// Modern flavor ships an additional bionic preload shipped as a flat asset
93+
// (src/modern/assets/) until it's folded into redirect.tzst. Copy it next to
94+
// the tarball-extracted variant so BionicProgramLauncherComponent can find it
95+
private static void ensureBionicLib(Context context, File imagefs) {
96+
if (BuildConfig.MODERN_ANDROID) {
97+
File wxDest = new File(imagefs, "usr/lib/libredirect-bionic-wx.so");
98+
if (!wxDest.exists()) {
99+
FileUtils.copy(context, "libredirect-bionic-wx.so", wxDest);
100+
chmod(wxDest);
101+
}
102+
}
103+
}
104+
92105
private static Future<Boolean> installFromAssetsFuture(
93106
final Context context,
94107
AssetManager assetManager,
@@ -109,11 +122,13 @@ private static Future<Boolean> installFromAssetsFuture(
109122
clearRootDir(context, rootDir);
110123
ensureSharedHomeRoot(context, rootDir);
111124
ensureProtonVersionSymlink(context, rootDir, wineVersion);
125+
ensureBionicLib(context, rootDir);
112126

113127
final byte compressionRatio = 22;
114128
String imagefsFile = containerVariant.equals(Container.GLIBC) ? "imagefs_gamenative.txz" : "imagefs_bionic.txz";
115129
File downloaded = new File(imageFs.getFilesDir(), imagefsFile);
116130

131+
117132
boolean success = false;
118133

119134
if (Arrays.asList(context.getAssets().list("")).contains(imagefsFile) == true){
@@ -190,14 +205,7 @@ private static void installGuestLibs(Context ctx) {
190205
chmod(new File(imagefs, "usr/lib/libredirect.so"));
191206
chmod(new File(imagefs, "usr/lib/libredirect-bionic.so"));
192207

193-
// Modern flavor ships an additional bionic preload shipped as a flat asset
194-
// (src/modern/assets/) until it's folded into redirect.tzst. Copy it next to
195-
// the tarball-extracted variant so BionicProgramLauncherComponent can find it.
196-
if (BuildConfig.MODERN_ANDROID) {
197-
File wxDest = new File(imagefs, "usr/lib/libredirect-bionic-wx.so");
198-
FileUtils.copy(ctx, "libredirect-bionic-wx.so", wxDest);
199-
chmod(wxDest);
200-
}
208+
ensureBionicLib(ctx, imagefs);
201209

202210
final String EXTRAS_TAR = "extras.tzst"; // ➊ add this to assets/
203211
// ➋ Unpack straight into imagefs, preserving relative paths.
@@ -237,6 +245,7 @@ public static Future<Boolean> installIfNeededFuture(final Context context, Asset
237245
} else {
238246
Log.d("ImageFsInstaller", "Image FS already valid and at latest version");
239247
return Executors.newSingleThreadExecutor().submit(() -> {
248+
ensureBionicLib(context, imageFs.getRootDir());
240249
return true;
241250
});
242251
}

0 commit comments

Comments
 (0)