xref: /titanic_51/usr/src/cmd/sgs/packages/common/checkinstall (revision bbaa8b60dd95d714741fc474adad3cf710ef4efd)
1#
2# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
3# Use is subject to license terms.
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 (the "License").
9# You may not use this file except in compliance with the License.
10#
11# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
12# or http://www.opensolaris.org/os/licensing.
13# See the License for the specific language governing permissions
14# and limitations under the License.
15#
16# When distributing Covered Code, include this CDDL HEADER in each
17# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
18# If applicable, add the following below this CDDL HEADER, with the
19# fields enclosed by brackets "[]" replaced with your own identifying
20# information: Portions Copyright [yyyy] [name of copyright owner]
21#
22# CDDL HEADER END
23#
24
25# Installing the wrong architecture of runtime linker will immediately
26# brick the system. Catch this case and refuse to do it.
27if [ "$PKG_INSTALL_ROOT" = '' -o "$PKG_INSTALL_ROOT" = '/' ]; then
28    SYSARCH=`uname -p`
29    if [ "$SYSARCH" != "$ARCH" ]; then
30	echo "***"
31	echo "*** Cannot install $ARCH linker into root of $SYSARCH system."
32	echo "***"
33	exit 1
34    fi
35fi
36
37if [ -d $BASEDIR/$SGSBACKUPDIR ];
38then
39    echo "***"
40    echo "*** Previous version of SUNWonld already installed. Use"
41    echo "***     # pkgrm SUNWonld"
42    echo "*** to remove it before installing a newer version, or"
43    echo "*** use an admin file to force an overwrite."
44    echo "***"
45    exit 1
46fi
47
48# As of Nevada build snv_104, we require the mmapobj() system call.
49# Installing on a system that lacks it will break rtld and brick the system.
50elfdump -sN.dynsym /lib/libc.so.1 | grep mmapobj > /dev/null
51if [ $? != 0 ];
52then
53    echo "***"
54    echo "*** System lacks required mmapobj() system call"
55    echo "*** Nevada snv_104 or newer is required."
56    echo "***"
57    exit 1
58fi
59
60exit 0
61