Use '-r' xargs argument
This will pervent running sed if there are no results passed to xargs
This commit is contained in:
parent
ea786eeb60
commit
b6aebeacae
@ -19,7 +19,7 @@ module VagrantPlugins
|
||||
sed -i 's/\\(HOSTNAME=\\).*/\\1#{name}/' /etc/sysconfig/network
|
||||
fi
|
||||
# Update DNS
|
||||
find /etc/sysconfig/network-scripts -maxdepth 1 -type f -name 'ifcfg-*' | xargs sed -i 's/\\(DHCP_HOSTNAME=\\).*/\\1\"#{basename}\"/'
|
||||
find /etc/sysconfig/network-scripts -maxdepth 1 -type f -name 'ifcfg-*' | xargs -r sed -i 's/\\(DHCP_HOSTNAME=\\).*/\\1\"#{basename}\"/'
|
||||
# Set the hostname - use hostnamectl if available
|
||||
echo '#{name}' > /etc/hostname
|
||||
EOH
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user