Merge pull request #8506 from chrisroberts/fix/etc-hosts
Remove comment removal from /etc/hosts file on guests
This commit is contained in:
commit
cbcddaab75
|
@ -8,9 +8,6 @@ module VagrantPlugins
|
||||||
if !comm.test("hostname -f | grep '^#{name}$'", sudo: false)
|
if !comm.test("hostname -f | grep '^#{name}$'", sudo: false)
|
||||||
basename = name.split(".", 2)[0]
|
basename = name.split(".", 2)[0]
|
||||||
comm.sudo <<-EOH.gsub(/^ {14}/, "")
|
comm.sudo <<-EOH.gsub(/^ {14}/, "")
|
||||||
# Remove comments and blank lines from /etc/hosts
|
|
||||||
sed -i'' -e 's/#.*$//' -e '/^$/d' /etc/hosts
|
|
||||||
|
|
||||||
# Set hostname
|
# Set hostname
|
||||||
hostnamectl set-hostname '#{basename}'
|
hostnamectl set-hostname '#{basename}'
|
||||||
|
|
||||||
|
|
|
@ -8,9 +8,6 @@ module VagrantPlugins
|
||||||
if !comm.test("hostname -f | grep '^#{name}$'", sudo: false)
|
if !comm.test("hostname -f | grep '^#{name}$'", sudo: false)
|
||||||
basename = name.split(".", 2)[0]
|
basename = name.split(".", 2)[0]
|
||||||
comm.sudo <<-EOH.gsub(/^ {14}/, "")
|
comm.sudo <<-EOH.gsub(/^ {14}/, "")
|
||||||
# Remove comments and blank lines from /etc/hosts
|
|
||||||
sed -i'' -e 's/#.*$//' -e '/^$/d' /etc/hosts
|
|
||||||
|
|
||||||
# Set hostname
|
# Set hostname
|
||||||
hostnamectl set-hostname '#{basename}'
|
hostnamectl set-hostname '#{basename}'
|
||||||
|
|
||||||
|
|
|
@ -22,10 +22,6 @@ module VagrantPlugins
|
||||||
|
|
||||||
hostname '#{name}'
|
hostname '#{name}'
|
||||||
|
|
||||||
# Remove comments and blank lines from /etc/hosts
|
|
||||||
sed -i'' -e 's/#.*$//' /etc/hosts
|
|
||||||
sed -i'' -e '/^$/d' /etc/hosts
|
|
||||||
|
|
||||||
# Prepend ourselves to /etc/hosts - sed on bsd is sad
|
# Prepend ourselves to /etc/hosts - sed on bsd is sad
|
||||||
grep -w '#{name}' /etc/hosts || {
|
grep -w '#{name}' /etc/hosts || {
|
||||||
echo -e '127.0.0.1\\t#{name}\\t#{basename}' | cat - /etc/hosts > /tmp/tmp-hosts &&
|
echo -e '127.0.0.1\\t#{name}\\t#{basename}' | cat - /etc/hosts > /tmp/tmp-hosts &&
|
||||||
|
|
|
@ -16,9 +16,6 @@ module VagrantPlugins
|
||||||
hostnamectl set-hostname '#{basename}'
|
hostnamectl set-hostname '#{basename}'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Remove comments and blank lines from /etc/hosts
|
|
||||||
sed -i'' -e 's/#.*$//' -e '/^$/d' /etc/hosts
|
|
||||||
|
|
||||||
# Prepend ourselves to /etc/hosts
|
# Prepend ourselves to /etc/hosts
|
||||||
grep -w '#{name}' /etc/hosts || {
|
grep -w '#{name}' /etc/hosts || {
|
||||||
sed -i'' '1i 127.0.0.1\\t#{name}\\t#{basename}' /etc/hosts
|
sed -i'' '1i 127.0.0.1\\t#{name}\\t#{basename}' /etc/hosts
|
||||||
|
|
|
@ -12,10 +12,6 @@ module VagrantPlugins
|
||||||
hostname '#{name}'
|
hostname '#{name}'
|
||||||
sed -i '' 's/^hostname=.*$/hostname=\"#{name}\"/' /etc/rc.conf
|
sed -i '' 's/^hostname=.*$/hostname=\"#{name}\"/' /etc/rc.conf
|
||||||
|
|
||||||
# Remove comments and blank lines from /etc/hosts
|
|
||||||
sed -i'' -e 's/#.*$//' /etc/hosts
|
|
||||||
sed -i'' -e '/^$/d' /etc/hosts
|
|
||||||
|
|
||||||
# Prepend ourselves to /etc/hosts
|
# Prepend ourselves to /etc/hosts
|
||||||
grep -w '#{name}' /etc/hosts || {
|
grep -w '#{name}' /etc/hosts || {
|
||||||
echo -e '127.0.0.1\\t#{name}\\t#{basename}' | cat - /etc/hosts > /tmp/tmp-hosts
|
echo -e '127.0.0.1\\t#{name}\\t#{basename}' | cat - /etc/hosts > /tmp/tmp-hosts
|
||||||
|
|
|
@ -18,10 +18,6 @@ module VagrantPlugins
|
||||||
echo "hostname=#{basename}" > /etc/conf.d/hostname
|
echo "hostname=#{basename}" > /etc/conf.d/hostname
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Remove comments and blank lines from /etc/hosts
|
|
||||||
sed -i'' -e 's/#.*$//' /etc/hosts
|
|
||||||
sed -i'' -e '/^$/d' /etc/hosts
|
|
||||||
|
|
||||||
# Prepend ourselves to /etc/hosts
|
# Prepend ourselves to /etc/hosts
|
||||||
grep -w '#{name}' /etc/hosts || {
|
grep -w '#{name}' /etc/hosts || {
|
||||||
echo -e '127.0.0.1\\t#{name}\\t#{basename}' | cat - /etc/hosts > /tmp/tmp-hosts &&
|
echo -e '127.0.0.1\\t#{name}\\t#{basename}' | cat - /etc/hosts > /tmp/tmp-hosts &&
|
||||||
|
|
|
@ -12,9 +12,6 @@ module VagrantPlugins
|
||||||
echo '#{name}' > /etc/nodename
|
echo '#{name}' > /etc/nodename
|
||||||
hostname '#{name}'
|
hostname '#{name}'
|
||||||
|
|
||||||
# Remove comments and blank lines from /etc/hosts
|
|
||||||
sed -i'' -e 's/#.*$//' -e '/^$/d' /etc/hosts
|
|
||||||
|
|
||||||
# Prepend ourselves to /etc/hosts
|
# Prepend ourselves to /etc/hosts
|
||||||
grep -w '#{name}' /etc/hosts || {
|
grep -w '#{name}' /etc/hosts || {
|
||||||
echo -e '127.0.0.1\\t#{name}\\t#{basename}' | cat - /etc/hosts > /tmp/tmp-hosts
|
echo -e '127.0.0.1\\t#{name}\\t#{basename}' | cat - /etc/hosts > /tmp/tmp-hosts
|
||||||
|
|
|
@ -13,10 +13,6 @@ module VagrantPlugins
|
||||||
sed -i'' 's/^hostname=.*$/hostname=\"#{name}\"/' /etc/rc.conf
|
sed -i'' 's/^hostname=.*$/hostname=\"#{name}\"/' /etc/rc.conf
|
||||||
echo '#{name}' > /etc/myname
|
echo '#{name}' > /etc/myname
|
||||||
|
|
||||||
# Remove comments and blank lines from /etc/hosts
|
|
||||||
sed -i'' -e 's/#.*$//' /etc/hosts
|
|
||||||
sed -i'' -e '/^$/d' /etc/hosts
|
|
||||||
|
|
||||||
# Prepend ourselves to /etc/hosts
|
# Prepend ourselves to /etc/hosts
|
||||||
grep -w '#{name}' /etc/hosts || {
|
grep -w '#{name}' /etc/hosts || {
|
||||||
echo -e '127.0.0.1\\t#{name}\\t#{basename}' | cat - /etc/hosts > /tmp/tmp-hosts
|
echo -e '127.0.0.1\\t#{name}\\t#{basename}' | cat - /etc/hosts > /tmp/tmp-hosts
|
||||||
|
|
|
@ -12,9 +12,6 @@ module VagrantPlugins
|
||||||
echo '#{name}' > /etc/hostname
|
echo '#{name}' > /etc/hostname
|
||||||
hostname '#{name}'
|
hostname '#{name}'
|
||||||
|
|
||||||
# Remove comments and blank lines from /etc/hosts
|
|
||||||
sed -i'' -e 's/#.*$//' -e '/^$/d' /etc/hosts
|
|
||||||
|
|
||||||
# Prepend ourselves to /etc/hosts
|
# Prepend ourselves to /etc/hosts
|
||||||
grep -w '#{name}' /etc/hosts || {
|
grep -w '#{name}' /etc/hosts || {
|
||||||
sed -i'' '1i 127.0.0.1\\t#{name}\\t#{basename}' /etc/hosts
|
sed -i'' '1i 127.0.0.1\\t#{name}\\t#{basename}' /etc/hosts
|
||||||
|
|
|
@ -13,9 +13,6 @@ module VagrantPlugins
|
||||||
|
|
||||||
sed -i 's/\\(DHCP_HOSTNAME=\\).*/\\1\"#{name}\"/' /etc/sysconfig/interfaces/ifcfg-*
|
sed -i 's/\\(DHCP_HOSTNAME=\\).*/\\1\"#{name}\"/' /etc/sysconfig/interfaces/ifcfg-*
|
||||||
|
|
||||||
# Remove comments and blank lines from /etc/hosts
|
|
||||||
sed -i'' -e 's/#.*$//' -e '/^$/d' /etc/hosts
|
|
||||||
|
|
||||||
# Prepend ourselves to /etc/hosts
|
# Prepend ourselves to /etc/hosts
|
||||||
grep -w '#{name}' /etc/hosts || {
|
grep -w '#{name}' /etc/hosts || {
|
||||||
sed -i'' '1i 127.0.0.1\\t#{name}\\t#{basename}' /etc/hosts
|
sed -i'' '1i 127.0.0.1\\t#{name}\\t#{basename}' /etc/hosts
|
||||||
|
|
|
@ -23,9 +23,6 @@ module VagrantPlugins
|
||||||
hostname -F /etc/hostname
|
hostname -F /etc/hostname
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Remove comments and blank lines from /etc/hosts
|
|
||||||
sed -i'' -e 's/#.*$//' -e '/^$/d' /etc/hosts
|
|
||||||
|
|
||||||
# Prepend ourselves to /etc/hosts
|
# Prepend ourselves to /etc/hosts
|
||||||
grep -w '#{name}' /etc/hosts || {
|
grep -w '#{name}' /etc/hosts || {
|
||||||
sed -i'' '1i 127.0.0.1\\t#{name}\\t#{basename}' /etc/hosts
|
sed -i'' '1i 127.0.0.1\\t#{name}\\t#{basename}' /etc/hosts
|
||||||
|
|
|
@ -14,9 +14,6 @@ module VagrantPlugins
|
||||||
chmod o-w /etc/hostname
|
chmod o-w /etc/hostname
|
||||||
hostname -F /etc/hostname
|
hostname -F /etc/hostname
|
||||||
|
|
||||||
# Remove comments and blank lines from /etc/hosts
|
|
||||||
sed -i'' -e 's/#.*$//' -e '/^$/d' /etc/hosts
|
|
||||||
|
|
||||||
# Prepend ourselves to /etc/hosts
|
# Prepend ourselves to /etc/hosts
|
||||||
grep -w '#{name}' /etc/hosts || {
|
grep -w '#{name}' /etc/hosts || {
|
||||||
sed -i'' '1i 127.0.0.1\\t#{name}\\t#{basename}' /etc/hosts
|
sed -i'' '1i 127.0.0.1\\t#{name}\\t#{basename}' /etc/hosts
|
||||||
|
|
|
@ -11,9 +11,6 @@ module VagrantPlugins
|
||||||
echo '#{name}' > /etc/HOSTNAME
|
echo '#{name}' > /etc/HOSTNAME
|
||||||
hostname '#{name}'
|
hostname '#{name}'
|
||||||
|
|
||||||
# Remove comments and blank lines from /etc/hosts
|
|
||||||
sed -i'' -e 's/#.*$//' -e '/^$/d' /etc/hosts
|
|
||||||
|
|
||||||
# Prepend ourselves to /etc/hosts
|
# Prepend ourselves to /etc/hosts
|
||||||
grep -w '#{name}' /etc/hosts || {
|
grep -w '#{name}' /etc/hosts || {
|
||||||
sed -i'' '1i 127.0.0.1\\t#{name}\\t#{basename}' /etc/hosts
|
sed -i'' '1i 127.0.0.1\\t#{name}\\t#{basename}' /etc/hosts
|
||||||
|
|
Loading…
Reference in New Issue