Merge pull request #9404 from hakoerber/fix-9403

Debian: Point hostname to 127.0.1.1 in /etc/hosts
This commit is contained in:
Brian Cain 2018-02-12 09:21:01 -08:00 committed by GitHub
commit a855c702c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -18,7 +18,11 @@ module VagrantPlugins
# Prepend ourselves to /etc/hosts
grep -w '#{name}' /etc/hosts || {
sed -i'' '1i 127.0.0.1\\t#{name}\\t#{basename}' /etc/hosts
if grep -w '^127\\.0\\.1\\.1' /etc/hosts ; then
sed -i'' 's/^127\\.0\\.1\\.1\\s.*$/127.0.1.1\\t#{name}\\t#{basename}/' /etc/hosts
else
sed -i'' '1i 127.0.1.1\\t#{name}\\t#{basename}' /etc/hosts
fi
}
# Update mailname