Index: conffiles/usr/share/univention-thin-client-flash/flashupdate =================================================================== --- conffiles/usr/share/univention-thin-client-flash/flashupdate (.../ucs-tcs/univention-thin-client-flash) (Revision 30122) +++ conffiles/usr/share/univention-thin-client-flash/flashupdate (.../component/tcs31-experimental/univention-thin-client-flash) (Revision 30122) @@ -54,12 +54,18 @@ # Spaces in servernames are not allowed with this code CMDLINE="$(cat /proc/cmdline)" -flashserver="$(sed -e 's|.* flashServer=\([^ ]*\) .*|\1|' /proc/cmdline)" -ldapserver="$(sed -e 's|.* ldapServer=\([^ ]*\) .*|\1|' /proc/cmdline)" +flashServer="$(sed -e 's|.* flashServer=\([^ ]*\) .*|\1|' /proc/cmdline)" +# new ldapServer syntax +ldapServer="$(sed -e 's|.*ldapServer="\([^"]*\)".*|\1|' /proc/cmdline)" +# old ldapServer syntax +oldLdapServer="$(sed -e 's|.* ldapServer=\([^ ]*\) .*|\1|' /proc/cmdline)" + if [ -n "$flashServer" -a "$flashServer" != "$CMDLINE" ]; then server="$flashServer" elif [ -n "$ldapServer" -a "$ldapServer" != "$CMDLINE" ]; then server="$ldapServer" +elif [ -n "$oldLdapServer" -a "$oldLdapServer" != "$CMDLINE" ]; then + server="$oldLdapServer" else server="univention-flash-server" fi @@ -72,22 +78,28 @@ echo "SERVER: $server" >>/dev/tty9 2>&1 -server_ip=$(host $server | sed -n "s|.* has address ||p") -if [ -z "$server_ip" ]; then - server_ip="$server" -fi +mac=$(LC_ALL=C ifconfig eth0 | sed -n 's|.*HWaddr \([^ ]*\) .*|\1|p') -rm -f /tmp/flashupdate.sh +for i in $server; do + server_ip=$(host $i | sed -n "s|.* has address ||p") + if [ -z "$server_ip" ]; then + server_ip="$i" + fi -echo "IP: $server_ip" >>/dev/tty9 2>&1 + rm -f /tmp/flashupdate.sh -mac=$(LC_ALL=C ifconfig eth0 | sed -n 's|.*HWaddr \([^ ]*\) .*|\1|p') + echo "IP: $server_ip" >>/dev/tty9 2>&1 -wget -O /tmp/flashupdate.sh http://$server_ip/univention-thin-client-flash/flashupdate.py?mac=$mac >>/dev/tty9 2>&1 + wget -O /tmp/flashupdate.sh http://$server_ip/univention-thin-client-flash/flashupdate.py?mac=$mac >>/dev/tty9 2>&1 + + if [ -s /tmp/flashupdate.sh ]; then + break + fi +done + if [ -e /tmp/flashupdate.sh ]; then chmod +x /tmp/flashupdate.sh - /tmp/flashupdate.sh fi Index: conffiles/etc/univention/flash/thin-client-flash-update =================================================================== --- conffiles/etc/univention/flash/thin-client-flash-update (.../ucs-tcs/univention-thin-client-flash) (Revision 30122) +++ conffiles/etc/univention/flash/thin-client-flash-update (.../component/tcs31-experimental/univention-thin-client-flash) (Revision 30122) @@ -123,6 +234,13 @@ if [ -z "$thinclient_flash_update_url" ]; then thinclient_flash_server_ip=$(host ${thinclient_flash_server} | sed -n "s|.* has address ||p") + # is name a ip? + ip="$(echo $thinclient_flash_server | sed -n 's|[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*|'$thinclient_flash_server'|p')" + if [ -n "$ip" ]; then + thinclient_flash_server_ip="$thinclient_flash_server" + else + thinclient_flash_server_ip=$(host ${thinclient_flash_server} | sed -n "s|.* has address ||p") + fi url="http://${thinclient_flash_server_ip}/univention-thin-client-flash/" else # Busybox can not resolve dns names ... @@ -131,6 +249,7 @@ # is name a ip? ip="$(echo $name | sed -n 's|[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*|'$name'|p')" if [ -n "$ip" ]; then + thinclient_flash_server_ip="$name" url="$thinclient_flash_update_url" else thinclient_flash_server_ip=$(host $name | sed -n "s|.* has address ||p") @@ -227,14 +347,10 @@ partition=0 fi -nameserver=$(cat /proc/cmdline | grep DNSSERVER | sed -e 's/.*DNSSERVER=//g' | awk '{print $1;}') -ldapserver=$(cat /proc/cmdline | grep ldapServer | sed -e 's/.*ldapServer=//g' | awk '{print "ldapServer="$1;}') -ldapport=$(cat /proc/cmdline | grep ldapPort | sed -e 's/.*ldapPort=//g' | awk '{print "ldapPort="$1;}') -vga=$(cat /proc/cmdline | grep vga | sed -e 's/.*vga=//g' | awk '{print "vga="$1;}') -quiet_cmdline=$(cat /proc/cmdline | grep " quiet") -quiet="" -if [ -n "$quiet_cmdline" ]; then - quiet="quiet" +# save flash server's ip as boot parameter +if [ -n "$thinclient_flash_server_ip" ]; then + flashserverCmdline="flashServer=$thinclient_flash_server_ip" + flashserver="$thinclient_flash_server_ip" fi @@ -291,7 +407,7 @@ PATH_BASE=/mnt PATH_MBR=/usr/lib/syslinux/mbr.bin - echo "default linux initrd=initrd.splash root=$rootpart DNSSERVER=$nameserver $vga $quiet splash=silent $ldapserver $ldapport" > $PATH_EXTLINUX + echo "default linux initrd=initrd.splash root=$rootpart $nameserverCmdline $vga $quiet splash=silent $flashserverCmdline $ldapserverCmdline $ldapport $loglevel" > $PATH_EXTLINUX # store current network configuration echo "FLASH_HOSTNAME=$hostname" > $PATH_NETWORKCONFIG Index: var/www/univention-thin-client-flash/flashupdate.py =================================================================== --- var/www/univention-thin-client-flash/flashupdate.py (.../ucs-tcs/univention-thin-client-flash) (Revision 30122) +++ var/www/univention-thin-client-flash/flashupdate.py (.../component/tcs31-experimental/univention-thin-client-flash) (Revision 30122) @@ -100,14 +100,55 @@ print '' #print 'eval "$(univention-config-registry shell)"' + # hostname and domain print 'hostname=\"%s\"' % clientObject[0][1].get('cn')[0] print 'domainname=\"%s\"' % ucr.get('domainname') - print 'thinclient_flash_server=\"%s.%s\"' % (ucr.get('hostname'), ucr.get('domainname')) + + # boot paramter -> use values from pxe/* vars + + # flash server from ucr var, default fqdn + flashServer = ucr.get('pxe/thinclient/flash/server', "") + if flashServer: + print 'thinclient_flash_server="%s"' % flashServer + else: + print 'thinclient_flash_server="%s.%s"' % (ucr.get('hostname'), ucr.get('domainname')) + + # ldap server + ldapServer = ucr.get('pxe/ldapserver', "") + if ldapServer: + print 'ldapserverCmdline="ldapServer=\\"%s\\""' % ldapServer + print 'ldapserver="%s"' % ldapServer + + # ldap port + ldapPort = ucr.get('pxe/ldapport', "") + if ldapPort: + print 'ldapport="ldapPort=%s"' % ldapPort + + # vga + vga = ucr.get('pxe/vga', "") + if vga: + print 'vga="vga=%s"' % vga + + # quiet + if ucr.get('pxe/quiet', "no").lower() in ['yes', 'true', '1']: + print 'quiet="quiet"' + + # loglevel + loglevel = ucr.get('pxe/loglevel', "") + if loglevel: + print 'loglevel="loglevel=%s"' % loglevel + + # nameserver + print 'nameserverCmdline="DNSSERVER=%s"' % ucr.get('pxe/nameserver') + print 'nameserver="%s"' % ucr.get('pxe/nameserver') + + # ucr policies for k in results.keys(): # 7468696e636c69656e742f666c6173682f ==> thinclient/flash/ if k.startswith('univentionRegistry;entry-hex-7468696e636c69656e742f666c6173682f'): print '%s=\'%s\'' % (k.split('univentionRegistry;entry-hex-')[-1].decode('hex').replace('/','_'), results[k][0]) + # add flash script lines = open('/etc/univention/flash/thin-client-flash-update').readlines() for line in lines: print line,