#!/bin/sh # $Copyright: Copyright (c) 2022 Veritas Technologies LLC. All rights reserved $ # $Id$ HWCLASS=RS6000 PKG_NAME="VRTSnbcfg" # Set umask to 022 to make sure files and directories # are not created with world writable permissions. umask 022 #----- $Id$ ----- # # This function is a case statement sets # the ECHO variable # with the appropriate path & flags. #Define Echo to allow escape characters case "`uname -s`" in Linux*) unset POSIXLY_CORRECT ECHO="/bin/echo -e" ;; SunOS*) ECHO="/usr/bin/echo" ;; *) ECHO="echo" ;; esac #----- $Id$ # # The rpm package manager on Linux has a limitation where if a postinstall # scriptlet fails, rpm still indicates the package is successfully installed. # To get around this there is a touch file to record postinstall scriptlet # failures. If the previous_rpm_pkg_install_failed touch file exists and # contains this package's name, remove the touch file since we are now removing # the package that had the postinstall failure and created the touch file. # # These are expected to be set already: # PKG_NAME # remove_previous_rpm_pkg_install_failed_file () { if [ -f /tmp/previous_rpm_pkg_install_failed ] ; then failed_pkg_name=`sed -n '1p' /tmp/previous_rpm_pkg_install_failed` if [ "${failed_pkg_name}" = "${PKG_NAME}" ] ; then rm -f /tmp/previous_rpm_pkg_install_failed fi fi } # vi: set ft=sh: # # Creates trace log file name. # # It expects just 1 parameter, the package name. # Generates the tracefile name that includes the parent process id # # print_error is expected to be included already. if [ -z "${PPID}" ] ; then # On some platforms (esp. Solaris), the PPID variable doesn't get # through to the scriptlet. The script driver will write its pid to a # temporary file so we can consume it here. If there is no driver # (e.g., when user runs pkgadd directly), then we give up on getting # PPID and just use the current pid instead. ppid=`cat /tmp/pid.installer 2>/dev/null || ${ECHO} $$` else ppid=${PPID} fi create_tracefile_name () { if [ $# -ne 1 ] ; then print_error "Call to create_tracefile_name did not contain package name." exit 2 fi # Append parent process id to log file name so both the pre and post install # scripts will use the same file. trace_file="/tmp/install_${1}_trace.${ppid}" return 0 } #################### MAIN #################### create_tracefile_name "${PKG_NAME}" #start subshell for scriptlet { { { { ( ${ECHO} "Running NB Client Config pre remove scriplet" case "${HWCLASS}" in HP-UX-IA64 | RS6000 | Solaris) # restore old setting file if [ -f /usr/openv/java/auth.conf ] ; then cp /usr/openv/java/auth.conf /usr/openv/java/auth.conf.save fi if [ -f /usr/openv/java/nbj.conf ] ; then cp /usr/openv/java/nbj.conf /usr/openv/java/nbj.conf.save fi if [ -f /usr/openv/netbackup/bp.conf ] ; then cp /usr/openv/netbackup/bp.conf /usr/openv/netbackup/bp.conf.save fi ;; esac remove_previous_rpm_pkg_install_failed_file # We need to capture the output from the subshell as well as the proper exit status ) 2>&1; echo $? >&3; } | tee -i -a ${trace_file} >&4; } 3>&1; } | ( read xs; exit $xs; ) } 4>&1 # end subshell for scriptlet subshell_status=$? if [ -f ${trace_file} -a -d /usr/openv/tmp/ ] ; then cp ${trace_file} /usr/openv/tmp/ fi exit ${subshell_status}