a365745e3c
Resolves: RHEL-26651 Signed-off-by: Brian Stinson <bstinson@redhat.com>
102 lines
4.1 KiB
Diff
102 lines
4.1 KiB
Diff
diff -ru anaconda-40.21.orig/pyanaconda/core/configuration/system.py anaconda-40.21/pyanaconda/core/configuration/system.py
|
|
--- anaconda-40.21.orig/pyanaconda/core/configuration/system.py 2024-02-06 10:44:42.794561313 -0600
|
|
+++ anaconda-40.21/pyanaconda/core/configuration/system.py 2024-02-27 21:16:15.104704752 -0600
|
|
@@ -168,6 +168,11 @@
|
|
return self._is_boot_iso or self._is_live_os or self._is_booted_os
|
|
|
|
@property
|
|
+ def provides_resolver_config(self):
|
|
+ """Can we copy /etc/resolv.conf to the target system?"""
|
|
+ return self._is_boot_iso
|
|
+
|
|
+ @property
|
|
def provides_liveuser(self):
|
|
"""Is the user `liveuser` available?"""
|
|
return self._is_live_os
|
|
diff -ru anaconda-40.21.orig/pyanaconda/installation.py anaconda-40.21/pyanaconda/installation.py
|
|
--- anaconda-40.21.orig/pyanaconda/installation.py 2024-02-06 10:44:42.798561322 -0600
|
|
+++ anaconda-40.21/pyanaconda/installation.py 2024-02-27 21:15:11.002380768 -0600
|
|
@@ -28,6 +28,7 @@
|
|
from pyanaconda import flags
|
|
from pyanaconda.core import util
|
|
from pyanaconda.core.path import open_with_perm
|
|
+from pyanaconda.core.service import is_service_installed
|
|
from pyanaconda import network
|
|
from pyanaconda.core.i18n import _
|
|
from pyanaconda.core.threads import thread_manager
|
|
@@ -370,6 +371,17 @@
|
|
_("Running pre-installation tasks")
|
|
)
|
|
|
|
+ # Make name resolution work for rpm scripts in chroot.
|
|
+ # Also make sure dns resolution works in %post scripts
|
|
+ # when systemd-resolved is not available.
|
|
+ if conf.system.provides_resolver_config and \
|
|
+ not is_service_installed("systemd-resolved.service"):
|
|
+ pre_install.append(Task(
|
|
+ "Copy resolv.conf to sysroot",
|
|
+ network.copy_resolv_conf_to_root,
|
|
+ (conf.target.system_root, )
|
|
+ ))
|
|
+
|
|
if is_module_available(SECURITY):
|
|
security_proxy = SECURITY.get_proxy()
|
|
|
|
diff -ru anaconda-40.21.orig/pyanaconda/network.py anaconda-40.21/pyanaconda/network.py
|
|
--- anaconda-40.21.orig/pyanaconda/network.py 2024-02-06 10:44:42.830561405 -0600
|
|
+++ anaconda-40.21/pyanaconda/network.py 2024-02-27 21:17:34.122336801 -0600
|
|
@@ -16,8 +16,10 @@
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
+import shutil
|
|
import socket
|
|
import itertools
|
|
+import os
|
|
import time
|
|
import threading
|
|
import re
|
|
@@ -29,6 +31,7 @@
|
|
from pyanaconda.core import util, constants
|
|
from pyanaconda.core.i18n import _
|
|
from pyanaconda.core.kernel import kernel_arguments
|
|
+from pyanaconda.core.path import make_directories
|
|
from pyanaconda.core.regexes import HOSTNAME_PATTERN_WITHOUT_ANCHORS, \
|
|
IPV6_ADDRESS_IN_DRACUT_IP_OPTION, MAC_OCTET
|
|
from pyanaconda.core.configuration.anaconda import conf
|
|
@@ -53,8 +56,9 @@
|
|
|
|
__all__ = ["get_supported_devices", "status_message", "wait_for_connectivity",
|
|
"wait_for_connecting_NM_thread", "wait_for_network_devices", "wait_for_connected_NM",
|
|
- "initialize_network", "prefix_to_netmask", "netmask_to_prefix", "get_first_ip_address",
|
|
- "is_valid_hostname", "check_ip_address", "get_nm_client", "write_configuration"]
|
|
+ "initialize_network", "copy_resolv_conf_to_root", "prefix_to_netmask",
|
|
+ "netmask_to_prefix", "get_first_ip_address", "is_valid_hostname", "check_ip_address",
|
|
+ "get_nm_client", "write_configuration"]
|
|
|
|
|
|
def get_nm_client():
|
|
@@ -214,6 +218,22 @@
|
|
return route_info[route_info.index("dev") + 1]
|
|
|
|
|
|
+def copy_resolv_conf_to_root(root="/"):
|
|
+ """Copy resolv.conf to a system root."""
|
|
+ src = "/etc/resolv.conf"
|
|
+ dst = os.path.join(root, src.lstrip('/'))
|
|
+ if not os.path.isfile(src):
|
|
+ log.debug("%s does not exist", src)
|
|
+ return
|
|
+ if os.path.isfile(dst):
|
|
+ log.debug("%s already exists", dst)
|
|
+ return
|
|
+ dst_dir = os.path.dirname(dst)
|
|
+ if not os.path.isdir(dst_dir):
|
|
+ make_directories(dst_dir)
|
|
+ shutil.copyfile(src, dst)
|
|
+
|
|
+
|
|
def run_network_initialization_task(task_path):
|
|
"""Run network initialization task and log the result."""
|
|
task_proxy = NETWORK.get_proxy(task_path)
|