cqs   [plain text]


#!/ibin/sh
#
# The component query script for the Samba component
#
#       %Z% %M% %I% %E% %Q%
#
#       input:
#               $1 - keyword list (e.g. "UPGRADE OLD_CUSTOM_UPGRADE")
#               $2 - package list (e.g. "Samba:<component>:<package> )
#

# Save input arguments
#
keywords=$1
pkgList=$2

# Source in the standard functions library
#
. ccsSetup.sh

# Local Variables
#
installType=FRESH

# set custom install mode
customMode=LAYERED
[ "$IQM_FILE" ] && {
                # Invoking custom from the IQM.  IQM output will be stored
                # in $IQM_FILE.
                customMode="IQM"
}

# Local Functions

##############################################################################
#
# If called with an argument indicating failure, remove any possible saved 
# configuration info.  Exit with arg passed to this function.
#
cleanup()
{
        trap '' 1 2 3 15
        exit $1
}

################################################################################
#
# We are doing a SSO -> SSO upgrade.  
#
Save_SSO_Upgrade_Config()
{
    if [ -f /etc/smbusers ]; then
        ex_cmd cp -f /etc/smbusers $CCS_PERSISTENT_STORAGE/smbusers
    fi
    if [ -f /usr/lib/samba/lib/smb.conf ]; then
        ex_cmd cp -f /usr/lib/samba/lib/smb.conf $CCS_PERSISTENT_STORAGE/smb.conf
    fi

    return 0
}

#******************************************************************************
# check_libsocket
#
# Check to see if libsocket.so.2 is installed on this system.  If not, print
# a warning message and ask if the user wants to continue installation anyway.
#******************************************************************************

MSG_missLibrary="WARNING: Samba requires the library /usr/lib/libsocket.so.2
	to install and run correctly.  That library does not exist
	on this system.  It is provided in OpenServer releases
	5.0.6a and higher."

check_libsocket() {
	if [ -f "/usr/lib/libsocket.so.2" ]; then
		return $OK
	else
		echo "${MSG_missLibrary}"

	        while echo "\n\tContinue installation? \c"
        	do      read yn rest
                	case $yn in
                		+x|-x)  set $yn	;;
                		[yY]*)  return $OK ;;
                		[nN]*)  cleanup $FAIL ;;
                		*)      echo "\tPlease answer y or n" ;;
			esac
        	done
	fi
}


################################################################################
# main Main MAIN
#
trap "cleanup $FAIL" 1 2 3 15

[ "$customMode" = "LAYERED" ] && {
	check_libsocket
}

# Parse keyword list to determine how custom was invoked, the installation type,
# whether we running on the target CPU, and finally if we have access to 
# the target's root filesystem.
#
for k in $keywords
do
	case $k in
	"UPGRADE")
		# SSO -> SSO upgrade
		#
		installType="SSO_UPGRADE"
		;;

	"OLD_CUSTOM_UPGRADE")
		# OLD_CUSTOM -> SSO upgrade
		#
		installType="OLD_UPGRADE"
		;;
	esac
done

case "$installType" in 
"FRESH")
	# No previous version of component on the system.  Perform a 
	# fresh install.
	;;

"SSO_UPGRADE")
	# Existing SSO component upgraded to newer SSO version.
	#
	Save_SSO_Upgrade_Config
	;;
esac

cleanup $OK