X-Git-Url: https://git.siccegge.de//index.cgi?p=forks%2Fvmdebootstrap.git;a=blobdiff_plain;f=vmdebootstrap;h=61f0760b194f99dd3fcba3f267c618d63671784e;hp=2fc55902d425f368387f3187d6c866d17e31a287;hb=6906af4d702987376af64b4229763672f7c1eca2;hpb=a7031c97fddc7db735b930677551343efa5e2249 diff --git a/vmdebootstrap b/vmdebootstrap index 2fc5590..61f0760 100755 --- a/vmdebootstrap +++ b/vmdebootstrap @@ -174,6 +174,15 @@ class VmDebootstrap(cliapp.Application): hostname = self.settings['hostname'] with open(os.path.join(rootdir, 'etc', 'hostname'), 'w') as f: f.write('%s\n' % hostname) + + etc_hosts = os.path.join(rootdir, 'etc', 'hosts') + with open(etc_hosts, 'r') as f: + data = f.read() + with open(etc_hosts, 'w') as f: + for line in data.splitlines(): + if line.startswith('127.0.0.1'): + line += ' %s' % hostname + f.write('%s\n' % line) def set_root_password(self, rootdir): if self.settings['root-password']: