Recreate /etc/resolv.conf if NetworkManager screwed it up (#1475279)

This commit is contained in:
Pavel Zhukov 2017-07-27 13:04:28 +02:00
parent 27c22d4efc
commit c2c0b1a042
2 changed files with 23 additions and 2 deletions

View File

@ -85,7 +85,7 @@ eventually_add_hostnames_domain_to_search() {
done
if [ "${is_in}" = "false" ]; then
# Add domain name to search list (#637763)
# Add domain name to search list (#637763)
sed -i -e "s/${search}/${search} ${domain}/" "${RESOLVCONF}"
fi
fi
@ -728,6 +728,20 @@ get_hwaddr ()
fi
}
validate_resolv_conf()
{
# It's possible to have broken symbolic link $RESOLVCONF -> <some_nm_dir>
# https://bugzilla.redhat.com/1475279
# Remove broken link and hope NM will survive
if [ -h "${RESOLVCONF}" -a ! -e "${RESOLVCONF}" ];
then
logmessage "${RESOLVCONF) is broken symlink. Recreating..."
unlink "${RESOLVCONF}"
touch "${RESOLVCONF}"
fi;
}
get_config_by_hwaddr ()
{
LANG=C grep -il "^[[:space:]]*HWADDR=\"\?${1}\"\?\([[:space:]#]\|$\)" /etc/sysconfig/network-scripts/ifcfg-* \
@ -787,6 +801,8 @@ source_config ()
run_hook "${ETCDIR}/dhclient-enter-hooks" || exit $?
run_hookdir "${ETCDIR}/dhclient-enter-hooks.d" || exit $?
[ "${PEERDNS}" = "no" ] || validate_resilv_conf()
if [ -f /etc/sysconfig/network ]; then
. /etc/sysconfig/network
fi

View File

@ -20,7 +20,7 @@ Summary: Dynamic host configuration protocol software
Name: dhcp
Version: 4.3.6
%global VERSION %%{version}%%{prever}
Release: 2%{?dist}
Release: 3%{?dist}
# NEVER CHANGE THE EPOCH on this package. The previous maintainer (prior to
# dcantrell maintaining the package) made incorrect use of the epoch and
# that's why it is at 12 now. It should have never been used, but it was.
@ -661,9 +661,14 @@ done
%endif
%changelog
* Thu Jul 27 2017 Pavel Zhukov <pzhukov@redhat.com> - 12:4.3.6-3
- Recreate /etc/resolv.conf if NetworkManager screwed it up (#1475279)
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 12:4.3.6-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Fri Jul 14 2017 Pavel Zhukov <pzhukov@redhat.com> - 12:4.3.6-1
- New version 4.3.6