@@ -1096,9 +1096,8 @@ public void onComplete(String destDir) {
10961096 }
10971097 }
10981098
1099- // Freshly fast-installed rootfs ships without resolv.conf; give it
1100- // DNS before the companion-data (maps/kiwix) steps that need network.
1101- ensureRuntimeNetworkConfig (debianRootfs );
1099+ // DNS is written at the single chokepoint (PRootEngine.executeInContainer),
1100+ // so the companion-data proot steps below get a working resolv.conf for free.
11021101
11031102 if (chkCompanionData .isChecked ()) {
11041103 editLocalVarsForMaps (debianRootfs , safeTier );
@@ -1307,16 +1306,8 @@ public void onComplete(String downloadPath) {
13071306 // 4. BOOTSTRAP IIAB
13081307 mainAct .runOnUiThread (() -> btnAdvancedReset .setText (getString (R .string .install_status_bootstrapping )));
13091308
1310- File resolvConf = new File (debianRootfs , "etc/resolv.conf" );
1311- if (resolvConf .exists ()) resolvConf .delete ();
1312- java .io .FileOutputStream fos = new java .io .FileOutputStream (resolvConf );
1313- fos .write ("nameserver 1.1.1.1\n nameserver 8.8.8.8\n " .getBytes ());
1314- fos .close ();
1315-
1316- File hostsFile = new File (debianRootfs , "etc/hosts" );
1317- java .io .FileOutputStream fosH = new java .io .FileOutputStream (hostsFile );
1318- fosH .write ("127.0.0.1 localhost\n " .getBytes ());
1319- fosH .close ();
1309+ // DNS is written at the chokepoint (PRootEngine) before the
1310+ // bootstrap proot run below; no inline write needed here.
13201311
13211312 if (prootEngine == null )
13221313 prootEngine = new PRootEngine ();
@@ -2147,8 +2138,6 @@ private void refreshRestoreButtonLogic() {
21472138 tarExtractor .startExtraction (requireContext (), backupFile .getAbsolutePath (), iiabRootDir .getAbsolutePath (), new TarExtractor .ExtractionListener () {
21482139 @ Override
21492140 public void onComplete (String destDir ) {
2150- // Restored artifact ships without resolv.conf; the app owns runtime DNS.
2151- ensureRuntimeNetworkConfig (new File (iiabRootDir , "installed-rootfs/iiab" ));
21522141 mainAct .runOnUiThread (() -> {
21532142 isRestoring = false ;
21542143 disableSystemProtection ();
@@ -2175,33 +2164,6 @@ public void onError(String error) {
21752164 }
21762165 }
21772166
2178- // Runtime network config for the proot guest: proot has no resolver daemon, and our build
2179- // artifact ships WITHOUT /etc/resolv.conf on purpose (the app is the single owner of runtime
2180- // network state). Mirrors the reset path. Called from fast-install and restore.
2181- // TODO [tech-debt]: imperative side-effect inside DeployFragment (god-object); not Clean
2182- // Architecture. Fold into the rootfs domain/data slice during the strangler refactor.
2183- private void ensureRuntimeNetworkConfig (File debianRootfs ) {
2184- try {
2185- File etc = new File (debianRootfs , "etc" );
2186- if (!etc .isDirectory ()) {
2187- Log .w (TAG , "ensureRuntimeNetworkConfig: missing " + etc .getAbsolutePath () + " - skipping DNS write" );
2188- return ;
2189- }
2190- File resolvConf = new File (etc , "resolv.conf" );
2191- if (resolvConf .exists ()) resolvConf .delete ();
2192- try (java .io .FileOutputStream fos = new java .io .FileOutputStream (resolvConf )) {
2193- fos .write ("nameserver 1.1.1.1\n nameserver 8.8.8.8\n " .getBytes ());
2194- }
2195- File hostsFile = new File (etc , "hosts" );
2196- try (java .io .FileOutputStream fosH = new java .io .FileOutputStream (hostsFile )) {
2197- fosH .write ("127.0.0.1 localhost\n " .getBytes ());
2198- }
2199- Log .i (TAG , "ensureRuntimeNetworkConfig: wrote resolv.conf + hosts under " + etc .getAbsolutePath ());
2200- } catch (Exception e ) {
2201- Log .w (TAG , "ensureRuntimeNetworkConfig failed" , e );
2202- }
2203- }
2204-
22052167 private void importBackupSafely (Uri sourceUri ) {
22062168 isImporting = true ;
22072169 updateDynamicButtons ();
0 commit comments