View | Details | Raw Unified | Return to bug 22670
Collapse All | Expand All

(-)debian/univention-config-registry.univention-config-registry (+6 lines)
 Lines 98-103    Link Here 
98
Preinst: interfaces.py
98
Preinst: interfaces.py
99
Postinst: interfaces.py
99
Postinst: interfaces.py
100
Variables: interfaces/eth.*
100
Variables: interfaces/eth.*
101
Variables: interfaces/br.*
101
Variables: interfaces/handler
102
Variables: interfaces/handler
102
Variables: gateway
103
Variables: gateway
103
104
 Lines 106-111    Link Here 
106
Variables: interfaces/eth0/type
107
Variables: interfaces/eth0/type
107
Variables: interfaces/eth.*/address
108
Variables: interfaces/eth.*/address
108
Variables: interfaces/eth.*/hosts
109
Variables: interfaces/eth.*/hosts
110
Variables: interfaces/br.*/address
111
Variables: interfaces/br.*/hosts
109
Variables: hostname
112
Variables: hostname
110
Variables: domainname
113
Variables: domainname
111
Variables: hosts/static/.*
114
Variables: hosts/static/.*
 Lines 116-121    Link Here 
116
Variables: interfaces/eth.*/address
119
Variables: interfaces/eth.*/address
117
Variables: interfaces/eth.*/type
120
Variables: interfaces/eth.*/type
118
Variables: interfaces/eth.*/hosts
121
Variables: interfaces/eth.*/hosts
122
Variables: interfaces/br.*/address
123
Variables: interfaces/br.*/type
124
Variables: interfaces/br.*/hosts
119
Variables: hostname
125
Variables: hostname
120
Variables: domainname
126
Variables: domainname
121
127
(-)conffiles/hosts.d/00-base (-6 / +15 lines)
 Lines 11-25    Link Here 
11
127.0.0.1	localhost
11
127.0.0.1	localhost
12
12
13
@!@
13
@!@
14
eth_devices=[]
14
INTERFACE_TYPES = ['eth', 'br']
15
devices = []
15
16
17
for type in INTERFACE_TYPES:
18
	vars()['%s_devices' % type] = []
19
16
for key,value in configRegistry.items():
20
for key,value in configRegistry.items():
17
	if key.startswith('interfaces/eth'):
21
	for type in INTERFACE_TYPES:
18
		k = key.split("/")[1:2][0]
22
		if key.startswith('interfaces/%s' % type):
19
		if k not in eth_devices:
23
			k = key.split("/")[1:2][0]
20
			eth_devices.append(k)
24
			if k not in vars()['%s_devices' % type]:
25
				vars()['%s_devices' % type].append(k)
21
26
22
for i in eth_devices:
27
for type in INTERFACE_TYPES:
28
	vars()['%s_devices' % type].sort()
29
	devices.extend( vars()['%s_devices' % type] )
30
31
for i in devices:
23
	if configRegistry['interfaces/%s/address' % i]:
32
	if configRegistry['interfaces/%s/address' % i]:
24
		name = configRegistry.get('interfaces/%s/hosts' % (i), '%s.%s %s' % (configRegistry['hostname'],configRegistry['domainname'],configRegistry['hostname']))
33
		name = configRegistry.get('interfaces/%s/hosts' % (i), '%s.%s %s' % (configRegistry['hostname'],configRegistry['domainname'],configRegistry['hostname']))
25
		if name:
34
		if name:
(-)conffiles/network/interfaces (-11 / +21 lines)
 Lines 13-28    Link Here 
13
iface lo inet loopback
13
iface lo inet loopback
14
14
15
@!@
15
@!@
16
INTERFACE_TYPES = ['eth', 'br']
17
devices = []
16
18
17
eth_devices=[]
19
for type in INTERFACE_TYPES:
20
	vars()['%s_devices' % type] = []
18
21
19
for key,value in configRegistry.items():
22
for key,value in configRegistry.items():
20
	if key.startswith('interfaces/eth'):
23
	for type in INTERFACE_TYPES:
21
		k = key.split("/")[1:2][0]
24
		if key.startswith('interfaces/%s' % type):
22
		if k not in eth_devices:
25
			k = key.split("/")[1:2][0]
23
			eth_devices.append(k)
26
			if k not in vars()['%s_devices' % type]:
