Skip to content

Commit

Permalink
Simplify empty check for /etc/resolv.conf
Browse files Browse the repository at this point in the history
Shorten regular expression for grep command which matches empty lines
and lines with comments.

Signed-off-by: Benjamin Drung <benjamin.drung@cloud.ionos.com>
  • Loading branch information
bdrung committed Aug 21, 2019
1 parent 07d13d4 commit 179707b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion components/9990-main.sh
Expand Up @@ -171,7 +171,7 @@ Live ()
else
DNSFILE="${rootmnt}/etc/resolv.conf"
fi
if [ -f /etc/resolv.conf ] && ! grep -E -q -v '^[[:space:]]*#|^[[:space:]]*$' "${DNSFILE}"
if [ -f /etc/resolv.conf ] && ! grep -E -q -v '^[[:space:]]*(#|$)' "${DNSFILE}"
then
log_begin_msg "Copying /etc/resolv.conf to ${DNSFILE}"
cp -v /etc/resolv.conf "${DNSFILE}"
Expand Down

0 comments on commit 179707b

Please sign in to comment.