Skip to content
Snippets Groups Projects
Commit d51a6fe3 authored by Vivek Dutta's avatar Vivek Dutta
Browse files

bbfdm: Support to handler vendor extensions

parent 05b0f91a
Branches
No related tags found
1 merge request!1425Vendor specific datamodel extensions
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=bbfdm PKG_NAME:=bbfdm
PKG_VERSION:=1.14.1 PKG_VERSION:=1.14.2
USE_LOCAL:=0 USE_LOCAL:=0
ifneq ($(USE_LOCAL),1) ifneq ($(USE_LOCAL),1)
......
...@@ -9,10 +9,11 @@ SCRIPT=0 ...@@ -9,10 +9,11 @@ SCRIPT=0
DIAG=0 DIAG=0
PLUGIN=0 PLUGIN=0
DEST="" DEST=""
VENDOR_EXTN=""
TOOLS="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" TOOLS="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
SRC="" SRC=""
while getopts ":mpsdtu:" opt; do while getopts ":mpsdtv:" opt; do
case ${opt} in case ${opt} in
m) m)
MICRO_SERVICE=1 MICRO_SERVICE=1
...@@ -29,6 +30,9 @@ while getopts ":mpsdtu:" opt; do ...@@ -29,6 +30,9 @@ while getopts ":mpsdtu:" opt; do
t) t)
INPUT_FILE=1 INPUT_FILE=1
;; ;;
v)
VENDOR_EXTN=${OPTARG}
;;
?) ?)
echo "Invalid option: ${OPTARG}" echo "Invalid option: ${OPTARG}"
exit 1 exit 1
...@@ -88,6 +92,10 @@ bbfdm_install_dm() ...@@ -88,6 +92,10 @@ bbfdm_install_dm()
minfile=$(mktemp) minfile=$(mktemp)
jq -c 'del(..|.description?)' ${src} > ${minfile} jq -c 'del(..|.description?)' ${src} > ${minfile}
if [ -n "${VENDOR_EXTN}" ]; then
sed -i "s/{BBF_VENDOR_PREFIX}/${VENDOR_EXTN}/g" ${minfile}
fi
src=${minfile} src=${minfile}
if dpkg -s python3-jsonschema >/dev/null 2>&1; then if dpkg -s python3-jsonschema >/dev/null 2>&1; then
echo "Verifying bbfdm Datamodel JSON file" echo "Verifying bbfdm Datamodel JSON file"
...@@ -125,6 +133,7 @@ fi ...@@ -125,6 +133,7 @@ fi
if [ "${INPUT_FILE}" -eq "1" ]; then if [ "${INPUT_FILE}" -eq "1" ]; then
tempfile=""
if [ ! -f "${SRC}" ]; then if [ ! -f "${SRC}" ]; then
echo "# Datamodel Input file ${SRC} not available" echo "# Datamodel Input file ${SRC} not available"
exit 1 exit 1
...@@ -140,9 +149,18 @@ if [ "${INPUT_FILE}" -eq "1" ]; then ...@@ -140,9 +149,18 @@ if [ "${INPUT_FILE}" -eq "1" ]; then
exit 1 exit 1
fi fi
tempfile=$(mktemp)
cp ${SRC} ${tempfile}
if [ -n "${VENDOR_EXTN}" ]; then
sed -i "s/{BBF_VENDOR_PREFIX}/${VENDOR_EXTN}/g" ${tempfile}
fi
install_dir ${DEST}/etc/bbfdm/services install_dir ${DEST}/etc/bbfdm/services
install_data ${SRC} ${DEST}/etc/bbfdm/services/${DATA}.json install_data ${tempfile} ${DEST}/etc/bbfdm/services/${DATA}.json
if [ -f "${tempfile}" ]; then
rm ${tempfile}
fi
exit 0 exit 0
fi fi
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment