1 #!/bin/sh 2 # 3 # Class Action Script for installing input method modules for libgtk 4 # 5 # CDDL HEADER START 6 # 7 # The contents of this file are subject to the terms of the 8 # Common Development and Distribution License, Version 1.0 only 9 # (the "License"). You may not use this file except in compliance 10 # with the License. 11 # 12 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 13 # or http://www.opensolaris.org/os/licensing. 14 # See the License for the specific language governing permissions 15 # and limitations under the License. 16 # 17 # When distributing Covered Code, include this CDDL HEADER in each 18 # file and include the License file at usr/src/OPENSOLARIS.LICENSE. 19 # If applicable, add the following below this CDDL HEADER, with the 20 # fields enclosed by brackets "[]" replaced with your own identifying 21 # information: Portions Copyright [yyyy] [name of copyright owner] 22 # 23 # CDDL HEADER END 24 # 25 # 26 # Copyright 2006 Sun Microsystems, Inc. All rights reserved. 27 # Use is subject to license terms. 28 # 29 30 tmpfile=/tmp/immodules.$$ 31 pkg_start="# Start $PKGINST" 32 pkg_end="# End $PKGINST" 33 34 while read dest 35 do 36 [ -f ${dest} ] || continue; 37 38 # Strip all entries belonging to this package 39 start=0 40 end=0 41 egrep -s "$pkg_start" $dest && start=1 42 egrep -s "$pkg_end" $dest && end=1 43 44 if [ $start -ne $end ]; then 45 echo "$0: missing Start or End delimiters for $PKGINST in $dest." 46 echo "$0: $dest may be corrupted and was not updated." 47 continue 48 fi 49 50 if [ $start -eq 1 ]; then 51 sed -e "/$pkg_start/,/$pkg_end/d" $dest > $tmpfile || exit 1 52 cp $tmpfile $dest || exit 1 53 rm -f $tmpfile 54 test ! -s $dest && rm -f $dest 55 else 56 echo "$0: WARNING - no entries found in $dest for $PKGINST." 57 exit 0 58 fi 59 done 60 61 exit 0 62