guests/alt: Adjust flavour detect and restart network after set hostname

This commit is contained in:
Evgeny Sinelnikov 2017-07-09 18:16:25 +03:00
parent 26f7a04b86
commit 6ef55c172d
2 changed files with 16 additions and 1 deletions

View File

@ -35,6 +35,8 @@ module VagrantPlugins
sed -i -e "s/\(\s\)$CURRENT_HOSTNAME_SHORT\(\s\)/\1$NEW_HOSTNAME_SHORT\2/g" -e "s/\(\s\)$CURRENT_HOSTNAME_SHORT$/\1$NEW_HOSTNAME_SHORT/g" /etc/hosts
fi
# Restart network
service network restart
EOH
end
end

View File

@ -5,6 +5,17 @@ module VagrantPlugins
def self.flavor(machine)
# Read the version file
if !comm.test("test -f /etc/os-release")
name = nil
machine.communicate.sudo("grep NAME /etc/os-release") do |type, data|
if type == :stdout
name = data.split("=")[1].chomp.to_i
end
end
if name.nil? and name == "Sisyphus"
return :alt
end
version = nil
machine.communicate.sudo("grep VERSION_ID /etc/os-release") do |type, data|
if type == :stdout
@ -24,7 +35,9 @@ module VagrantPlugins
end
# Detect various flavors we care about
if output =~ /(ALT Workstation K|ALT Linux starter kit)\s*8( .+)?/i
if output =~ /(ALT SP|ALT Workstation|ALT Workstation K|ALT Linux starter kit)\s*8( .+)?/i
return :alt_8
elsif output =~ /ALT\s*8( .+)?\s.+/i
return :alt_8
else
return :alt