#!/usr/bin/ksh93
#  ALTRAN_PROLOG_BEGIN_TAG                                                    
#  This is an automatically generated prolog.                                  
#                                                                              
#  Copyright (C) Altran ACT S.A.S. 2019,2021.  All rights reserved.  
#                                                                              
#  ALTRAN_PROLOG_END_TAG                                                      
#                                                                              
# IBM_PROLOG_BEGIN_TAG 
# This is an automatically generated prolog. 
#  
# 61haes_r714 src/43haes/usr/sbin/cluster/sa/printServer/sbin/cl_print_server_manual_config.sh 1.1 
#  
# Licensed Materials - Property of IBM 
#  
# COPYRIGHT International Business Machines Corp. 2010 
# All Rights Reserved 
#  
# US Government Users Restricted Rights - Use, duplication or 
# disclosure restricted by GSA ADP Schedule Contract with IBM Corp. 
#  
# IBM_PROLOG_END_TAG
# @(#)  7d4c34b 43haes/usr/sbin/cluster/sa/printServer/sbin/cl_print_server_manual_config.sh, 726, 2147A_aha726, Feb 05 2021 09:50 PM
###############################################################################
#
# Name:		cl_print_server_manual_config
#
# Description:	Print Subsystem smart assist manual configuration with input XML file
#		populated with required information to configure.
#
# Arguments:
#		-f <Input XML file>
#
# Return:	N/A
#
###############################################################################

function usage
{
        [[ "$VERBOSE_LOGGING" == "high" ]] && set -x
        KLIB_SA_logmsg WARN 9 3 print_server_sa.cat "Usage: \
cl_print_server_manual_config -f <input XML file>\n"
        exit 1
}

typeset CONFIG_FILE=""
KLIB_OUTPUT_CONSOLE=true
KLIB_HACMPLOG_ENTRY=printServersa.log
FPATH_BASE=/usr/es/lib/ksh93
FPATH=$FPATH_BASE/sa

NUM_ARGS=$#
(( $NUM_ARGS == 0 )) && usage
while getopts f: option
do
    case $option in
        f)	# Input xml file for manual configuration
                CONFIG_FILE=$OPTARG
                ;;
        *)
                usage
    esac
done

[[ -z "$CONFIG_FILE" ]] && usage

PRINT_SERVER_SA_SBIN_DIR="/usr/es/sbin/cluster/sa/printServer/sbin"

#
# Configuration of System V print subsystem
#
$PRINT_SERVER_SA_SBIN_DIR/cl_print_server_import -C "SystemV" -f $CONFIG_FILE
#All error logging taken care inside $PRINT_SERVER_SA_SBIN_DIR/cl_print_server_import
#utility, so no need to LOG. Here if $PRINT_SERVER_SA_SBIN_DIR/cl_print_server_import
#fails exit with 1.
(( $? != 0 )) && exit 1

#
# Configuration of PowerPC print subsystem
#
$PRINT_SERVER_SA_SBIN_DIR/cl_print_server_import -C "PowerPC" -f $CONFIG_FILE
#All error logging taken care inside $PRINT_SERVER_SA_SBIN_DIR/cl_print_server_import
#utility, so no need to LOG. Here if $PRINT_SERVER_SA_SBIN_DIR/cl_print_server_import
#fails exit with 1.
(( $? != 0 )) && exit 1

exit 0