27
				vars()['%s_devices' % type].append(k)
24
28
25
eth_devices.sort()
29
for type in INTERFACE_TYPES:
30
	vars()['%s_devices' % type].sort()
31
	devices.extend( vars()['%s_devices' % type] )
26
32
27
def check_gateway (ip, netmask, gateway):
33
def check_gateway (ip, netmask, gateway):
28
	if not gateway:
34
	if not gateway:
 Lines 36-48    Link Here 
36
	if samenet == 1:
42
	if samenet == 1:
37
		return 1
43
		return 1
38
44
39
40
gateway=False
45
gateway=False
41
configExists=False
46
configExists=False
42
ifhandler=configRegistry.get('interfaces/handler','ifplugd')
47
ifhandler=configRegistry.get('interfaces/handler','ifplugd')
43
48
44
49
for i in devices:
45
for i in eth_devices:
46
	configExists=False
50
	configExists=False
47
	iface = i.replace("_", ":")
51
	iface = i.replace("_", ":")
48
	if configRegistry.has_key('interfaces/%s/type' % i) and configRegistry['interfaces/%s/type' % i] == 'dhcp':
52
	if configRegistry.has_key('interfaces/%s/type' % i) and configRegistry['interfaces/%s/type' % i] == 'dhcp':
 Lines 54-60    Link Here 
54
			print 'auto %s' % iface
58
			print 'auto %s' % iface
55
			print 'iface %s inet dhcp' % iface
59
			print 'iface %s inet dhcp' % iface
56
			configExists=True
60
			configExists=True
57
	elif  configRegistry['interfaces/%s/address' % i]:
61
	elif configRegistry['interfaces/%s/address' % i]:
58
		print 'auto %s' % iface
62
		print 'auto %s' % iface
59
		print 'iface %s inet static' % iface
63
		print 'iface %s inet static' % iface
60
		
64
		
 Lines 70-75    Link Here 
70
				print 'gateway '+configRegistry['gateway']
74
				print 'gateway '+configRegistry['gateway']
71
				gateway=True
75
				gateway=True
72
		configExists=True
76
		configExists=True
77
	elif iface.startswith('br') and configRegistry.get('interfaces/%s/type' % i, '') == 'manual':
78
		print 'auto %s' % iface
79
		print 'iface %s inet %s' % (iface, configRegistry.get('interfaces/%s/type' % i))
80
		configExists=True
73
81
74
	if configExists:
82
	if configExists:
75
		for key,value in configRegistry.items():
83
		for key,value in configRegistry.items():
 Lines 80-88    Link Here 
80
		for key,value in configRegistry.items():
88
		for key,value in configRegistry.items():
81
			if key.startswith('interfaces/%s/options/' % i):
89
			if key.startswith('interfaces/%s/options/' % i):
82
				print value
90
				print value
91
			if key.startswith('interfaces/%s/bridge/' % i):
92
				print 'bridge_%s %s' % (key.split('/')[3], value)
93
83
		if i == "eth0":
94
		if i == "eth0":
84
			if configRegistry.get('interfaces/eth0/netmask', "") == "255.255.255.255" and configRegistry.get('gateway', False):
95
			if configRegistry.get('interfaces/eth0/netmask', "") == "255.255.255.255" and configRegistry.get('gateway', False):
85
				print "up ip route add %s/32 dev eth0" % configRegistry["gateway"]
96
				print "up ip route add %s/32 dev eth0" % configRegistry["gateway"]
86
				print "up route add default gw %s" % configRegistry["gateway"]
97
				print "up route add default gw %s" % configRegistry["gateway"]
87
88
@!@
98
@!@
(-)conffiles/interfaces.py (-1 / +2 lines)
 Lines 69-75    Link Here 
69
69
70
def preinst(baseConfig, changes):
70
def preinst(baseConfig, changes):
71
	for iface in set(changes):
71
	for iface in set(changes):
72
		if baseConfig.has_key(iface):
72
		# On "ucr unset" the variable does not exist anymore - shouldn't we bring down the interface?
73
		if baseConfig.has_key(iface) or changes[iface][1] == '':
73
			stop_iface(interface(iface))
74
			stop_iface(interface(iface))
74
75
75
def postinst(baseConfig, changes):
76
def postinst(baseConfig, changes):

Return to bug 22670