Ok, ich darf keine Datei ohne Erweiterung oder mit Erweiterung
.txt hochladen (was soll denn der Unsinn), also inline… auch
wenn dabei die Tabs kaputtgehen.
# Warning: This file is auto-generated and might be overwritten by
# univention-config-registry.
# Please edit the following file instead:
# Warnung: Diese Datei wurde automatisch generiert und kann durch
# univention-config-registry überschrieben werden.
# Bitte bearbeiten Sie an Stelle dessen die folgende Datei:
#
# /etc/univention/templates/files/etc/network/interfaces
#
auto lo
iface lo inet loopback
@!@
def check_gateway (ip, netmask, gateway):
if not gateway:
return 0
samenet=1
for k in range(0,4):
if not (int(ip[k])&int(netmask[k])) == (int(gateway[k])&int(netmask[k])):
samenet=0
if samenet == 0:
return 0
if samenet == 1:
return 1
gateway=False
configRegistry_items = configRegistry.items()
configRegistry_items.sort()
for i in range(0,4):
if configRegistry.has_key('interfaces/eth%s/type' % i) and configRegistry['interfaces/eth%s/type' % i] == 'dhcp':
if configRegistry.has_key('server/role') and ( configRegistry['server/role'] == 'mobileclient' or configRegistry['server/role'] == 'fatclient' ) and not (configRegistry.has_key('interfaces/eth%s/ifplugd' % i) and configRegistry['interfaces/eth%s/ifplugd' % i] == 'no'):
print
else:
print
print 'auto eth%s' % i
print 'iface eth%s inet dhcp' % i
elif configRegistry['interfaces/eth%s/address' % i]:
if configRegistry.has_key('server/role') and ( configRegistry['server/role'] == 'mobileclient' or configRegistry['server/role'] == 'fatclient' ) and not (configRegistry.has_key('interfaces/eth%s/ifplugd' % i) and configRegistry['interfaces/eth%s/ifplugd' % i] == 'no'):
print
else:
print
print 'auto eth%s' % i
print 'iface eth%s inet static' % i
print 'address '+configRegistry['interfaces/eth%s/address' % i]
if configRegistry['interfaces/eth%s/network' % i]:
print 'network '+configRegistry['interfaces/eth%s/network' % i]
if configRegistry['interfaces/eth%s/netmask' % i]:
print 'netmask '+configRegistry['interfaces/eth%s/netmask' % i]
if configRegistry['interfaces/eth%s/broadcast' % i]:
print 'broadcast '+configRegistry['interfaces/eth%s/broadcast' % i]
if configRegistry['interfaces/eth%s/address' % i] and configRegistry['interfaces/eth%s/netmask' % i] and configRegistry['gateway'] and not gateway:
if check_gateway(configRegistry['interfaces/eth%s/address' % i].split('.'), configRegistry['interfaces/eth%s/netmask' % i].split('.'), configRegistry['gateway'].split('.')):
print 'gateway '+configRegistry['gateway']
gateway=True
for j in range(0,4):
if configRegistry.has_key('interfaces/eth%s_%s/type' % (i,j)) and configRegistry['interfaces/eth%s_%s/type' % (i,j) ] == 'dhcp':
if configRegistry.has_key('server/role') and ( configRegistry['server/role'] == 'mobileclient' or configRegistry['server/role'] == 'fatclient' ) and not (configRegistry.has_key('interfaces/eth%s_%s/ifplugd' % (i,j)) and configRegistry['interfaces/eth%s_%s/ifplugd' % (i,j)] == 'no'):
print
else:
print
print 'auto eth%s:%s' % (i,j)
print 'iface eth%s:%s inet dchp' % (i,j)
elif configRegistry['interfaces/eth%s_%s/address' % (i,j) ]:
if configRegistry.has_key('server/role') and ( configRegistry['server/role'] == 'mobileclient' or configRegistry['server/role'] == 'fatclient' ) and not (configRegistry.has_key('interfaces/eth%s_%s/ifplugd' % (i,j)) and configRegistry['interfaces/eth%s_%s/ifplugd' % (i,j)] == 'no'):
print
else:
print
print 'auto eth%s:%s' % (i,j)
print 'iface eth%s:%s inet static' % (i,j)
print 'address '+configRegistry['interfaces/eth%s_%s/address' % (i,j) ]
if configRegistry['interfaces/eth%s_%s/network' % (i,j) ]:
print 'network '+configRegistry['interfaces/eth%s_%s/network' % (i,j) ]
if configRegistry['interfaces/eth%s_%s/netmask' % (i,j) ]:
print 'netmask '+configRegistry['interfaces/eth%s_%s/netmask' % (i,j) ]
if configRegistry['interfaces/eth%s_%s/broadcast' % (i,j) ]:
print 'broadcast '+configRegistry['interfaces/eth%s_%s/broadcast' % (i,j) ]
if configRegistry['interfaces/eth%s_%s/address' % (i,j)] and configRegistry['interfaces/eth%s_%s/netmask' % (i,j)] and configRegistry['gateway'] and not gateway:
if check_gateway(configRegistry['interfaces/eth%s_%s/address' % (i,j)].split('.'), configRegistry['interfaces/eth%s_%s/netmask' % (i,j)].split('.'), configRegistry['gateway'].split('.')):
print 'gateway '+configRegistry['gateway']
gateway=True
for key,value in configRegistry_items:
if key.startswith('interfaces/eth%s/route/' % i):
if value.startswith('host ') or value.startswith('net '):
print 'up route add -%s dev eth%d' % (value, i)
for key,value in configRegistry_items:
if key.startswith('interfaces/eth%s/options/' % i):
print value
@!@