[VOL-5031] - Fix org.onosproject.segmentrouting not found.
Makefile
--------
o Add comment banners between targets for readability.
Dockerfile.voltha-onos
etc/mkdir-touch-active.sh
-------------------------
o Dockerfile has a growing list of directories that ops are applied to.
o Refactor logic into a shell script then pass in a list of directories.
o Directory segmentrouting must not exist in the onos artifact installed.
Change-Id: Ibf500fd39261d7c2cc019595b7edd5be95a79c0e
diff --git a/Dockerfile.voltha-onos b/Dockerfile.voltha-onos
index a884996..c48185a 100644
--- a/Dockerfile.voltha-onos
+++ b/Dockerfile.voltha-onos
@@ -53,7 +53,7 @@
# Install the applications
COPY app-install.sh ./app-install.sh
-RUN chmod 755 ./app-install.sh
+RUN chmod 755 app-install.sh
RUN ./app-install.sh
@@ -73,13 +73,24 @@
COPY --from=install ${APPS_ROOT}/ ${APPS_ROOT}/
COPY network-cfg.json $KARAF_ROOT/../config/network-cfg.json
-RUN touch $ONOS/apps/org.onosproject.hostprovider/active
-RUN touch $ONOS/apps/org.onosproject.openflow-base/active
-RUN touch $ONOS/apps/org.onosproject.lldpprovider/active
-RUN touch $ONOS/apps/org.onosproject.mcast/active
-RUN touch $ONOS/apps/org.onosproject.segmentrouting/active
+## -----------------------------------------------------------------------
+## Intent: Create package install directories.
+## -----------------------------------------------------------------------
+COPY etc/mkdir-touch-active.sh .
+RUN chmod 555 mkdir-touch-active.sh
+RUN ./mkdir-touch-active.sh\
+ $ONOS/apps/org.onosproject.hostprovider\
+ $ONOS/apps/org.onosproject.openflow-base\
+ $ONOS/apps/org.onosproject.lldpprovider\
+ $ONOS/apps/org.onosproject.mcast\
+ $ONOS/apps/org.onosproject.segmentrouting
+## [DEBUG]
+## RUN find "$ONOS/apps" -ls; exit 1
+
+## -----------------------------------------------------------------------
# Label image
+## -----------------------------------------------------------------------
ARG org_label_schema_version=unknown
ARG org_label_schema_vcs_url=unknown
ARG org_label_schema_vcs_ref=unknown
@@ -93,3 +104,5 @@
org.label-schema.vcs-ref=$org_label_schema_vcs_ref \
org.label-schema.build-date=$org_label_schema_build_date \
org.opencord.vcs-commit-date=$org_opencord_vcs_commit_date
+
+# [EOF]
\ No newline at end of file
diff --git a/Makefile b/Makefile
index 2bf35e6..fc66ac1 100644
--- a/Makefile
+++ b/Makefile
@@ -18,12 +18,6 @@
.PHONY: help
.DEFAULT_GOAL := help
-TOP ?= .
-MAKEDIR ?= $(TOP)/makefiles
-
-# set default shell
-SHELL = bash -e -o pipefail
-
##--------------------##
##---] INCLUDES [---##
##--------------------##
@@ -62,8 +56,12 @@
## Docker targets
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
build: docker-build ## alias for "docker-build"
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
local-onosapps: ## if LOCAL_ONOSAPPS=true runs the get-local-oars.sh
mkdir -p local_imports/oar
ifdef LOCAL_ONOSAPPS
@@ -71,7 +69,11 @@
./get-local-oars.sh
endif
-docker-build: local-onosapps ## build docker image: use DOCKER_REGISTRY, DOCKER_REPOSITORY and DOCKER_TAG to customize
+## -----------------------------------------------------------------------
+## Intent: build docker image
+## use DOCKER_REGISTRY, DOCKER_REPOSITORY and DOCKER_TAG to customize
+## -----------------------------------------------------------------------
+docker-build: local-onosapps ## build docker image
docker build $(DOCKER_BUILD_ARGS) \
-t ${ONOS_IMAGENAME} \
--build-arg LOCAL_ONOSAPPS=$(LOCAL_ONOSAPPS) \
@@ -82,6 +84,8 @@
--build-arg org_opencord_vcs_commit_date="${DOCKER_LABEL_COMMIT_DATE}" \
-f Dockerfile.voltha-onos .
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
test: ## verify that if the version is released we're not pointing to SNAPSHOT apps
bash tests/version-check.sh
diff --git a/etc/mkdir-touch-active.sh b/etc/mkdir-touch-active.sh
new file mode 100644
index 0000000..52c798a
--- /dev/null
+++ b/etc/mkdir-touch-active.sh
@@ -0,0 +1,92 @@
+#!/bin/bash
+# -----------------------------------------------------------------------
+# Copyright 2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# -----------------------------------------------------------------------
+
+##-------------------##
+##---] GLOBALS [---##
+##-------------------##
+set -euo pipefail
+
+umask 022
+
+## -----------------------------------------------------------------------
+## Intent: Display an error mesage then exit with shell exit status
+## -----------------------------------------------------------------------
+function error()
+{
+ local iam="${BASH_SOURCE[0]}::${FUNCNAME[1]}"
+ echo "$iam: ERROR: $*"
+ exit 1
+}
+
+## -----------------------------------------------------------------------
+## Intent: Display a message labeled for the running script
+## -----------------------------------------------------------------------
+function func_echo()
+{
+ local iam="${BASH_SOURCE[0]}::${FUNCNAME[1]}"
+ echo "$iam: $*"
+ return
+}
+
+## -----------------------------------------------------------------------
+## Intent: Display a message labeled for the running script
+## -----------------------------------------------------------------------
+function usage()
+{
+ [[ $# -gt 0 ]] && echo "$*"
+
+ func_echo "USAGE: $0 [args] dir[, .. dir]"
+ cat <<EOH
+Create a directory structure required for Dockerfile use.
+ --debug Enable debug mode
+ --help This message
+EOH
+
+ return
+}
+
+##----------------##
+##---] MAIN [---##
+##----------------##
+func_echo "HELLO"
+
+declare -a dirs=()
+while [[ $# -gt 0 ]]; do
+ arg="$1"; shift
+ case "$arg" in
+ -*debug) set -x ;;
+ -*help) usage ;;
+ -*) error "Detected unknown switch [$arg]" ;;
+ *) dirs+=("$arg") ;;
+ esac
+done
+
+[[ ${#dirs[@]} -eq 0 ]] && {
+ usage "At least one directory is required"
+ exit 1;
+}
+
+for dir in "${dirs[@]}";
+do
+ active="$dir/active"
+ mkdir -p "$dir"
+ touch "$active"
+done
+
+# find "${dirs[@]}" -ls
+
+# [EOF]