From 30cf6d7f7d77f1e83a84bfea8e991ca867c9a96c Mon Sep 17 00:00:00 2001 From: Jorge Hernandez Date: Wed, 6 Mar 2019 23:31:48 -0600 Subject: Tweaking scripts to install for pdpd-cl image Change-Id: I5f7ab5de402a5412938f42ae76e21f112b106b3a Issue-ID: POLICY-1560 Signed-off-by: Jorge Hernandez --- packages/base/src/files/etc/cron.d/monitor.cron | 6 +++--- packages/base/src/files/etc/profile.d/env.sh | 28 +++++++++++++++++++------ 2 files changed, 25 insertions(+), 9 deletions(-) (limited to 'packages') diff --git a/packages/base/src/files/etc/cron.d/monitor.cron b/packages/base/src/files/etc/cron.d/monitor.cron index 68cb310f..338c1d44 100755 --- a/packages/base/src/files/etc/cron.d/monitor.cron +++ b/packages/base/src/files/etc/cron.d/monitor.cron @@ -1,8 +1,8 @@ ### # ============LICENSE_START======================================================= -# Base Package +# ONAP # ================================================================================ -# Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. +# Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -18,4 +18,4 @@ # ============LICENSE_END========================================================= ### -* * * * * export POLICY_HOME=${{POLICY_HOME}}; ${{POLICY_HOME}}/bin/monitor >/dev/null 2>&1 +* * * * * bash -l -c '${POLICY_HOME}/bin/monitor >/dev/null 2>&1' diff --git a/packages/base/src/files/etc/profile.d/env.sh b/packages/base/src/files/etc/profile.d/env.sh index 833064fe..5a58940f 100644 --- a/packages/base/src/files/etc/profile.d/env.sh +++ b/packages/base/src/files/etc/profile.d/env.sh @@ -1,9 +1,9 @@ #!/usr/bin/env bash ### # ============LICENSE_START======================================================= -# Base Package +# ONAP # ================================================================================ -# Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. +# Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -19,16 +19,32 @@ # ============LICENSE_END========================================================= ### + +# some non-docker environments may set up POLICY_HOME +# as a templated installation var (ie. ${{x}}) instead of +# an environment variable (case of docker passed to the +# container). The following condition accommodates that +# scenario. + +templateRegex='^\$\{\{POLICY_HOME}}$' + +if [[ -z "${POLICY_HOME}" ]]; then + templatedPolicyHome='${{POLICY_HOME}}' + if [[ ! ${templatedPolicyHome} =~ ${templateRegex} ]]; then + POLICY_HOME=${templatedPolicyHome} + fi +fi + set -a -POLICY_HOME=${{POLICY_HOME}} +POLICY_HOME=${POLICY_HOME:=/opt/app/policy} -source ${POLICY_HOME}/etc/build.info -for c in ${POLICY_HOME}/etc/profile.d/*.conf ; do +confs=$(ls "${POLICY_HOME}"/etc/profile.d/*.conf 2> /dev/null) +for c in ${confs} ; do source ${c} done -for x in ${POLICY_HOME}/bin ${JAVA_HOME}/bin ${HOME}/bin ; do +for x in "${POLICY_HOME}"/bin "${JAVA_HOME}"/bin "${HOME}"/bin ; do if [ -d $x ] ; then case ":$PATH:" in *":$x:"*) :;; # already there -- cgit 1.2.3-korg