Add init loop in prometheus sidecar container
[osm/devops.git] / descriptor-packages / tools / gen_vnfd_pkg.sh
1 #!/bin/bash
2 #
3 # Copyright 2016 RIFT.IO Inc
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 # http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 #
17 # Author(s): Austin Cormier
18 # Creation Date: 2016/05/23
19 #
20
21 # Generates a NSD descriptor package from a source directory
22 # Usage:
23 # gen_vnfd_pkg.sh <pkg_src_dir> <pkg_dest_dir>
24
25 set -o nounset
26
27 if [ $# -ne 2 ]; then
28 echo "Error: Must provide 2 parameters" >@2
29 exit 1
30 fi
31
32 pkg_src_dir="$1"
33 pkg_dest_dir="$2"
34
35 if [ ! -e ${pkg_src_dir} ]; then
36 echo "Error: ${pkg_src_dir} does not exist"
37 exit 1
38 fi
39
40 if [ ! -e ${pkg_dest_dir} ]; then
41 echo "Error: ${pkg_src_dir} does not exist"
42 exit 1
43 fi
44
45 #echo "Generating package in directory: ${pkg_dest_dir}"
46
47 # Create any missing directories/files so each package has
48 # a complete hierachy
49 vnfd_dirs=( charms icons scripts images )
50 vnfd_files=( README )
51
52 vnfd_dir="${pkg_src_dir}"
53 #echo $(pwd)
54
55 mkdir -p "${pkg_dest_dir}"
56 cp -rf ${vnfd_dir}/* "${pkg_dest_dir}"
57 for sub_dir in ${vnfd_dirs[@]}; do
58 dir_path=${pkg_dest_dir}/${sub_dir}
59 mkdir -p ${dir_path}
60 done
61
62 for file in ${vnfd_files[@]}; do
63 file_path=${pkg_dest_dir}/${file}
64 touch ${file_path}
65 done