Backport Upstream PR 5494 to copy resolv.conf into the target environment for %post
Resolves: RHEL-26651 Signed-off-by: Brian Stinson <bstinson@redhat.com>
This commit is contained in:
parent
72e484d887
commit
a365745e3c
101
0002-backport-7e5f538ac2-copy-resolvconf.patch
Normal file
101
0002-backport-7e5f538ac2-copy-resolvconf.patch
Normal file
@ -0,0 +1,101 @@
|
||||
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)
|
@ -1,7 +1,7 @@
|
||||
Summary: Graphical system installer
|
||||
Name: anaconda
|
||||
Version: 40.21
|
||||
Release: 3%{?dist}
|
||||
Release: 4%{?dist}
|
||||
License: GPL-2.0-or-later
|
||||
URL: http://fedoraproject.org/wiki/Anaconda
|
||||
|
||||
@ -17,6 +17,10 @@ Source0: https://github.com/rhinstaller/%{name}/releases/download/%{name}-%{vers
|
||||
# Fix ostree installs to btrfs with util-linux 2.40+
|
||||
Patch: 0001-Resolve-symlinks-in-ostree-install-bind-mount-destin.patch
|
||||
|
||||
# https://github.com/rhinstaller/anaconda/pull/5494/commits
|
||||
# https://issues.redhat.com/browse/RHEL-26651
|
||||
Patch: 0002-backport-7e5f538ac2-copy-resolvconf.patch
|
||||
|
||||
# Versions of required components (done so we make sure the buildrequires
|
||||
# match the requires versions of things).
|
||||
|
||||
@ -472,6 +476,10 @@ rm -rf \
|
||||
%{_prefix}/libexec/anaconda/dd_*
|
||||
|
||||
%changelog
|
||||
* Tue Feb 27 2024 Brian Stinson <bstinson@redhat.com> - 40.21-4
|
||||
- Backport PR #5494 which re-enables copying resolv.conf into the target system to allow resolving dns names in %post
|
||||
Resolves: RHEL-26651
|
||||
|
||||
* Thu Feb 22 2024 Brian Stinson <bstinson@redhat.com> - 40.21-3
|
||||
- Do not require systemd-resolved in the installer environment
|
||||
Resolves: RHEL-26320
|
||||
|
Loading…
Reference in New Issue
Block a user