i.immodules revision 7038
10139N/A#!/bin/sh
10139N/A#
10139N/A# Class Action Script for installing input method modules for libgtk
12147N/A#
10139N/A# CDDL HEADER START
10139N/A#
10139N/A# The contents of this file are subject to the terms of the
17185N/A# Common Development and Distribution License, Version 1.0 only
10139N/A# (the "License"). You may not use this file except in compliance
17177N/A# with the License.
17177N/A#
17177N/A# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10139N/A# or http://www.opensolaris.org/os/licensing.
10139N/A# See the License for the specific language governing permissions
10139N/A# and limitations under the License.
18138N/A#
10139N/A# When distributing Covered Code, include this CDDL HEADER in each
10139N/A# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
10139N/A# If applicable, add the following below this CDDL HEADER, with the
10139N/A# fields enclosed by brackets "[]" replaced with your own identifying
18138N/A# information: Portions Copyright [yyyy] [name of copyright owner]
10139N/A#
16360N/A# CDDL HEADER END
16428N/A#
16428N/A#
16428N/A# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
16428N/A# Use is subject to license terms.
16428N/A#
10491N/A
12088N/AF_A=/tmp/im.add.$$
10139N/AF_M=/tmp/im.merged.$$
12088N/Apkg_start="# Start $PKGINST"
10139N/Apkg_end="# End $PKGINST"
12088N/A
12176N/Awhile read src dest; do
12196N/A if [ ! -f ${dest} ]; then
12306N/A echo "$pkg_start" > ${dest}
12368N/A sed -e "s/@ARCH@/${ARCH}/g" ${src} >> ${dest}
13088N/A echo "$pkg_end" >> ${dest}
13278N/A else
16768N/A if [ "sparc" = "`uname -p`" ]; then
14363N/A ARCH=sparcv9
16768N/A else
16642N/A ARCH=amd64
10139N/A fi
10139N/A sed -e "s/@ARCH@/${ARCH}/g" ${src} > ${F_A}
10139N/A # Check if any of the lines from ${src} are already in the file
10139N/A do_merge=yes
10139N/A exec < ${F_A}
10139N/A while read line; do
10139N/A # input method spec lines start with quotes
10139N/A [ "x$line" != 'x"' ] && continue
10139N/A if /usr/bin/egrep -s -- "$line" ${dest}; then
10139N/A do_merge=no
10139N/A echo "$0: line $line already in ${dest}"
10139N/A echo "$0: not changing ${dest}"
10139N/A break
10139N/A fi
10139N/A done
10139N/A exec <&1
10139N/A if [ $do_merge = yes ]; then
10139N/A if egrep -s 'GTK\+ Input Method Modules file' ${F_A}; then
10139N/A # The original Gtk+ config file should come first
10139N/A # Any additions should be at the end
10139N/A echo "$pkg_start" >> ${F_M}
10139N/A cat ${F_A} > ${F_M}
10139N/A echo "$pkg_end" >> ${F_M}
10139N/A cat ${dest} >> ${F_M}
10139N/A else
10139N/A cat ${dest} >> ${F_M}
10139N/A echo "$pkg_start" >> ${F_M}
10139N/A cat ${F_A} > ${F_M}
10139N/A echo "$pkg_end" >> ${F_M}
10139N/A fi
10139N/A cp ${F_M} ${dest}
10139N/A rm -f ${F_M}
10139N/A fi
10139N/A rm -f ${F_A}
10139N/A fi
10139N/Adone
10139N/A
12819N/Aexit 0
12288N/A