init-env.sh: Fix location of templates/ directory

The script init-env.sh detects the location of templates/ directory
incorrectly. Add a global variable with the correct location.

Story: 2010226
Task: 46017

Signed-off-by: Davlet Panech <davlet.panech@windriver.com>
Change-Id: Idc676e3e71d131753fd2e99ade5056c05d7b23f2
This commit is contained in:
Davlet Panech 2022-08-15 09:19:37 -04:00
parent be58140638
commit 3bbc0b0466
2 changed files with 14 additions and 7 deletions

View File

@ -20,7 +20,7 @@ fi
if [[ ! -f "$BUILD_HOME/build.conf" ]] ; then
info "$BUILD_HOME/build.conf: file not found"
info "creating $BUILD_HOME/build.conf.example"
cp "$SCRIPTS_DIR/templates/build.conf.example.in" "$BUILD_HOME/build.conf.example"
cp "$TEMPLATES_DIR/build.conf.example.in" "$BUILD_HOME/build.conf.example"
info "Please use the example file as the starting point"
exit 1
fi
@ -38,7 +38,7 @@ done
# Install source_me.sh to $BUILD_HOME
info "creating $BUILD_HOME/source_me.sh"
cp "$SCRIPTS_DIR/templates/source_me.sh.in" "$BUILD_HOME/source_me.sh"
cp "$TEMPLATES_DIR/source_me.sh.in" "$BUILD_HOME/source_me.sh"
# Delete old jenkins job list
if [[ -d "$BUILD_HOME/jenkins" ]] ; then

View File

@ -13,13 +13,16 @@ source "${BASH_SOURCE[0]%/*}"/utils.sh || return 1
source "${BASH_SOURCE[0]%/*}"/log_utils.sh || return 1
# Top-level source directory of jenkins scripts repo
TOP_SCRIPTS_DIR=$(readlink -f "${BASH_SOURCE[0]%/*}"/..)
TOP_SRC_DIR=$(readlink -f "${BASH_SOURCE[0]%/*}"/../..)
# Library scripts dir
LIB_DIR="$TOP_SCRIPTS_DIR/lib"
LIB_DIR="$TOP_SRC_DIR/lib"
# Scripts dir
SCRIPTS_DIR="$TOP_SCRIPTS_DIR/scripts"
SCRIPTS_DIR="$TOP_SRC_DIR/scripts"
# Templates directory
TEMPLATES_DIR="${SCRIPTS_DIR}/templates"
# When true produce less noise
#QUIET=false
@ -264,8 +267,12 @@ __get_protected_dirs() {
local dir
for dir in $(echo "$DESIGNER_ROOTS" "$LOADBUILD_ROOTS" | sed 's/:/ /g') ; do
echo "$dir:ro"
echo "$dir/$USER/$PROJECT"
if [[ -d "$dir" ]] ; then
echo "$dir:ro"
if [[ -d "$dir/$USER/$PROJECT" ]] ; then
echo "$dir/$USER/$PROJECT"
fi
fi
done
}