2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-22 01:22:00 +00:00

Robust handling of relative link resolv.conf

resolv.conf may be a relative link, normal file, or absolute link.

Handle all cases.
This commit is contained in:
Jarrod Johnson 2024-07-24 11:12:31 -04:00
parent 2235faa76d
commit c91af840e5

View File

@ -942,6 +942,8 @@ def fancy_chroot(args, installroot):
sourceresolv = '/etc/resolv.conf'
if os.path.islink(sourceresolv):
sourceresolv = os.readlink(sourceresolv)
# normalize and resolve relative and absolute paths
sourceresolv = os.path.normpath(os.path.join('/etc', sourceresolv))
dstresolv = os.path.join(installroot, 'etc/resolv.conf')
if os.path.islink(dstresolv):
dstresolv = os.path.join(installroot, os.readlink(dstresolv)[1:])