From 2e80c5de293bcd24b36c88eacb4d862a17435c26 Mon Sep 17 00:00:00 2001 From: danielhanrahan Date: Tue, 25 Oct 2022 16:14:16 +0100 Subject: Make apex-pdp dockerfile consistent Make apex dockerfile consistent with other PF dockerfiles: Change apexuser to policy user Remove duplicate copy of examples directory Issue-ID: POLICY-4411 Signed-off-by: danielhanrahan Change-Id: Iee7560cf3263d13d38cd829af9b0389cbc256f49 --- .../src/main/package/scripts/apexAsh.sh | 30 +++++++++++++++++----- 1 file changed, 23 insertions(+), 7 deletions(-) (limited to 'packages/apex-pdp-package-full/src/main') diff --git a/packages/apex-pdp-package-full/src/main/package/scripts/apexAsh.sh b/packages/apex-pdp-package-full/src/main/package/scripts/apexAsh.sh index 60608f922..0b7b25afb 100755 --- a/packages/apex-pdp-package-full/src/main/package/scripts/apexAsh.sh +++ b/packages/apex-pdp-package-full/src/main/package/scripts/apexAsh.sh @@ -2,7 +2,7 @@ #------------------------------------------------------------------------------- # ============LICENSE_START======================================================= -# Copyright (C) 2016-2018 Ericsson. All rights reserved. +# Copyright (C) 2016-2022 Ericsson. All rights reserved. # Modifications Copyright (C) 2020-2021 AT&T Intellectual Property. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,12 +21,28 @@ # ============LICENSE_END========================================================= #------------------------------------------------------------------------------- -# Run from the Apex home directory -if [ ! -d /home/apexuser ]; then - echo Apex user home directory "/home/apexuser" not found - exit +if [ -z $APEX_HOME ]; then + APEX_HOME="/opt/app/policy/apex-pdp" +fi + +if [ ! -d $APEX_HOME ]; then + echo + echo 'Apex directory "'$APEX_HOME'" not set or not a directory' + echo "Please set environment for 'APEX_HOME'" + exit +fi + +if [ -z "$APEX_USER" ]; then + APEX_USER="apexuser" +fi + +id $APEX_USER > /dev/null 2>& 1 +if [ "$?" != "0" ]; then + echo 'cannot run apex, user "'$APEX_USER'" does not exit' + exit fi +# Run from the Apex home directory +cd $APEX_HOME # Run the command as "apexuser" -cd /home/apexuser -su apexuser +su $APEX_USER -- cgit 1.2.3-korg