r.immodules revision 7411
cb8c861baa9316dc6ecc8a29e18178b224d7445afuankg#!/bin/sh
cb8c861baa9316dc6ecc8a29e18178b224d7445afuankg#
cb8c861baa9316dc6ecc8a29e18178b224d7445afuankg# Class Action Script for installing input method modules for libgtk
cb8c861baa9316dc6ecc8a29e18178b224d7445afuankg#
cb8c861baa9316dc6ecc8a29e18178b224d7445afuankg# CDDL HEADER START
cb8c861baa9316dc6ecc8a29e18178b224d7445afuankg#
cb8c861baa9316dc6ecc8a29e18178b224d7445afuankg# The contents of this file are subject to the terms of the
cb8c861baa9316dc6ecc8a29e18178b224d7445afuankg# Common Development and Distribution License, Version 1.0 only
cb8c861baa9316dc6ecc8a29e18178b224d7445afuankg# (the "License"). You may not use this file except in compliance
cb8c861baa9316dc6ecc8a29e18178b224d7445afuankg# with the License.
cb8c861baa9316dc6ecc8a29e18178b224d7445afuankg#
cb8c861baa9316dc6ecc8a29e18178b224d7445afuankg# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
0662ed52e814f8f08ef0e09956413a792584eddffuankg# or http://www.opensolaris.org/os/licensing.
cb8c861baa9316dc6ecc8a29e18178b224d7445afuankg# See the License for the specific language governing permissions
cb8c861baa9316dc6ecc8a29e18178b224d7445afuankg# and limitations under the License.
cb8c861baa9316dc6ecc8a29e18178b224d7445afuankg#
cb8c861baa9316dc6ecc8a29e18178b224d7445afuankg# When distributing Covered Code, include this CDDL HEADER in each
cb8c861baa9316dc6ecc8a29e18178b224d7445afuankg# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
cb8c861baa9316dc6ecc8a29e18178b224d7445afuankg# If applicable, add the following below this CDDL HEADER, with the
cb8c861baa9316dc6ecc8a29e18178b224d7445afuankg# fields enclosed by brackets "[]" replaced with your own identifying
cb8c861baa9316dc6ecc8a29e18178b224d7445afuankg# information: Portions Copyright [yyyy] [name of copyright owner]
cb8c861baa9316dc6ecc8a29e18178b224d7445afuankg#
cb8c861baa9316dc6ecc8a29e18178b224d7445afuankg# CDDL HEADER END
cb8c861baa9316dc6ecc8a29e18178b224d7445afuankg#
cb8c861baa9316dc6ecc8a29e18178b224d7445afuankg#
cb8c861baa9316dc6ecc8a29e18178b224d7445afuankg# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
cb8c861baa9316dc6ecc8a29e18178b224d7445afuankg# Use is subject to license terms.
cb8c861baa9316dc6ecc8a29e18178b224d7445afuankg#
44f575c8cb19a7a5cd61664a7848be6bc197df02fuankg
16b55a35cff91315d261d1baa776138af465c4e4fuankgtmpfile=/tmp/immodules.$$
cb8c861baa9316dc6ecc8a29e18178b224d7445afuankgpkg_start="# Start $PKGINST"
cb8c861baa9316dc6ecc8a29e18178b224d7445afuankgpkg_end="# End $PKGINST"
cb8c861baa9316dc6ecc8a29e18178b224d7445afuankg
cb8c861baa9316dc6ecc8a29e18178b224d7445afuankgwhile read dest
cb8c861baa9316dc6ecc8a29e18178b224d7445afuankgdo
cb8c861baa9316dc6ecc8a29e18178b224d7445afuankg [ -f ${dest} ] || continue;
cb8c861baa9316dc6ecc8a29e18178b224d7445afuankg
cb8c861baa9316dc6ecc8a29e18178b224d7445afuankg # Strip all entries belonging to this package
cb8c861baa9316dc6ecc8a29e18178b224d7445afuankg start=0
cb8c861baa9316dc6ecc8a29e18178b224d7445afuankg end=0
cb8c861baa9316dc6ecc8a29e18178b224d7445afuankg egrep -s "$pkg_start" $dest && start=1
cb8c861baa9316dc6ecc8a29e18178b224d7445afuankg egrep -s "$pkg_end" $dest && end=1
cb8c861baa9316dc6ecc8a29e18178b224d7445afuankg
cb8c861baa9316dc6ecc8a29e18178b224d7445afuankg if [ $start -ne $end ]; then
cb8c861baa9316dc6ecc8a29e18178b224d7445afuankg echo "$0: missing Start or End delimiters for $PKGINST in $dest."
cb8c861baa9316dc6ecc8a29e18178b224d7445afuankg echo "$0: $dest may be corrupted and was not updated."
cb8c861baa9316dc6ecc8a29e18178b224d7445afuankg continue
cb8c861baa9316dc6ecc8a29e18178b224d7445afuankg fi
cb8c861baa9316dc6ecc8a29e18178b224d7445afuankg
cb8c861baa9316dc6ecc8a29e18178b224d7445afuankg if [ $start -eq 1 ]; then
cb8c861baa9316dc6ecc8a29e18178b224d7445afuankg sed -e "/$pkg_start/,/$pkg_end/d" $dest > $tmpfile || exit 1
cb8c861baa9316dc6ecc8a29e18178b224d7445afuankg cp $tmpfile $dest || exit 1
cb8c861baa9316dc6ecc8a29e18178b224d7445afuankg rm -f $tmpfile
cb8c861baa9316dc6ecc8a29e18178b224d7445afuankg test ! -s $dest && rm -f $dest
cb8c861baa9316dc6ecc8a29e18178b224d7445afuankg else
cb8c861baa9316dc6ecc8a29e18178b224d7445afuankg echo "$0: WARNING - no entries found in $dest for $PKGINST."
cb8c861baa9316dc6ecc8a29e18178b224d7445afuankg exit 0
cb8c861baa9316dc6ecc8a29e18178b224d7445afuankg fi
cb8c861baa9316dc6ecc8a29e18178b224d7445afuankgdone
cb8c861baa9316dc6ecc8a29e18178b224d7445afuankg
cb8c861baa9316dc6ecc8a29e18178b224d7445afuankgexit 0
cb8c861baa9316dc6ecc8a29e18178b224d7445afuankg