root_alias = node['image']['root_alias']

execute 'set-alias-root' do
  command "/bin/sed -e 's/^.root:.*$/root:#{root_alias}/' -i /etc/aliases"
  only_if { root_alias && File.readlines('/etc/aliases').grep(/#{root_alias}/).empty? }
end

# This needs Postfix to be installed
execute 'newaliases' do
  command '/usr/bin/newaliases'
end
