Univention Bugzilla – Attachment 4055 Details for
Bug 22152
Flash Statusdatenbank
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
univention-thin-client-flash.patch
univention-thin-client-flash.patch (text/plain), 27.04 KB, created by
Stefan Gohmann
on 2012-01-03 07:50 CET
(
hide
)
Description:
univention-thin-client-flash.patch
Filename:
MIME Type:
Creator:
Stefan Gohmann
Created:
2012-01-03 07:50 CET
Size:
27.04 KB
patch
obsolete
>Index: univention-thin-client-flash/univention-thin-client-flash-status >=================================================================== >--- univention-thin-client-flash/univention-thin-client-flash-status (.../ucs-tcs/univention-thin-client-flash) (Revision 0) >+++ univention-thin-client-flash/univention-thin-client-flash-status (.../component/tcs31-experimental/univention-thin-client-flash) (Revision 30119) >@@ -0,0 +1,150 @@ >+#!/usr/bin/python2.4 >+# >+# Univention Thin Client Flash status >+# >+# Copyright (C) 2011 Univention GmbH >+# >+# http://www.univention.de/ >+# >+# All rights reserved. >+# >+# This program is free software; you can redistribute it and/or modify >+# it under the terms of the GNU General Public License version 2 as >+# published by the Free Software Foundation. >+# >+# Binary versions of this file provided by Univention to you as >+# well as other copyrighted, protected or trademarked materials like >+# Logos, graphics, fonts, specific documentations and configurations, >+# cryptographic keys etc. are subject to a license agreement between >+# you and Univention. >+# >+# This program is distributed in the hope that it will be useful, >+# but WITHOUT ANY WARRANTY; without even the implied warranty of >+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+# GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License >+# along with this program; if not, write to the Free Software >+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA >+ >+LOG_DIR = '/var/log/univention-thin-client-flash-status/' >+DATE_FORMAT = '%Y-%m-%d %H:%M' >+FORMAT = 'hostname,mac,ip,image,version,status,time' >+ >+import sys >+import univention.config_registry >+import csv >+import time >+import optparse >+import gzip >+import glob >+ >+# usage >+usage = "usage: %prog [options]\n\n" >+usage += "This program reads the thin-client status logs from\n" >+usage += "%s*\n" % LOG_DIR >+usage += "and prints the newest status line for each thin-client \n" >+usage += "to stdout or into a tab separated csv file." >+ >+# options >+parser = optparse.OptionParser(usage=usage) >+parser.add_option("-o", "--output-file", dest="outFile", help="write status to csv file") >+parser.add_option("-f", "--format", dest="format", help="output format, ,-separated list of elements time, hostname, mac, ip, domainname, nameserver, ldapserver, image, version, newversion, url, partition, rootpart, bootpart, status (default: %s)" % FORMAT) >+parser.add_option("-d", "--date-format", dest="dateFormat", help="date format in output (default: %s)" % DATE_FORMAT) >+parser.add_option("-i", "--input-directory", dest="directory", help="directory to look for *.log and *.gz log files (default: %s)" % LOG_DIR) >+parser.add_option("-n", "--host-history", dest="hostname", help="show all log messages for HOSTNAME") >+parser.set_defaults(format = FORMAT, dateFormat = DATE_FORMAT, directory = LOG_DIR) >+options, args = parser.parse_args() >+ >+# output format >+format = options.format.split(",") >+ >+# get files in log dir >+files = glob.glob(options.directory + "/*.gz") + glob.glob(options.directory + "/*.log") >+ >+# open log and read data into data dict >+data = {} >+lineCounter = 0 >+for file in files: >+ >+ # open the log or gzip file >+ try: >+ if file.endswith(".gz"): >+ fh = gzip.open(file, "rb") >+ else: >+ fh = open(file, "rb") >+ except IOError, e: >+ print e >+ sys.exit(1) >+ >+ # read csv file line per line >+ reader = csv.reader(fh, delimiter='\t', quotechar='|', quoting=csv.QUOTE_MINIMAL) >+ for row in reader: >+ >+ # get key=value elements >+ tmp = {} >+ for element in row: >+ keyValue = element.split("=", 1) >+ if len(keyValue) >= 2: >+ tmp[keyValue[0]] = keyValue[1] >+ >+ tmp["logfile"] = file >+ hostname = tmp.get("hostname", "") >+ >+ if options.hostname: >+ if options.hostname == hostname: >+ hostname = hostname + str(lineCounter) >+ else: >+ continue >+ >+ # convert time >+ if tmp.get("time", ""): >+ tmp["time"] = time.strftime(options.dateFormat, time.localtime(float(tmp["time"]))) >+ >+ # ignore entries without hostname and store data in data dict >+ if hostname: >+ data[hostname] = tmp >+ >+ lineCounter += 1 >+ fh.close() >+ >+if options.hostname: >+ # sort entries by time (if time is not present ==> order is untouched) >+ clients = data.items() >+ clients.sort(lambda x,y: cmp(x[1].get('time'), y[1].get('time'))) >+ clients = [ x[0] for x in clients ] >+else: >+ # sort entries by hostname >+ clients = sorted(data.keys()) >+ >+# print output to csv file >+if options.outFile: >+ try: >+ header = {} >+ for e in format: >+ header[e] = 1 >+ out = csv.DictWriter(open(options.outFile, 'wb'), >+ delimiter="\t", quotechar='|', >+ quoting=csv.QUOTE_MINIMAL, fieldnames=format) >+ except IOError, e: >+ print e >+ sys.exit(1) >+ >+ # write header >+ header = {} >+ for i in format: >+ header[i] = i >+ out.writerow(header) >+ >+ # write data >+ for client in clients: >+ row = {} >+ for element in format: >+ row[element] = data[client].get(element, "None") >+ out.writerow(row) >+# print output to stdout >+else: >+ for client in clients: >+ print "Hostname: " + data[client].get("hostname", "None") >+ for element in format: >+ print "\t" + element + ": " + data[client].get(element, "None") > >Eigenschaftsänderungen: univention-thin-client-flash/univention-thin-client-flash-status >___________________________________________________________________ >Hinzugefügt: svn:executable > + * > >Index: univention-thin-client-flash/debian/logrotate >=================================================================== >--- univention-thin-client-flash/debian/logrotate (.../ucs-tcs/univention-thin-client-flash) (Revision 0) >+++ univention-thin-client-flash/debian/logrotate (.../component/tcs31-experimental/univention-thin-client-flash) (Revision 30119) >@@ -0,0 +1,7 @@ >+/var/log/univention-thin-client-flash-status/*.log { >+ weekly >+ rotate 12 >+ create 640 www-data adm >+ compress >+ missingok >+} >Index: univention-thin-client-flash/debian/dirs >=================================================================== >--- univention-thin-client-flash/debian/dirs (.../ucs-tcs/univention-thin-client-flash) (Revision 24636) >+++ univention-thin-client-flash/debian/dirs (.../component/tcs31-experimental/univention-thin-client-flash) (Arbeitskopie) >@@ -5,3 +5,5 @@ > usr/share/univention-thin-client-flash/ > var/www/univention-thin-client-flash/ > usr/lib/univention-install/ >+var/log/univention-thin-client-flash-status >+etc/logrotate.d >Index: univention-thin-client-flash/debian/postinst >=================================================================== >--- univention-thin-client-flash/debian/postinst (.../ucs-tcs/univention-thin-client-flash) (Revision 24636) >+++ univention-thin-client-flash/debian/postinst (.../component/tcs31-experimental/univention-thin-client-flash) (Arbeitskopie) >@@ -40,6 +40,9 @@ > > univention-config-registry set thinclient/flashupdate/via/flash?yes > >+touch /var/log/univention-thin-client-flash-status/thin-client-flash-status.log >+chown www-data:adm /var/log/univention-thin-client-flash-status/thin-client-flash-status.log >+ > /etc/univention/templates/scripts/thin-client-bootsplash.py || true > > if [ "$server_role" = "domaincontroller_master" ]; then >Index: univention-thin-client-flash/debian/changelog >=================================================================== >--- univention-thin-client-flash/debian/changelog (.../ucs-tcs/univention-thin-client-flash) (Revision 24636) >+++ univention-thin-client-flash/debian/changelog (.../component/tcs31-experimental/univention-thin-client-flash) (Arbeitskopie) >@@ -1,3 +1,103 @@ >+univention-thin-client-flash (6.1.14-1) unstable; urgency=low >+ >+ * respect pxe/loglevel in tc's extlinux.conf Ticket: #2011030910000975 >+ >+ -- Felix Botner <botner@univention.de> Thu, 18 Aug 2011 09:42:09 +0200 >+ >+univention-thin-client-flash (6.1.13-1) unstable; urgency=low >+ >+ * fixed flashupdate script in initrd Ticket: #2011030710000906 >+ >+ -- Felix Botner <botner@univention.de> Wed, 17 Aug 2011 09:10:51 +0200 >+ >+univention-thin-client-flash (6.1.12-1) unstable; urgency=low >+ >+ * stop usplash on flashupdate Ticket: #2011041210005499 >+ >+ -- Felix Botner <botner@univention.de> Tue, 16 Aug 2011 11:32:04 +0200 >+ >+univention-thin-client-flash (6.1.11-1) unstable; urgency=low >+ >+ * merged changes from customer scope Ticket: #2011041210005499 >+ >+ -- Felix Botner <botner@univention.de> Mon, 15 Aug 2011 16:09:40 +0200 >+ >+univention-thin-client-flash (6.1.10-1) unstable; urgency=low >+ >+ * fixed flashupdate Ticket #2011030710000906 >+ >+ -- Felix Botner <botner@univention.de> Thu, 14 Apr 2011 09:06:50 +0200 >+ >+univention-thin-client-flash (6.1.9-1) unstable; urgency=low >+ >+ * fixed flashupdate.py Ticket #2011030710000906 >+ >+ -- Felix Botner <botner@univention.de> Wed, 13 Apr 2011 13:55:43 +0200 >+ >+univention-thin-client-flash (6.1.8-1) unstable; urgency=low >+ >+ * fixed flashupdate.py and thin-client-flash-update Ticket >+ #2011030710000906 >+ >+ -- Felix Botner <botner@univention.de> Mon, 11 Apr 2011 14:49:32 +0200 >+ >+univention-thin-client-flash (6.1.7-1) unstable; urgency=low >+ >+ * support multiple ldap server for thin clients >+ Ticket #2011030710000906 >+ >+ -- Felix Botner <botner@univention.de> Tue, 05 Apr 2011 15:12:09 +0200 >+ >+univention-thin-client-flash (6.1.6-2) unstable; urgency=low >+ >+ * fixed last commit Ticket #2011030710000899 >+ >+ -- Felix Botner <botner@univention.de> Tue, 29 Mar 2011 10:55:08 +0200 >+ >+univention-thin-client-flash (6.1.5-1) unstable; urgency=low >+ >+ * sort output in univention-thin-client-flash-status by time >+ Ticket #2011030710000899 >+ >+ -- Felix Botner <botner@univention.de> Tue, 29 Mar 2011 10:01:02 +0200 >+ >+univention-thin-client-flash (6.1.4-1) unstable; urgency=low >+ >+ * added throtteling to flashstatus.py Ticket #2011030710000899 >+ >+ -- Felix Botner <botner@univention.de> Fri, 25 Mar 2011 09:36:26 +0100 >+ >+univention-thin-client-flash (6.1.3-1) unstable; urgency=low >+ >+ * minor fix in thin-client-flash-update >+ * process all log files (*.gz and *.log) in >+ log directory in univention-thin-client-flash-status >+ Ticket #2011030710000899 >+ >+ -- Felix Botner <botner@univention.de> Wed, 23 Mar 2011 10:12:58 +0100 >+ >+univention-thin-client-flash (6.1.2-1) unstable; urgency=low >+ >+ * minor fixes in thin-client-flash-update >+ * removed redundant missingok from logrotate config >+ * fixed element mapping in univention-thin-client-flash-status >+ and flashstatus.py Ticket #2011030710000899 >+ >+ -- Felix Botner <botner@univention.de> Tue, 22 Mar 2011 15:24:16 +0100 >+ >+univention-thin-client-flash (6.1.1-1) unstable; urgency=low >+ >+ * added -n|--host-history to univention-thin-client-flash-status >+ Ticket #2011030710000899 >+ >+ -- Felix Botner <botner@univention.de> Wed, 16 Mar 2011 15:31:08 +0100 >+ >+univention-thin-client-flash (6.1.0-1) unstable; urgency=low >+ >+ * added thin client flash status log Ticket #2011030710000899 >+ >+ -- Felix Botner <botner@univention.de> Wed, 16 Mar 2011 14:16:41 +0100 >+ > univention-thin-client-flash (6.0.13-1) unstable; urgency=low > > * Don't overwrite linked libraries while creating the thin client >Index: univention-thin-client-flash/debian/rules >=================================================================== >--- univention-thin-client-flash/debian/rules (.../ucs-tcs/univention-thin-client-flash) (Revision 24636) >+++ univention-thin-client-flash/debian/rules (.../component/tcs31-experimental/univention-thin-client-flash) (Arbeitskopie) >@@ -58,6 +58,10 @@ > install -m 755 usr/share/univention-thin-client-flash/dhclient-script debian/univention-thin-client-flash/usr/share/univention-thin-client-flash/ > install -m 755 var/www/univention-thin-client-flash/flashupdate.py debian/univention-thin-client-flash/var/www/univention-thin-client-flash/ > >+ install -m 755 var/www/univention-thin-client-flash/flashstatus.py debian/univention-thin-client-flash/var/www/univention-thin-client-flash/ >+ install -m 755 univention-thin-client-flash-status debian/univention-thin-client-flash/usr/bin/ >+ chown root:adm debian/univention-thin-client-flash/var/log/univention-thin-client-flash-status >+ cp debian/logrotate debian/univention-thin-client-flash/etc/logrotate.d/univention-thin-client-flash-status > > univention-install-config-registry > univention-thin-client-download-debs -d `pwd`/debian/univention-thin-client-flash/var/lib/univention-client-root/thin-client-archive/flash -p syslinux mtools dosfstools >Index: univention-thin-client-flash/conffiles/usr/share/univention-thin-client-flash/flashupdate >=================================================================== >--- univention-thin-client-flash/conffiles/usr/share/univention-thin-client-flash/flashupdate (.../ucs-tcs/univention-thin-client-flash) (Revision 24636) >+++ univention-thin-client-flash/conffiles/usr/share/univention-thin-client-flash/flashupdate (.../component/tcs31-experimental/univention-thin-client-flash) (Arbeitskopie) >@@ -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: univention-thin-client-flash/conffiles/etc/univention/flash/thin-client-flash-update >=================================================================== >--- univention-thin-client-flash/conffiles/etc/univention/flash/thin-client-flash-update (.../ucs-tcs/univention-thin-client-flash) (Revision 24636) >+++ univention-thin-client-flash/conffiles/etc/univention/flash/thin-client-flash-update (.../component/tcs31-experimental/univention-thin-client-flash) (Arbeitskopie) >@@ -1,3 +1,4 @@ >+#!/bin/sh > @%@BCWARNING=# @%@ > # > # Univention Thin Client Flash >@@ -27,6 +28,112 @@ > # along with this program; if not, write to the Free Software > # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA > >+encode_url () >+{ >+ echo "$1" | sed \ >+ -e 's/%/%25/g' \ >+ -e 's/ /%20/g' \ >+ -e 's/!/%21/g' \ >+ -e 's/"/%22/g' \ >+ -e 's/#/%23/g' \ >+ -e 's/\$/%24/g' \ >+ -e 's/\&/%26/g' \ >+ -e 's/'\''/%27/g' \ >+ -e 's/(/%28/g' \ >+ -e 's/)/%29/g' \ >+ -e 's/\*/%2a/g' \ >+ -e 's/+/%2b/g' \ >+ -e 's/,/%2c/g' \ >+ -e 's/-/%2d/g' \ >+ -e 's/\./%2e/g' \ >+ -e 's/\//%2f/g' \ >+ -e 's/:/%3a/g' \ >+ -e 's/;/%3b/g' \ >+ -e 's//%3e/g' \ >+ -e 's/?/%3f/g' \ >+ -e 's/@/%40/g' \ >+ -e 's/\[/%5b/g' \ >+ -e 's/\\/%5c/g' \ >+ -e 's/\]/%5d/g' \ >+ -e 's/\^/%5e/g' \ >+ -e 's/_/%5f/g' \ >+ -e 's/`/%60/g' \ >+ -e 's/{/%7b/g' \ >+ -e 's/|/%7c/g' \ >+ -e 's/}/%7d/g' \ >+ -e 's/~/%7e/g' >+} >+ >+append_to_url () >+{ >+ local url="$1" >+ local item="$2" >+ local value="$3" >+ local delim="$4" >+ >+ if [ -z "$delim" ]; then >+ delim="&" >+ fi >+ >+ if [ -z "$value" ]; then >+ value=None >+ fi >+ >+ if [ -n "$item" ]; then >+ value=$(encode_url "$value") >+ url="$url$delim$item=$value" >+ fi >+ >+ echo "$url" >+} >+ >+ALREADY_LOGGED=0 >+flash_status () >+{ >+ # to log or not to log ... >+ case "$thinclient_flash_status_log" in >+ 0|no|off|false|disable|disabled) return 0;; >+ esac >+ >+ # check if we already logged the status >+ if [ $ALREADY_LOGGED -ne 0 ]; then >+ return >+ fi >+ >+ # $1 is the status of the thin client (up-to-dat, updated, installation failed, ...) >+ local status=$1 >+ if [ -z "$status" ]; then >+ status=unknown >+ fi >+ >+ # collect data >+ local mac=$(LC_ALL=C ifconfig eth0 | sed -n 's|.*HWaddr \([^ ]*\) .*|\1|p') >+ local ip=$(LC_ALL=C ifconfig eth0|sed -n 's| *inet addr:\([^ ]*\) .*|\1|p') >+ local uri="$url/flashstatus.py" >+ >+ # setup url >+ uri=$(append_to_url "$uri" "mac" "$mac" "?") >+ uri=$(append_to_url "$uri" "ip" "$ip") >+ uri=$(append_to_url "$uri" "hostname" "$hostname") >+ uri=$(append_to_url "$uri" "domainname" "$domainname") >+ uri=$(append_to_url "$uri" "nameserver" "$nameserver") >+ uri=$(append_to_url "$uri" "ldapserver" "$ldapserver") >+ uri=$(append_to_url "$uri" "image" "$image") >+ uri=$(append_to_url "$uri" "version" "$version") >+ uri=$(append_to_url "$uri" "newversion" "$new_version") >+ uri=$(append_to_url "$uri" "url" "$url") >+ uri=$(append_to_url "$uri" "partition" "$partition") >+ uri=$(append_to_url "$uri" "rootpart" "$rootpart") >+ uri=$(append_to_url "$uri" "bootpart" "$bootpart") >+ uri=$(append_to_url "$uri" "status" "$status") >+ >+ # do it >+ wget -q -O - "$uri" >+ >+ ALREADY_LOGGED=1 >+} >+ >+ > flash_abort () > { > echo >@@ -37,6 +144,9 @@ > > flash_reboot () > { >+ # log status >+ flash_status "$1" >+ > #See https://forge.univention.org/bugzilla/show_bug.cgi?id=18792 for details > > #soft-reset: >@@ -61,7 +171,7 @@ > print ' echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"' > @!@ > sleep ${thinclient_flash_update_panic_timeout}s >- flash_reboot >+ flash_reboot "installation failed" > } > > flash_panic_upgrade () >@@ -81,7 +191,7 @@ > print ' echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"' > @!@ > sleep ${thinclient_flash_update_panic_timeout}s >- flash_reboot >+ flash_reboot "upgrade failed" > } > > print_done () >@@ -98,6 +208,7 @@ > print_header () > { > clear >+ usplash_write QUIT > echo "verbose" > /proc/splash > clear > echo >@@ -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") >@@ -151,6 +270,7 @@ > echo -n "Retrieve version information: " >>/dev/tty9 > new_version=$(wget -qqq -O - "$url/$image.vers") > if [ -z "$new_version" ]; then >+ flash_status "image version not found" > echo "Not found" >>/dev/tty9 > exit 0 > else >@@ -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 >@@ -353,9 +469,10 @@ > > echo > sync >- flash_reboot >+ flash_reboot "updated" > log_action_end_msg 0 > else >+ flash_status "up-to-date" > @!@ > if baseConfig.get('locale/default', 'us').startswith('de_'): > print ' echo "Das System ist aktuell."' >Index: univention-thin-client-flash/var/www/univention-thin-client-flash/flashstatus.py >=================================================================== >--- univention-thin-client-flash/var/www/univention-thin-client-flash/flashstatus.py (.../ucs-tcs/univention-thin-client-flash) (Revision 0) >+++ univention-thin-client-flash/var/www/univention-thin-client-flash/flashstatus.py (.../component/tcs31-experimental/univention-thin-client-flash) (Revision 30119) >@@ -0,0 +1,115 @@ >+#!/usr/bin/python2.4 >+# >+# Univention Thin Client Flash status logging >+# >+# Copyright (C) 2011 Univention GmbH >+# >+# http://www.univention.de/ >+# >+# All rights reserved. >+# >+# This program is free software; you can redistribute it and/or modify >+# it under the terms of the GNU General Public License version 2 as >+# published by the Free Software Foundation. >+# >+# Binary versions of this file provided by Univention to you as >+# well as other copyrighted, protected or trademarked materials like >+# Logos, graphics, fonts, specific documentations and configurations, >+# cryptographic keys etc. are subject to a license agreement between >+# you and Univention. >+# >+# This program is distributed in the hope that it will be useful, >+# but WITHOUT ANY WARRANTY; without even the implied warranty of >+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+# GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License >+# along with this program; if not, write to the Free Software >+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA >+ >+LOG_FILENAME = '/var/log/univention-thin-client-flash-status/thin-client-flash-status.log' >+ACCESS_DB = '/var/tmp/thin-client-flash-status.pickle' >+ACCESS_DB_LOCK = '/var/tmp/thin-client-flash-status.pickle.lock' >+LAST_SEEN_DIFF = 2 >+ >+import sys >+import cgi >+import univention.config_registry >+import csv >+import time >+import pickle >+import os >+import time >+import fcntl >+ >+def updateAccessDb (access): >+ # save access db >+ output = open(ACCESS_DB, 'wb') >+ pickle.dump(access, output) >+ output.close() >+ >+print 'Content-type: text/plain' >+print >+ >+myTime = time.time() >+myIp = os.environ.get("REMOTE_ADDR", "") >+ >+# do nothing if no remote address can be found >+if not myIp: >+ sys.exit(0) >+ >+# get lock >+lockFile = open(ACCESS_DB_LOCK, 'wb') >+fcntl.flock(lockFile.fileno(), fcntl.LOCK_EX) >+ >+# read access db into access dict >+access = {} >+try: >+ input = open(ACCESS_DB, 'rb') >+ access = pickle.load(input) >+ input.close() >+except Exception, e: >+ pass >+ >+# check clients last access time >+lastSeen = access.get(myIp, 0) >+ >+# ignore clients which accessed us in the last LAST_SEEN_DIFF seconds >+# save timestamp for others >+if lastSeen: >+ if (myTime - lastSeen) <= LAST_SEEN_DIFF: >+ sys.exit(0) >+access[myIp] = myTime >+ >+# clean up access db >+for client in access.keys(): >+ if (myTime - access[client]) > LAST_SEEN_DIFF: >+ del access[client] >+ >+# get data >+form = cgi.FieldStorage() >+data = [] >+size = 0 >+for key in form.keys(): >+ tmp = key + "=" +form.getvalue(key) >+ size += len(tmp) >+ data.append(tmp) >+ >+ >+# simple test to restrict the size of post >+if size > 4096: >+ updateAccessDb(access) >+ sys.exit(0) >+ >+data.append("time=" + str(time.time())) >+ >+# write to log >+log = csv.writer(open(LOG_FILENAME, 'ab'), delimiter="\t", quotechar='|', quoting=csv.QUOTE_MINIMAL) >+log.writerow(data) >+ >+# update access db >+updateAccessDb(access) >+ >+# release lock >+lockFile.close() >+ > >Eigenschaftsänderungen: univention-thin-client-flash/var/www/univention-thin-client-flash/flashstatus.py >___________________________________________________________________ >Hinzugefügt: svn:executable > + * > >Index: univention-thin-client-flash/var/www/univention-thin-client-flash/flashupdate.py >=================================================================== >--- univention-thin-client-flash/var/www/univention-thin-client-flash/flashupdate.py (.../ucs-tcs/univention-thin-client-flash) (Revision 24636) >+++ univention-thin-client-flash/var/www/univention-thin-client-flash/flashupdate.py (.../component/tcs31-experimental/univention-thin-client-flash) (Arbeitskopie) >@@ -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, > >Eigenschaftsänderungen: univention-thin-client-flash >___________________________________________________________________ >Gelöscht: svn:mergeinfo >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Actions:
View
|
Diff
Attachments on
bug 22152
: 4055