Home | History | Annotate | Download | only in livemedia
      1 #!/usr/bin/bash
      2 #
      3 # CDDL HEADER START
      4 #
      5 # The contents of this file are subject to the terms of the
      6 # Common Development and Distribution License (the "License").
      7 # You may not use this file except in compliance with the License.
      8 #
      9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
     10 # or http://www.opensolaris.org/os/licensing.
     11 # See the License for the specific language governing permissions
     12 # and limitations under the License.
     13 #
     14 # When distributing Covered Code, include this CDDL HEADER in each
     15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
     16 # If applicable, add the following below this CDDL HEADER, with the
     17 # fields enclosed by brackets "[]" replaced with your own identifying
     18 # information: Portions Copyright [yyyy] [name of copyright owner]
     19 #
     20 # CDDL HEADER END
     21 #
     22 # Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
     23 # Use is subject to license terms.
     24 #
     25 # Script to process trace output data into a sorted list suitable for use
     26 # with build_live_dvd
     27 #
     28 source build_live_dvd.conf
     29 
     30 if [ -z "$1" ]
     31 then
     32 	echo "proc_tracedata <iosnoop output>"
     33 	exit 1
     34 fi
     35 
     36 cat $1 | egrep -v "xkblayout|unknown|librt|libm|iosnp|etc|PATHNAME|zlib|sched|dtrace|repository|var|libc|bsnp|sout|devices" | nawk ' BEGIN { path = ""; amt = 0 } {
     37 	if ($8 ~ /<none>/) {
     38 		cpath = $9
     39 	} else {
     40 		cpath = $8
     41 	}
     42 	if (match(cpath, "^/usr") > 0) {
     43 		cmd=sprintf("/usr/bin/test -d %s", cpath, cpath)
     44 		rv=system(cmd)
     45 		if (rv > 0) {
     46 			if (match(cpath, /\\0$/) > 0) {
     47 				cpath = sub(/\\0$/, "", cpath);
     48 			}
     49 			if (length(path) > 0) {
     50 				re = "^" path "$"
     51 				if (match(cpath, re) > 0) {
     52 					amt += $7
     53 				} else {
     54 					print amt, path
     55 					amt = $7
     56 					path = cpath
     57 				}
     58 			} else {
     59 				path = cpath
     60 				amt = $7
     61 			}
     62 		}
     63 	}
     64 }
     65 
     66 END {
     67 	if (length(path) > 0) {
     68 		print amt, path
     69 	}
     70 } ' | sed 's/ \// /' > /tmp/slist
     71 
     72 /usr/bin/perl $LIVEKIT/proc_slist.pl /tmp/slist > $LIVEKIT/iso.sort
     73