View | Details | Raw Unified | Return to bug 22190 | Differences between
and this patch

Collapse All | Expand All

(-)conffiles/usr/share/univention-thin-client-flash/flashupdate (-11 / +23 lines)
 Lines 54-65    Link Here 
54
54
55
# Spaces in servernames are not allowed with this code
55
# Spaces in servernames are not allowed with this code
56
CMDLINE="$(cat /proc/cmdline)"
56
CMDLINE="$(cat /proc/cmdline)"
57
flashserver="$(sed -e 's|.* flashServer=\([^ ]*\) .*|\1|' /proc/cmdline)"
57
flashServer="$(sed -e 's|.* flashServer=\([^ ]*\) .*|\1|' /proc/cmdline)"
58
ldapserver="$(sed -e 's|.* ldapServer=\([^ ]*\) .*|\1|' /proc/cmdline)"
58
# new ldapServer syntax
59
ldapServer="$(sed -e 's|.*ldapServer="\([^"]*\)".*|\1|' /proc/cmdline)"
60
# old ldapServer syntax
61
oldLdapServer="$(sed -e 's|.* ldapServer=\([^ ]*\) .*|\1|' /proc/cmdline)"
62
59
if [ -n "$flashServer" -a "$flashServer" != "$CMDLINE" ]; then
63
if [ -n "$flashServer" -a "$flashServer" != "$CMDLINE" ]; then
60
	server="$flashServer"
64
	server="$flashServer"
61
elif [ -n "$ldapServer" -a "$ldapServer" != "$CMDLINE" ]; then
65
elif [ -n "$ldapServer" -a "$ldapServer" != "$CMDLINE" ]; then
62
	server="$ldapServer"
66
	server="$ldapServer"
67
elif [ -n "$oldLdapServer" -a "$oldLdapServer" != "$CMDLINE" ]; then
68
	server="$oldLdapServer"
63
else
69
else
64
	server="univention-flash-server"
70
	server="univention-flash-server"
65
fi
71
fi
 Lines 72-93    Link Here 
72
78
73
echo "SERVER: $server" >>/dev/tty9 2>&1
79
echo "SERVER: $server" >>/dev/tty9 2>&1
74
80
75
server_ip=$(host $server | sed -n "s|.* has address ||p")
81
mac=$(LC_ALL=C ifconfig eth0 | sed -n 's|.*HWaddr \([^ ]*\) .*|\1|p')
76
if [ -z "$server_ip" ]; then
77
	server_ip="$server"
78
fi
79
82
80
rm -f /tmp/flashupdate.sh
83
for i in $server; do
84
	server_ip=$(host $i | sed -n "s|.* has address ||p")
85
	if [ -z "$server_ip" ]; then
86
		server_ip="$i"
87
	fi
81
88
82
echo "IP: $server_ip" >>/dev/tty9 2>&1
89
	rm -f /tmp/flashupdate.sh
83
90
84
mac=$(LC_ALL=C ifconfig eth0 | sed -n 's|.*HWaddr \([^ ]*\) .*|\1|p')
91
	echo "IP: $server_ip" >>/dev/tty9 2>&1
85
92
86
wget -O /tmp/flashupdate.sh http://$server_ip/univention-thin-client-flash/flashupdate.py?mac=$mac >>/dev/tty9 2>&1
87
93
94
	wget -O /tmp/flashupdate.sh http://$server_ip/univention-thin-client-flash/flashupdate.py?mac=$mac >>/dev/tty9 2>&1
95
96
	if [ -s /tmp/flashupdate.sh ]; then
97
		break
98
	fi
99
done
100
88
if [ -e /tmp/flashupdate.sh ]; then
101
if [ -e /tmp/flashupdate.sh ]; then
89
	chmod +x /tmp/flashupdate.sh
102
	chmod +x /tmp/flashupdate.sh
90
91
	/tmp/flashupdate.sh
103
	/tmp/flashupdate.sh
92
fi
104
fi
93
105
(-)conffiles/etc/univention/flash/thin-client-flash-update (-9 / +13 lines)
 Lines 123-128    Link Here 
123
234
124
if [ -z "$thinclient_flash_update_url" ]; then
235
if [ -z "$thinclient_flash_update_url" ]; then
125
	thinclient_flash_server_ip=$(host ${thinclient_flash_server} | sed -n "s|.* has address ||p")
236
	thinclient_flash_server_ip=$(host ${thinclient_flash_server} | sed -n "s|.* has address ||p")
237
	# is name a ip?
238
	ip="$(echo $thinclient_flash_server | sed -n 's|[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*|'$thinclient_flash_server'|p')"
239
	if [ -n "$ip" ]; then
240
		thinclient_flash_server_ip="$thinclient_flash_server"
241
	else
242
		thinclient_flash_server_ip=$(host ${thinclient_flash_server} | sed -n "s|.* has address ||p")
243
	fi
126
	url="http://${thinclient_flash_server_ip}/univention-thin-client-flash/"
244
	url="http://${thinclient_flash_server_ip}/univention-thin-client-flash/"
127
else
245
else
128
	# Busybox can not resolve dns names ...
246
	# Busybox can not resolve dns names ...
 Lines 131-136    Link Here 
131
		# is name a ip?
249
		# is name a ip?
132
		ip="$(echo $name | sed -n 's|[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*|'$name'|p')"
250
		ip="$(echo $name | sed -n 's|[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*|'$name'|p')"
133
		if [ -n "$ip" ]; then
251
		if [ -n "$ip" ]; then
252
			thinclient_flash_server_ip="$name"
134
			url="$thinclient_flash_update_url"
253
			url="$thinclient_flash_update_url"
135
		else
254
		else
136
			thinclient_flash_server_ip=$(host $name | sed -n "s|.* has address ||p")
255
			thinclient_flash_server_ip=$(host $name | sed -n "s|.* has address ||p")
 Lines 227-240    Link Here 
227
	partition=0
347
	partition=0
228
fi
348
fi
229
349
230
nameserver=$(cat /proc/cmdline | grep DNSSERVER | sed -e 's/.*DNSSERVER=//g' | awk '{print $1;}')
350
# save flash server's ip as boot parameter
231
ldapserver=$(cat /proc/cmdline | grep ldapServer | sed -e 's/.*ldapServer=//g' | awk '{print "ldapServer="$1;}')
351
if [ -n "$thinclient_flash_server_ip" ]; then
232
ldapport=$(cat /proc/cmdline | grep ldapPort | sed -e 's/.*ldapPort=//g' | awk '{print "ldapPort="$1;}')
352
	flashserverCmdline="flashServer=$thinclient_flash_server_ip"
233
vga=$(cat /proc/cmdline | grep vga | sed -e 's/.*vga=//g' | awk '{print "vga="$1;}')
353
	flashserver="$thinclient_flash_server_ip"
234
quiet_cmdline=$(cat /proc/cmdline | grep " quiet")
235
quiet=""
236
if [ -n "$quiet_cmdline" ]; then
237
	quiet="quiet"
238
fi
354
fi
239
355
240
356
 Lines 291-297    Link Here 
291
    PATH_BASE=/mnt
407
    PATH_BASE=/mnt
292
    PATH_MBR=/usr/lib/syslinux/mbr.bin
408
    PATH_MBR=/usr/lib/syslinux/mbr.bin
293
409
294
    echo "default linux initrd=initrd.splash root=$rootpart DNSSERVER=$nameserver $vga $quiet splash=silent $ldapserver $ldapport" > $PATH_EXTLINUX
410
    echo "default linux initrd=initrd.splash root=$rootpart $nameserverCmdline $vga $quiet splash=silent $flashserverCmdline $ldapserverCmdline $ldapport $loglevel" > $PATH_EXTLINUX
295
411
296
    # store current network configuration
412
    # store current network configuration
297
    echo "FLASH_HOSTNAME=$hostname" > $PATH_NETWORKCONFIG
413
    echo "FLASH_HOSTNAME=$hostname" > $PATH_NETWORKCONFIG
(-)var/www/univention-thin-client-flash/flashupdate.py (-1 / +42 lines)
 Lines 100-113    Link Here 
100
			print ''
100
			print ''
101
			#print 'eval "$(univention-config-registry shell)"'
101
			#print 'eval "$(univention-config-registry shell)"'
102
102
103
			# hostname and domain
103
			print 'hostname=\"%s\"' % clientObject[0][1].get('cn')[0]
104
			print 'hostname=\"%s\"' % clientObject[0][1].get('cn')[0]
104
			print 'domainname=\"%s\"' % ucr.get('domainname')
105
			print 'domainname=\"%s\"' % ucr.get('domainname')
105
			print 'thinclient_flash_server=\"%s.%s\"' % (ucr.get('hostname'), ucr.get('domainname'))
106
107
			# boot paramter -> use values from pxe/* vars
108
			
109
			# flash server from ucr var, default fqdn
110
			flashServer = ucr.get('pxe/thinclient/flash/server', "")
111
			if flashServer:
112
				print 'thinclient_flash_server="%s"' % flashServer
113
			else:
114
				print 'thinclient_flash_server="%s.%s"' % (ucr.get('hostname'), ucr.get('domainname'))
115
116
			# ldap server
117
			ldapServer = ucr.get('pxe/ldapserver', "")
118
			if ldapServer:
119
				print 'ldapserverCmdline="ldapServer=\\"%s\\""' % ldapServer
120
				print 'ldapserver="%s"' % ldapServer
121
122
			# ldap port
123
			ldapPort = ucr.get('pxe/ldapport', "")
124
			if ldapPort:
125
				print 'ldapport="ldapPort=%s"' % ldapPort
126
127
			# vga
128
			vga = ucr.get('pxe/vga', "")
129
			if vga:
130
				print 'vga="vga=%s"' % vga
131
132
			# quiet
133
			if ucr.get('pxe/quiet', "no").lower() in ['yes', 'true', '1']:
134
				print 'quiet="quiet"'
135
136
			# loglevel
137
			loglevel = ucr.get('pxe/loglevel', "")
138
			if loglevel:
139
				print 'loglevel="loglevel=%s"' % loglevel
140
141
			# nameserver
142
			print 'nameserverCmdline="DNSSERVER=%s"' % ucr.get('pxe/nameserver')
143
			print 'nameserver="%s"' % ucr.get('pxe/nameserver')
144
145
			# ucr policies
106
			for k in results.keys():
146
			for k in results.keys():
107
				# 7468696e636c69656e742f666c6173682f ==> thinclient/flash/
147
				# 7468696e636c69656e742f666c6173682f ==> thinclient/flash/
108
				if k.startswith('univentionRegistry;entry-hex-7468696e636c69656e742f666c6173682f'):
148
				if k.startswith('univentionRegistry;entry-hex-7468696e636c69656e742f666c6173682f'):
109
					print '%s=\'%s\'' % (k.split('univentionRegistry;entry-hex-')[-1].decode('hex').replace('/','_'), results[k][0])
149
					print '%s=\'%s\'' % (k.split('univentionRegistry;entry-hex-')[-1].decode('hex').replace('/','_'), results[k][0])
110
150
151
			# add flash script
111
			lines = open('/etc/univention/flash/thin-client-flash-update').readlines()
152
			lines = open('/etc/univention/flash/thin-client-flash-update').readlines()
112
			for line in lines:
153
			for line in lines:
113
				print line,
154
				print line,

Return to bug 22190