refactored to use vendored shell framework. lets test.
This commit is contained in:
@ -1,19 +1,25 @@
|
|||||||
#Boilerplate and support functions
|
#!/bin/bash
|
||||||
FrameworkIncludeFiles="$(ls -1 --color=none ../../../Framework-Includes/*)"
|
|
||||||
|
|
||||||
IFS=$'\n\t'
|
export PROJECT_ROOT_PATH
|
||||||
for file in ${FrameworkIncludeFiles[@]}; do
|
PROJECT_ROOT_PATH="$(realpath ../../)"
|
||||||
source "$file"
|
|
||||||
|
#Framework variables are read from hee
|
||||||
|
|
||||||
|
export GIT_VENDOR_PATH_ROOT
|
||||||
|
GIT_VENDOR_PATH_ROOT="$PROJECT_ROOT_PATH/vendor/git@git.knownelement.com/29418/"
|
||||||
|
|
||||||
|
export KNELShellFrameworkRoot
|
||||||
|
KNELShellFrameworkRoot="$GIT_VENDOR_PATH_ROOT/KNEL/KNELShellFramework"
|
||||||
|
|
||||||
|
source $KNELShellFrameworkRoot/Framework-ConfigFiles/FrameworkVars
|
||||||
|
|
||||||
|
for framework_include_file in $KNELShellFrameworkRoot/framework-includes/*; do
|
||||||
|
source "$framework_include_file"
|
||||||
done
|
done
|
||||||
unset IFS
|
|
||||||
|
|
||||||
ProjectIncludeFiles="$(ls -1 --color=none ../../../Project-Includes/*)"
|
for project_include_file in ../Project-Includes/*; do
|
||||||
IFS=$'\n\t'
|
source "$project_include_file"
|
||||||
for file in ${ProjectIncludeFiles[@]}; do
|
|
||||||
source "$file"
|
|
||||||
done
|
done
|
||||||
unset IFS
|
|
||||||
|
|
||||||
|
|
||||||
print_info "Setting up librenms agent..."
|
print_info "Setting up librenms agent..."
|
||||||
|
|
||||||
|
@ -1,31 +1,30 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
set -o errexit
|
#####
|
||||||
set -o nounset
|
#Core framework functions...
|
||||||
set -o pipefail
|
#####
|
||||||
set -o functrace
|
|
||||||
|
|
||||||
export PS4='(${BASH_SOURCE}:${LINENO}): - [${SHLVL},${BASH_SUBSHELL},$?] $ '
|
export PROJECT_ROOT_PATH
|
||||||
|
PROJECT_ROOT_PATH="$(realpath ../../)"
|
||||||
|
|
||||||
function error_out()
|
#Framework variables are read from hee
|
||||||
{
|
|
||||||
echo "Bailing out. See above for reason...."
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
function handle_failure() {
|
export GIT_VENDOR_PATH_ROOT
|
||||||
local lineno=$1
|
GIT_VENDOR_PATH_ROOT="$PROJECT_ROOT_PATH/vendor/git@git.knownelement.com/29418/"
|
||||||
local fn=$2
|
|
||||||
local exitstatus=$3
|
export KNELShellFrameworkRoot
|
||||||
local msg=$4
|
KNELShellFrameworkRoot="$GIT_VENDOR_PATH_ROOT/KNEL/KNELShellFramework"
|
||||||
local lineno_fns=${0% 0}
|
|
||||||
if [[ "$lineno_fns" != "-1" ]] ; then
|
source $KNELShellFrameworkRoot/Framework-ConfigFiles/FrameworkVars
|
||||||
lineno="${lineno} ${lineno_fns}"
|
|
||||||
fi
|
for framework_include_file in $KNELShellFrameworkRoot/framework-includes/*; do
|
||||||
echo "${BASH_SOURCE[0]}: Function: ${fn} Line Number : [${lineno}] Failed with status ${exitstatus}: $msg"
|
source "$framework_include_file"
|
||||||
}
|
done
|
||||||
|
|
||||||
|
for project_include_file in ../Project-Includes/*; do
|
||||||
|
source "$project_include_file"
|
||||||
|
done
|
||||||
|
|
||||||
trap 'handle_failure "${BASH_LINENO[*]}" "$LINENO" "${FUNCNAME[*]:-script}" "$?" "$BASH_COMMAND"' ERR
|
|
||||||
|
|
||||||
export DL_ROOT
|
export DL_ROOT
|
||||||
DL_ROOT="https://dl.knownelement.com/KNEL/FetchApply/"
|
DL_ROOT="https://dl.knownelement.com/KNEL/FetchApply/"
|
||||||
|
@ -1,11 +1,23 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
#####
|
||||||
|
#Core framework functions...
|
||||||
|
#####
|
||||||
|
|
||||||
|
export PROJECT_ROOT_PATH
|
||||||
|
PROJECT_ROOT_PATH="$(realpath ../../)"
|
||||||
|
|
||||||
#Framework variables are read from hee
|
#Framework variables are read from hee
|
||||||
source $PROJECT_ROOT_PATH/Framework-ConfigFiles/FrameworkVars
|
|
||||||
|
|
||||||
#Boilerplate and support functions
|
export GIT_VENDOR_PATH_ROOT
|
||||||
|
GIT_VENDOR_PATH_ROOT="$PROJECT_ROOT_PATH/vendor/git@git.knownelement.com/29418/"
|
||||||
|
|
||||||
for framework_include_file in ../Framework-Includes/*; do
|
export KNELShellFrameworkRoot
|
||||||
|
KNELShellFrameworkRoot="$GIT_VENDOR_PATH_ROOT/KNEL/KNELShellFramework"
|
||||||
|
|
||||||
|
source $KNELShellFrameworkRoot/Framework-ConfigFiles/FrameworkVars
|
||||||
|
|
||||||
|
for framework_include_file in $KNELShellFrameworkRoot/framework-includes/*; do
|
||||||
source "$framework_include_file"
|
source "$framework_include_file"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -1,13 +1,34 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
for framework_include_file in ../../../Framework-Includes/*; do
|
#####
|
||||||
|
#Core framework functions...
|
||||||
|
#####
|
||||||
|
|
||||||
|
export PROJECT_ROOT_PATH
|
||||||
|
PROJECT_ROOT_PATH="$(realpath ../)"
|
||||||
|
|
||||||
|
#Framework variables are read from hee
|
||||||
|
|
||||||
|
|
||||||
|
export GIT_VENDOR_PATH_ROOT
|
||||||
|
GIT_VENDOR_PATH_ROOT="$PROJECT_ROOT_PATH/vendor/git@git.knownelement.com/29418/"
|
||||||
|
|
||||||
|
export KNELShellFrameworkRoot
|
||||||
|
KNELShellFrameworkRoot="$GIT_VENDOR_PATH_ROOT/KNEL/KNELShellFramework"
|
||||||
|
|
||||||
|
source $KNELShellFrameworkRoot/Framework-ConfigFiles/FrameworkVars
|
||||||
|
|
||||||
|
for framework_include_file in $KNELShellFrameworkRoot/framework-includes/*; do
|
||||||
source "$framework_include_file"
|
source "$framework_include_file"
|
||||||
done
|
done
|
||||||
|
|
||||||
for project_include_file in ../../../Project-Includes/*; do
|
for project_include_file in ../Project-Includes/*; do
|
||||||
source "$project_include_file"
|
source "$project_include_file"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
#Framework variables are read from hee
|
||||||
|
source $PROJECT_ROOT_PATH/Framework-ConfigFiles/FrameworkVars
|
||||||
|
|
||||||
export SUBODEV_CHECK
|
export SUBODEV_CHECK
|
||||||
SUBODEV_CHECK="$(getent passwd | grep -c subodev || true)"
|
SUBODEV_CHECK="$(getent passwd | grep -c subodev || true)"
|
||||||
|
|
||||||
|
@ -1,5 +1,31 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
#####
|
||||||
|
#Core framework functions...
|
||||||
|
#####
|
||||||
|
|
||||||
|
export PROJECT_ROOT_PATH
|
||||||
|
PROJECT_ROOT_PATH="$(realpath ../../)"
|
||||||
|
|
||||||
|
#Framework variables are read from hee
|
||||||
|
|
||||||
|
export GIT_VENDOR_PATH_ROOT
|
||||||
|
GIT_VENDOR_PATH_ROOT="$PROJECT_ROOT_PATH/vendor/git@git.knownelement.com/29418/"
|
||||||
|
|
||||||
|
export KNELShellFrameworkRoot
|
||||||
|
KNELShellFrameworkRoot="$GIT_VENDOR_PATH_ROOT/KNEL/KNELShellFramework"
|
||||||
|
|
||||||
|
source $KNELShellFrameworkRoot/Framework-ConfigFiles/FrameworkVars
|
||||||
|
|
||||||
|
for framework_include_file in $KNELShellFrameworkRoot/framework-includes/*; do
|
||||||
|
source "$framework_include_file"
|
||||||
|
done
|
||||||
|
|
||||||
|
for project_include_file in ../Project-Includes/*; do
|
||||||
|
source "$project_include_file"
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
# We don't want to run this on the wazuh server, otherwise bad things happen...
|
# We don't want to run this on the wazuh server, otherwise bad things happen...
|
||||||
|
|
||||||
export TSYS_NSM_CHECK
|
export TSYS_NSM_CHECK
|
||||||
|
@ -8,9 +8,17 @@ export PROJECT_ROOT_PATH
|
|||||||
PROJECT_ROOT_PATH="$(realpath ../)"
|
PROJECT_ROOT_PATH="$(realpath ../)"
|
||||||
|
|
||||||
#Framework variables are read from hee
|
#Framework variables are read from hee
|
||||||
source $PROJECT_ROOT_PATH/Framework-ConfigFiles/FrameworkVars
|
|
||||||
|
|
||||||
for framework_include_file in ../Framework-Includes/*; do
|
|
||||||
|
export GIT_VENDOR_PATH_ROOT
|
||||||
|
GIT_VENDOR_PATH_ROOT="$PROJECT_ROOT_PATH/vendor/git@git.knownelement.com/29418/"
|
||||||
|
|
||||||
|
export KNELShellFrameworkRoot
|
||||||
|
KNELShellFrameworkRoot="$GIT_VENDOR_PATH_ROOT/KNEL/KNELShellFramework"
|
||||||
|
|
||||||
|
source $KNELShellFrameworkRoot/Framework-ConfigFiles/FrameworkVars
|
||||||
|
|
||||||
|
for framework_include_file in $KNELShellFrameworkRoot/framework-includes/*; do
|
||||||
source "$framework_include_file"
|
source "$framework_include_file"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user