#!/sbin/sh # # Copyright 2005 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)postinstall 1.3 06/02/17 SMI" # thiszone=`zonename` JAVA_RTS_PROFILE="${SUNW_PRODNAME} User" # Execute with the the least set of privileges, when supported by the OS. if [ "$thiszone" = "global" ] then JAVA_RTS_PRIV="privs=sys_res_config,proc_priocntl,proc_lock_memory,proc_clock_highres" PSRADM=/usr/bin/psradm PSRADM_PRIV=sys_res_config else JAVA_RTS_PRIV="privs=proc_priocntl,proc_lock_memory,proc_clock_highres" fi # Execute as root otherwise. JAVA_RTS_NOPRIV="euid=0;uid=0" JAVA_RTS_PROFILE_HELP=${PKG_INSTALL_ROOT}/usr/lib/help/profiles/locale/C/RtJavaRTSUser.html PROF_ATTR=${PKG_INSTALL_ROOT}/etc/security/prof_attr EXEC_ATTR=${PKG_INSTALL_ROOT}/etc/security/exec_attr SYSTEM=${PKG_INSTALL_ROOT}/etc/system # Create the rights profile, if requested. if [ "${MKPROFILE}" = "yes" ] then echo "Creating the '${JAVA_RTS_PROFILE}' rights profile." if [ ! -w ${PROF_ATTR} ] then echo "Can't access ${PROF_ATTR}." exit 1 fi if [ ! -w ${EXEC_ATTR} ] then echo "Can't access ${EXEC_ATTR}." exit 1 fi help_dir=`/usr/bin/dirname ${JAVA_RTS_PROFILE_HELP}` if [ ! -d ${help_dir} ] then echo "Can't access ${help_dir} directory." exit 1 fi # Create the profile's help file for the Solaris Management Console. if [ "$thiszone" = "global" ] then /usr/bin/rm -f ${JAVA_RTS_PROFILE_HELP} /usr/bin/cat > ${JAVA_RTS_PROFILE_HELP} << HELP_EOF
If ${JAVA_RTS_PROFILE} is grayed, then you are not entitled to Add or Remove this right.
HELP_EOF
if [ $? -ne 0 ]
then
echo "Unable to create ${JAVA_RTS_PROFILE_HELP}; giving up."
exit 1
fi
fi # global zone
# Update the profile description database.
prof_line="${JAVA_RTS_PROFILE}:::User of the ${DESC}:help=RtJavaRTSUser.html"
# This could be done using smprofile(1M), but a package install script
# shouldn't rely on an app that doesn't live in /usr/bin.
/usr/bin/ed - ${PROF_ATTR} >/dev/null 2>&1 << ED_EOF
g/^.*${JAVA_RTS_PROFILE}/d
\$
a
${prof_line}
.
w
q
ED_EOF
if [ $? -ne 0 ]
then
echo "Unable to update ${PROF_ATTR}; giving up."
exit 1
fi
# Update the execution profiles database.
# Remove existing entries, if any, before appending new ones.
/usr/bin/ed - ${EXEC_ATTR} >/dev/null 2>&1 << ED_EOF
g/^${JAVA_RTS_PROFILE}/d
w
q
ED_EOF
if [ $? -ne 0 ]
then
echo "Unable to update ${EXEC_ATTR}; giving up."
exit 1
fi
# The next line triggers the following (false positive) warning from 'pkgmk':
# 'WARNING: script