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