Browse Source

Check that etc/resolv.conf.ORIG exists before edit

In RHEL 8.4, /etc/resolv.conf is not present by default.
As such, removing the nameservers will fail because
etc/resolv.conf.ORIG never gets created.

This patch makes the nameserver edit only if the
etc/resolv.conf.ORIG file exists.

Change-Id: I2178996d899ffe43e11bfeb512e4fcaa941b8410
(cherry picked from commit 5c4be3e158)
changes/89/775589/1 13.1.1
Ronelle Landy 3 months ago
parent
commit
5ecf624b6a
1 changed files with 3 additions and 1 deletions
  1. +3
    -1
      elements/remove-resolvconf/cleanup.d/90-remove-resolvconf

+ 3
- 1
elements/remove-resolvconf/cleanup.d/90-remove-resolvconf View File

@ -11,4 +11,6 @@ set -o pipefail
# NOTE: This relies on the fact the DIB copies the original resolv.conf and
# during the finalise_base function in img-functions (in DIB) copies the old
# one back in place after the build process completes.
sudo sed -i '/nameserver/d' $TARGET_ROOT/etc/resolv.conf.ORIG
if [ -f $TARGET_ROOT/etc/resolv.conf.ORIG ] ; then
sudo sed -i '/nameserver/d' $TARGET_ROOT/etc/resolv.conf.ORIG
fi

Loading…
Cancel
Save