3 #============LICENSE_START==================================================
5 #===========================================================================
6 # Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
7 #===========================================================================
8 # Licensed under the Apache License, Version 2.0 (the "License");
9 # you may not use this file except in compliance with the License.
10 # You may obtain a copy of the License at
12 # http://www.apache.org/licenses/LICENSE-2.0
14 # Unless required by applicable law or agreed to in writing, software
15 # distributed under the License is distributed on an "AS IS" BASIS,
16 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 # See the License for the specific language governing permissions and
18 # limitations under the License.
19 #============LICENSE_END==================================================
23 #########################################################################
27 #########################################################################
30 echo -n "syntax: $(basename $0) "
32 echo -n "[--install base|pap|pdp|console|mysql|elk|brmsgw|paplp|pdplp] | "
33 echo -n "[--configure base|pap|pdp|console|mysql|elk|brmsgw|paplp|pdplp] | "
36 function check_java() {
37 if [[ $DEBUG == y ]]; then
38 echo "-- ${FUNCNAME[0]} $@ --"
42 TARGET_JAVA_VERSION=$1
44 if [[ -z ${JAVA_HOME} ]]; then
45 echo "error: ${JAVA_HOME} is not set"
49 if ! check_x_file "${JAVA_HOME}/bin/java"; then
50 echo "error: ${JAVA_HOME}/bin/java is not accessible"
54 INSTALLED_JAVA_VERSION=$("${JAVA_HOME}/bin/java" -version 2>&1 | awk -F '"' '/version/ {print $2}')
55 if [[ -z $INSTALLED_JAVA_VERSION ]]; then
56 echo "error: ${JAVA_HOME}/bin/java is invalid"
60 if [[ "${INSTALLED_JAVA_VERSION}" != ${TARGET_JAVA_VERSION}* ]]; then
61 echo "error: java version (${INSTALLED_JAVA_VERSION}) does not"\
62 "march desired version ${TARGET_JAVA_VERSION}"
66 echo "OK: java ${INSTALLED_JAVA_VERSION} installed"
70 function process_configuration() {
71 if [[ $DEBUG == y ]]; then
72 echo "-- ${FUNCNAME[0]} $@ --"
77 while read line || [ -n "${line}" ]; do
78 if [[ -n ${line} ]] && [[ ${line} != \#* ]]; then
79 name=$(echo "${line%%=*}")
80 value=$(echo "${line#*=}")
81 # escape ampersand so that sed does not replace it with the search string
83 if [[ -z ${name} ]] || [[ -z $value ]]; then
84 echo "WARNING: ${line} missing name or value"
86 export ${name}="${value}"
87 eval "${name}" "${value}" 2> /dev/null
93 function component_preconfigure() {
94 if [[ $DEBUG == y ]]; then
95 echo "-- ${FUNCNAME[0]} $@ --"
99 /bin/sed -i -e 's!${{POLICY_HOME}}!'"${POLICY_HOME}!g" \
100 -e 's!${{FQDN}}!'"${FQDN}!g" \
101 *.conf > /dev/null 2>&1
104 function tomcat_component() {
105 if [[ $DEBUG == y ]]; then
106 echo "-- ${FUNCNAME[0]} $@ --"
110 TOMCAT_TARGET_INSTALL_DIR=${POLICY_HOME}/servers/${COMPONENT_TYPE}
111 if [[ -d ${TOMCAT_TARGET_INSTALL_DIR} ]]; then
112 echo "error: ${TOMCAT_TARGET_INSTALL_DIR} exists."
116 TOMCAT_INSTALL_DIR=${POLICY_HOME}/install/3rdparty/${TOMCAT_PACKAGE_NAME}/
117 if [[ -d ${TOMCAT_INSTALL_DIR} ]]; then
118 echo "error: ${TOMCAT_INSTALL_DIR} exists."
122 tar -C "${POLICY_HOME}/servers" -xf "${POLICY_HOME}/install/3rdparty/${TOMCAT_PACKAGE_NAME}.tar.gz"
124 mv "${POLICY_HOME}/servers/${TOMCAT_PACKAGE_NAME}" "${POLICY_HOME}/servers/${COMPONENT_TYPE}/"
125 /bin/cp "${POLICY_HOME}"/install/servers/common/tomcat/bin/* "${POLICY_HOME}/servers/${COMPONENT_TYPE}/bin"
126 /bin/cp "${POLICY_HOME}"/install/servers/common/tomcat/conf/* "${POLICY_HOME}/servers/${COMPONENT_TYPE}/conf"
128 /bin/cp "${POLICY_HOME}/install/servers/common/tomcat/init.d/tomcatd" "${POLICY_HOME}/etc/init.d/${COMPONENT_TYPE}"
129 /bin/sed -i -e "s!\${{COMPONENT_TYPE}}!${COMPONENT_TYPE}!g" "${POLICY_HOME}/etc/init.d/${COMPONENT_TYPE}" >/dev/null 2>&1
132 /bin/cp -fr "${POLICY_HOME}"/install/servers/${COMPONENT_TYPE}/webapps/* "${POLICY_HOME}/servers/${COMPONENT_TYPE}/webapps"
133 /bin/cp -fr "${POLICY_HOME}"/install/servers/${COMPONENT_TYPE}/bin/* "${POLICY_HOME}/servers/${COMPONENT_TYPE}/bin" >/dev/null 2>&1
134 /bin/cp -fr "${POLICY_HOME}"/install/servers/${COMPONENT_TYPE}/conf/* "${POLICY_HOME}/servers/${COMPONENT_TYPE}/conf" >/dev/null 2>&1
136 /bin/rm -fr "${POLICY_HOME}/servers/${COMPONENT_TYPE}/webapps/docs" \
137 "${POLICY_HOME}/servers/${COMPONENT_TYPE}/webapps/examples" \
138 "${POLICY_HOME}/servers/${COMPONENT_TYPE}/webapps/ROOT" \
139 "${POLICY_HOME}/servers/${COMPONENT_TYPE}/webapps/manager" \
140 "${POLICY_HOME}/servers/${COMPONENT_TYPE}/webapps/host-manager"
142 if [[ ${COMPONENT_TYPE} == console ]]; then
143 install_onap_portal_settings
149 function configure_tomcat_component() {
150 configure_component "${COMPONENT_TYPE}.conf" "${POLICY_HOME}/servers/${COMPONENT_TYPE}/"
153 function configure_component() {
154 if [[ $DEBUG == y ]]; then
155 echo "-- ${FUNCNAME[0]} $@ --"
159 if ! process_configuration "${COMPONENT_TYPE}.conf"; then
160 echo "error: aborting ${COMPONENT_TYPE} installation: cannot process configuration ${COMPONENT_TYPE}.conf"
165 COMPONENT_ROOT_DIR=$2
168 SED_LINE+=" -e 's!\${{POLICY_HOME}}!${POLICY_HOME}!g' "
169 SED_LINE+=" -e 's!\${{POLICY_USER}}!${POLICY_USER}!g' "
170 SED_LINE+=" -e 's!\${{POLICY_GROUP}}!${POLICY_GROUP}!g' "
171 SED_LINE+=" -e 's!\${{KEYSTORE_PASSWD}}!${KEYSTORE_PASSWD}!g' "
172 SED_LINE+=" -e 's!\${{JAVA_HOME}}!${JAVA_HOME}!g' "
173 SED_LINE+=" -e 's!\${{COMPONENT_TYPE}}!${COMPONENT_TYPE}!g' "
174 SED_LINE+=" -e 's!\${{POLICY_LOGS}}!${POLICY_LOGS}!g' "
176 while read line || [ -n "${line}" ]; do
177 if [[ -n $line ]] && [[ $line != \#* ]]; then
178 name=$(echo "${line%%=*}")
179 value=$(echo "${line#*=}")
180 # escape ampersand so that sed does not replace it with the search string
181 value=${value//&/\\&}
182 if [[ -z ${name} ]] || [[ -z ${value} ]]; then
183 echo "WARNING: ${line} missing name or value"
185 SED_LINE+=" -e 's!\${{${name}}}!${value}!g' "
191 for sed_file in $(find "${COMPONENT_ROOT_DIR}" -name '*.xml' -o -name '*.sh' -o -name '*.properties' -o -name '*.conf' -o -name '*.cfg' -o -name '*.template' -o -name '*.conf' -o -name '*.cron' -o -name '*.json' | grep -v /backup/); do
192 if fgrep -l '${{' ${sed_file} > /dev/null 2>&1; then
193 SED_FILES+="${sed_file} "
197 if [[ -f $HOME/.m2/settings.xml ]]; then
198 SED_FILES+="$HOME/.m2/settings.xml "
202 if [[ -z ${SED_FILES} ]]; then
203 echo "WARNING: no xml, sh, properties, or conf files to perform configuration expansion"
205 SED_LINE+=${SED_FILES}
209 list_unexpanded_files ${POLICY_HOME}
212 function install_onap_portal_settings() {
213 echo "Install onap portal settings"
215 # unpack onap war file
216 mkdir -p "${POLICY_HOME}"/servers/console/webapps/onap
217 cd "${POLICY_HOME}"/servers/console/webapps/onap
221 # copy over the configured settings
222 /bin/cp -fr "${POLICY_HOME}"/install/servers/onap/* "${POLICY_HOME}/servers/console/webapps/onap"
225 function check_r_file() {
226 if [[ $DEBUG == y ]]; then
227 echo "-- ${FUNCNAME[0]} $@ --"
232 if [[ ! -f ${FILE} || ! -r ${FILE} ]]; then
239 function check_x_file() {
240 if [[ $DEBUG == y ]]; then
241 echo "-- ${FUNCNAME[0]} $@ --"
246 if [[ ! -f ${FILE} || ! -x ${FILE} ]]; then
253 function install_prereqs() {
254 if [[ $DEBUG == y ]]; then
255 echo "-- ${FUNCNAME[0]} $@ --"
261 if ! check_r_file "${CONF_FILE}"; then
262 echo "error: aborting ${COMPONENT_TYPE} installation: ${CONF_FILE} is not accessible"
266 if ! process_configuration "${CONF_FILE}"; then
267 echo "error: aborting ${COMPONENT_TYPE} installation: cannot process configuration ${CONF_FILE}"
271 # if ! check_java "1.8"; then
272 # echo "error: aborting ${COMPONENT_TYPE} installation: invalid java version"
276 if [[ -z ${POLICY_HOME} ]]; then
277 echo "error: aborting ${COMPONENT_TYPE} installation: ${POLICY_HOME} is not set"
281 HOME_OWNER=$(ls -ld "${POLICY_HOME}" | awk '{print $3}')
282 if [[ ${HOME_OWNER} != ${POLICY_USER} ]]; then
283 echo "error: aborting ${COMPONENT_TYPE} installation: ${POLICY_USER} does not own ${POLICY_HOME} directory"
287 echo -n "Starting ${OPERATION} of ${COMPONENT_TYPE} under ${POLICY_USER}:${POLICY_GROUP} "
288 echo "ownership with umask $(umask)."
291 function list_unexpanded_files() {
293 SEARCH_LIST=$(find ${ROOT_DIR} -type f -name '*.properties' -o -name '*.sh' -o -name '*.conf' -o -name '*.yml' -o -name '*.template' -o -name '*.xml' -o -name '*.cfg' -o -name '*.json' -o -path "${ROOT_DIR}/etc/init.d/*" | egrep -v '/m2/|/install/|/logs/')
294 NOT_EXPANDED_BASE_FILES=$(grep -l '${{' ${SEARCH_LIST} 2> /dev/null)
295 if [[ -n ${NOT_EXPANDED_BASE_FILES} ]]; then
296 echo "error: component installation has completed but some base files have not been expanded:"
297 echo "${NOT_EXPANDED_BASE_FILES}"
303 function install_base() {
304 if [[ $DEBUG == y ]]; then
305 echo "-- ${FUNCNAME[0]} $@ --"
309 install_prereqs "${BASE_CONF}"
311 if [[ -z ${POLICY_HOME} ]]; then
312 echo "error: ${POLICY_HOME} is not set"
316 POLICY_HOME_CONTENTS=$(ls -A "${POLICY_HOME}" 2> /dev/null)
317 if [[ -n ${POLICY_HOME_CONTENTS} ]]; then
318 echo "error: aborting base installation: ${POLICY_HOME} directory is not empty"
322 if [[ ! -d ${POLICY_HOME} ]]; then
323 echo "error: aborting base installation: ${POLICY_HOME} is not a directory."
327 if ! /bin/mkdir -p "${POLICY_HOME}/servers/" > /dev/null 2>&1; then
328 echo "error: aborting base installation: cannot create ${POLICY_HOME}/servers/"
332 if ! /bin/mkdir -p "${POLICY_HOME}/logs/" > /dev/null 2>&1; then
333 echo "error: aborting base installation: cannot create ${POLICY_HOME}/logs/"
337 BASE_TGZ=$(ls base-*.tar.gz)
338 if [ ! -r ${BASE_TGZ} ]; then
339 echo "error: aborting base installation: ${POLICY_USER} cannot access tar file: ${BASE_TGZ}"
343 tar -tzf ${BASE_TGZ} > /dev/null 2>&1
344 if [[ $? != 0 ]]; then
345 echo >&2 "error: aborting base installation: invalid base package tar file: ${BASE_TGZ}"
349 BASH_PROFILE_LINE=". ${POLICY_HOME}/etc/profile.d/env.sh"
350 PROFILE_LINE="ps -p \$\$ | grep -q bash || . ${POLICY_HOME}/etc/profile.d/env.sh"
352 tar -C ${POLICY_HOME} -xf ${BASE_TGZ} --no-same-owner
353 if [[ $? != 0 ]]; then
354 # this should not happened
355 echo "error: aborting base installation: base package cannot be unpacked: ${BASE_TGZ}"
359 /bin/mkdir -p ${POLICY_HOME}/etc/ssl > /dev/null 2>&1
360 /bin/mkdir -p ${POLICY_HOME}/etc/init.d > /dev/null 2>&1
361 /bin/mkdir -p ${POLICY_HOME}/tmp > /dev/null 2>&1
362 /bin/mkdir -p ${POLICY_HOME}/var > /dev/null 2>&1
364 #list_unexpanded_files ${POLICY_HOME}
368 function configure_base() {
369 if [[ $DEBUG == y ]]; then
370 echo "-- ${FUNCNAME[0]} $@ --"
374 # check if fqdn is set in base.conf and use that value if set
375 if [[ -z ${INSTALL_FQDN} ]]
377 echo "FQDN not set in config...using the default FQDN ${FQDN}"
379 echo "Using FQDN ${INSTALL_FQDN} from config"
383 configure_component "${BASE_CONF}" "${POLICY_HOME}"
385 BASH_PROFILE_LINE=". ${POLICY_HOME}/etc/profile.d/env.sh"
386 PROFILE_LINE="ps -p \$\$ | grep -q bash || . ${POLICY_HOME}/etc/profile.d/env.sh"
388 if ! fgrep -x "${BASH_PROFILE_LINE}" "${HOME}/.bash_profile" >/dev/null 2>&1; then
389 echo "${BASH_PROFILE_LINE}" >> "${HOME}/.bash_profile"
392 if ! fgrep -x "${PROFILE_LINE}" "${HOME}/.profile" >/dev/null 2>&1; then
393 echo "${PROFILE_LINE}" >> "${HOME}/.profile"
397 function install_tomcat_component() {
398 if [[ $DEBUG == y ]]; then
399 echo "-- ${FUNCNAME[0]} $@ --"
403 install_prereqs "${BASE_CONF}"
405 if ! process_configuration "${COMPONENT_TYPE}.conf"; then
406 echo "error: aborting ${COMPONENT_TYPE} installation: cannot process configuration ${COMPONENT_TYPE}.conf"
410 if ! tomcat_component; then
411 echo "error: aborting ${COMPONENT_TYPE} installation: tomcat installation failed."
417 # This function installs mysql related shell scripts and sql files in the proper locations
418 # under $POLICY_HOME. It also adds the MySQL client bin to the PATH based on configuration.
420 function install_mysql() {
421 if [[ $DEBUG == y ]]; then
422 echo "-- ${FUNCNAME[0]} $@ --"
426 install_prereqs "${BASE_CONF}"
428 if ! process_configuration "${COMPONENT_TYPE}.conf"; then
429 echo "error: aborting ${COMPONENT_TYPE} installation: cannot process configuration ${COMPONENT_TYPE}.conf"
433 MYSQL_DATA_PATH=${POLICY_HOME}/data/mysql
434 /bin/mkdir -p ${MYSQL_DATA_PATH} > /dev/null 2>&1
436 /bin/cp -f "${POLICY_HOME}"/install/mysql/data/* "${MYSQL_DATA_PATH}"
437 /bin/chmod 555 "${MYSQL_DATA_PATH}"/*
439 MYSQL_BIN_SOURCE=${POLICY_HOME}/install/mysql/bin
440 /bin/mkdir -p ${POLICY_HOME}/bin > /dev/null 2>&1
441 for script in $(/bin/ls "${MYSQL_BIN_SOURCE}"); do
442 /bin/cp ${MYSQL_BIN_SOURCE}/${script} ${POLICY_HOME}/bin
443 /bin/chmod 555 "${POLICY_HOME}/bin/${script}"
447 function configure_mysql() {
448 if [[ $DEBUG == y ]]; then
449 echo "-- ${FUNCNAME[0]} $@ --"
456 # This function installs elk related shell scripts and sql files in the proper locations
457 # under $POLICY_HOME. It also adds the Elk to the PATH based on configuration.
459 function configure_elk() {
460 if [[ $DEBUG == y ]]; then
461 echo "-- ${FUNCNAME[0]} $@ --"
468 function install_elk() {
469 if [[ $DEBUG == y ]]; then
470 echo "-- ${FUNCNAME[0]} $@ --"
474 if [[ -f "${HOME}/.bash_profile" ]]; then
475 source "${HOME}/.bash_profile"
478 if [[ -f "${HOME}/.profile" ]]; then
479 source "${HOME}/.profile"
482 ELK_TARGET_INSTALL_DIR="${POLICY_HOME}"/elk
484 if [[ -d ${ELK_TARGET_INSTALL_DIR} ]]; then
485 echo "WARNING: ${ELK_TARGET_INSTALL_DIR} exists."
489 /bin/mkdir -p "${ELK_TARGET_INSTALL_DIR}" > /dev/null 2>&1
491 if [[ ! -d ${ELK_TARGET_INSTALL_DIR} ]]; then
492 echo "WARNING: ${ELK_TARGET_INSTALL_DIR} doesn't exist."
496 cd ${ELK_TARGET_INSTALL_DIR}
497 curl -L -O https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.4.0.tar.gz
499 tar xvzf elasticsearch-5.4.0.tar.gz -C .
500 /bin/rm -fr elasticsearch-5.4.0.tar.gz
501 /bin/mv ${ELK_TARGET_INSTALL_DIR}/elasticsearch-5.4.0/* .
502 /bin/rm -fr ${ELK_TARGET_INSTALL_DIR}/elasticsearch-5.4.0
504 /bin/cp "${POLICY_HOME}"/install/elk/bin/* "${POLICY_HOME}/bin"
505 /bin/cp -f "${POLICY_HOME}"/install/elk/config/* "${ELK_TARGET_INSTALL_DIR}/config"
506 /bin/cp -f "${POLICY_HOME}/install/elk/init.d/elkd" "${POLICY_HOME}/etc/init.d/elk"
508 install_prereqs "${COMPONENT_TYPE}.conf"
510 /bin/sed -i -e "s!\${{POLICY_HOME}}!${POLICY_HOME}!g" \
511 -e "s!\${{FQDN}}!${FQDN}!g" \
512 -e "s!\${{ELK_JMX_PORT}}!${ELK_JMX_PORT}!g" \
513 "${ELK_TARGET_INSTALL_DIR}"/config/* "${POLICY_HOME}/etc/init.d/elk" > /dev/null 2>&1
516 list_unexpanded_files ${POLICY_HOME}
521 # This function installs brmsgw related shell scripts and config files in the proper
522 # locations under $POLICY_HOME.
525 function install_brmsgw() {
526 if [[ $DEBUG == y ]]; then
527 echo "-- ${FUNCNAME[0]} $@ --"
531 install_prereqs "${BASE_CONF}"
533 if ! process_configuration "${COMPONENT_TYPE}.conf"; then
534 echo "error: aborting ${COMPONENT_TYPE} installation: cannot process configuration ${COMPONENT_TYPE}.conf"
538 if [ -z "$M2_HOME" ]; then
539 echo "error: aborting ${COMPONENT_TYPE} installation: M2_HOME must be set in brmsgw.conf"
543 echo "export M2_HOME=$M2_HOME" >>$POLICY_HOME/etc/profile.d/env.sh
545 /bin/cp -f "${POLICY_HOME}/install/servers/brmsgw/init.d/brmsgw" "${POLICY_HOME}/etc/init.d/brmsgw"
547 if ! /bin/mkdir -p "${POLICY_HOME}/servers/${COMPONENT_TYPE}" > /dev/null 2>&1; then
548 echo "error: aborting base installation: cannot create ${POLICY_HOME}/servers/${COMPONENT_TYPE}"
552 /bin/cp -fr "${POLICY_HOME}"/install/servers/${COMPONENT_TYPE}/BRMSGateway.jar "${POLICY_HOME}/servers/${COMPONENT_TYPE}"
553 /bin/cp -fr "${POLICY_HOME}"/install/servers/${COMPONENT_TYPE}/*.properties "${POLICY_HOME}/servers/${COMPONENT_TYPE}"
554 /bin/cp -fr "${POLICY_HOME}"/install/servers/${COMPONENT_TYPE}/config "${POLICY_HOME}/servers/${COMPONENT_TYPE}"
555 /bin/cp -fr "${POLICY_HOME}"/install/servers/${COMPONENT_TYPE}/dependency.json "${POLICY_HOME}/servers/${COMPONENT_TYPE}"
557 /bin/mv $POLICY_HOME/m2 $HOME/.m2
563 function install_logparser() {
564 if [[ $DEBUG == y ]]; then
565 echo "-- ${FUNCNAME[0]} $@ --"
569 install_prereqs "${BASE_CONF}"
571 if ! process_configuration "${COMPONENT_TYPE}.conf"; then
572 echo "error: aborting ${COMPONENT_TYPE} installation: cannot process configuration ${COMPONENT_TYPE}.conf"
576 LP_TARGET_DIR=${POLICY_HOME}/servers/${COMPONENT_TYPE}
577 /bin/mkdir -p ${LP_TARGET_DIR}/bin > /dev/null 2>&1
578 /bin/mkdir -p ${LP_TARGET_DIR}/logs > /dev/null 2>&1
580 # copy binaries, initialization script and configuration
581 /bin/cp "${POLICY_HOME}"/install/servers/common/logparser/bin/*jar "${LP_TARGET_DIR}/bin"
582 /bin/cp "${POLICY_HOME}/install/servers/common/logparser/init.d/logparserd" "${POLICY_HOME}/etc/init.d/${COMPONENT_TYPE}"
583 /bin/cp "${POLICY_HOME}/install/servers/${COMPONENT_TYPE}/bin/parserlog.properties" "${LP_TARGET_DIR}/bin"
584 /bin/cp -fr "${POLICY_HOME}"/install/servers/${COMPONENT_TYPE}/bin/config "${POLICY_HOME}/servers/${COMPONENT_TYPE}/bin"
588 #########################################################################
590 ## script execution body
592 #########################################################################
601 TOMCAT_PACKAGE_NAME=apache-tomcat-8.0.50
605 export POLICY_USER=$(/usr/bin/id -un)
607 # command line options parsing
608 until [[ -z "$1" ]]; do
613 -i|--install) OPERATION=install
617 -c|--configure) OPERATION=configure
628 # component-type validation
629 case $COMPONENT_TYPE in
640 *) echo "invalid component type (${COMPONENT_TYPE}): must be in {base|pdp|pap|console|mysql|elk|brmsgw|paplp|pdplp}";
646 # operation validation
648 install|configure) ;;
649 *) echo "invalid operation (${OPERATION}): must be in {install|configure}";
655 if [[ -n ${POLICY_GROUP} ]]; then
657 if ! echo ${groups} | grep -qP "\b${POLICY_GROUP}"; then
658 echo "error: ${POLICY_GROUP} is not a valid group for account ${POLICY_USER}"
663 if [[ -z ${POLICY_GROUP} ]]; then
664 numGroups=$(groups | sed "s/^.*: *//g" | wc -w)
665 if [ ${numGroups} -eq 1 ]; then
666 export POLICY_GROUP=$(groups ${POLICY_USER} | sed "s/^.*: *//g")
668 echo "error: ${POLICY_USER} belongs to multiple groups, one group \
669 must be provided for the installation"
675 if [[ -z ${POLICY_GROUP} ]]; then
676 echo "error: installation of root section must not provide the \
677 installation group owner argument."
682 if [[ -z ${POLICY_LOGS} ]]; then
683 echo "POLICY_LOGS environment variable NOT set, default to /var/log/onap"
684 export POLICY_LOGS="/var/log/onap"
687 FQDN=$(hostname -f 2> /dev/null)
688 if [[ $? != 0 || -z ${FQDN} ]]; then
689 echo "error: cannot determine the FQDN for this host $(hostname)."
693 if [[ ${OPERATION} == install ]]; then
694 case $COMPONENT_TYPE in
699 install_tomcat_component
702 install_tomcat_component
705 install_tomcat_component
720 echo "invalid component type (${COMPONENT_TYPE}): must be in {base|pdp|pap|console|mysql|elk|brmsgw|paplp|pdplp}";
726 if [[ ${OPERATION} == configure ]]; then
728 install_prereqs "${BASE_CONF}"
730 case $COMPONENT_TYPE in
733 component_preconfigure
736 configure_component "${COMPONENT_TYPE}.conf" "${POLICY_HOME}/servers/${COMPONENT_TYPE}/"
739 configure_component "${COMPONENT_TYPE}.conf" "${POLICY_HOME}/servers/${COMPONENT_TYPE}/"
742 configure_component "${COMPONENT_TYPE}.conf" "${POLICY_HOME}/servers/${COMPONENT_TYPE}/"
751 configure_component "${COMPONENT_TYPE}.conf" "${POLICY_HOME}/servers/${COMPONENT_TYPE}/"
754 configure_component "${COMPONENT_TYPE}.conf" "${POLICY_HOME}/servers/${COMPONENT_TYPE}/"
757 echo "invalid component type (${COMPONENT_TYPE}): must be in {base|pdp|pap|console|mysql|elk|brmsgw|paplp|pdplp}";
765 echo -n "Successful ${OPERATION} of ${COMPONENT_TYPE} under ${POLICY_USER}:${POLICY_GROUP} "
766 echo "ownership with umask $(umask)."